diff --git a/createlinks b/createlinks index 2c04010..91d1a22 100644 --- a/createlinks +++ b/createlinks @@ -39,8 +39,6 @@ $event = 'smeserver-BackupPC-update'; #Must match rpm name safe_symlink("restart", "root/etc/e-smith/events/logrotate/services2adjust/httpd-bkpc"); # Create needed empty files - safe_touch("root/etc/e-smith/events/logrotate/logfiles2timestamp/var/log/httpd/bkpc_access_log"); - safe_touch("root/etc/e-smith/events/logrotate/logfiles2timestamp/var/log/httpd/bkpc_error_log"); safe_touch("root/var/service/httpd-bkpc/down"); diff --git a/root/etc/e-smith/templates/etc/httpd/bkpc-conf/httpd.conf/20Modules b/root/etc/e-smith/templates/etc/httpd/bkpc-conf/httpd.conf/20Modules index b5e3e93..43a947e 100644 --- a/root/etc/e-smith/templates/etc/httpd/bkpc-conf/httpd.conf/20Modules +++ b/root/etc/e-smith/templates/etc/httpd/bkpc-conf/httpd.conf/20Modules @@ -53,6 +53,7 @@ foreach (qw( access_compat authn_core authz_core + systemd )) { next unless -f "/usr/lib/httpd/modules/mod_${_}.so" || diff --git a/root/usr/lib/systemd/system/httpd-bkpc.service b/root/usr/lib/systemd/system/httpd-bkpc.service index 70f42b8..c8dc9fe 100644 --- a/root/usr/lib/systemd/system/httpd-bkpc.service +++ b/root/usr/lib/systemd/system/httpd-bkpc.service @@ -3,9 +3,19 @@ Description=BackupPC web page After=network.target [Service] -Type=forking -#PIDFile=/run/bandwidthd.pid -ExecStart=/var/service/httpd-bkpc/run +Type=notify +ExecStartPre=/sbin/e-smith/service-status httpd-bkpc +ExecStartPre=/sbin/e-smith/expand-template /etc/httpd/bkpc-conf/httpd.conf +ExecStart=/usr/sbin/httpd -f /etc/httpd/bkpc-conf/httpd.conf -DFOREGROUND +ExecReload=/usr/sbin/httpd -f /etc/httpd/bkpc-conf/httpd.conf -k graceful +ExecStop=/bin/kill -WINCH ${MAINPID} +# We want systemd to give httpd some time to finish gracefully, but still want +# it to kill httpd after TimeoutStopSec if something went wrong during the +# graceful stop. Normally, Systemd sends SIGTERM signal right after the +# ExecStop, which would kill httpd. We are sending useless SIGCONT here to give +# httpd time to finish. +KillSignal=SIGCONT +PrivateTmp=true [Install] WantedBy=sme-server.target diff --git a/root/usr/share/smanager/lib/SrvMngr/Controller/Backuppc.pm b/root/usr/share/smanager/lib/SrvMngr/Controller/Backuppc.pm index eceb5d8..2624bb1 100644 --- a/root/usr/share/smanager/lib/SrvMngr/Controller/Backuppc.pm +++ b/root/usr/share/smanager/lib/SrvMngr/Controller/Backuppc.pm @@ -39,11 +39,10 @@ sub main { my $c = shift; $c->app->log->info($c->log_req); - - $cdb = esmith::ConfigDB::UTF8->open || die "Couldn't open config db"; - $adb = esmith::AccountsDB::UTF8->open || die "Couldn't open accounts db"; - - my $url = "https://".$c->session->{'SystemName'}.".".$c->session->{"DomainName"}."/BackupPC"; + $cdb = esmith::ConfigDB::UTF8->open || die "Couldn't open config db"; + $adb = esmith::AccountsDB::UTF8->open || die "Couldn't open accounts db"; + my $host = $c->req->url->to_abs->host; + my $url = "https://$host/BackupPC"; $c->stash(url => $url ); $c->render(template => 'backuppc'); @@ -72,4 +71,4 @@ sub get_backuppc { return $out; } -1; \ No newline at end of file +1; diff --git a/root/var/service/httpd-bkpc/log/run b/root/var/service/httpd-bkpc/log/run deleted file mode 100644 index 9618b17..0000000 --- a/root/var/service/httpd-bkpc/log/run +++ /dev/null @@ -1,27 +0,0 @@ -#!/bin/sh - -#---------------------------------------------------------------------- -# copyright (C) 2005 Mitel Networks Corporation -# -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -# -# Technical support for this program is available from Mitel Networks -# Please visit our web site www.mitel.com/sme/ for details. -#---------------------------------------------------------------------- -exec \ - /usr/local/bin/setuidgid smelog \ - /usr/local/bin/multilog t s5000000 \ - /var/log/httpd-bkpc - diff --git a/root/var/service/httpd-bkpc/run b/root/var/service/httpd-bkpc/run deleted file mode 100644 index 3d1855b..0000000 --- a/root/var/service/httpd-bkpc/run +++ /dev/null @@ -1,12 +0,0 @@ -#!/bin/sh -#---------------------------------------------------------------------- -# copyright (C) 1999-2004 Mitel Networks Corporation -#---------------------------------------------------------------------- - -config=/etc/httpd/bkpc-conf/httpd.conf - -[ -e $config ] || exit 1 - -exec 2>&1 -exec chpst -P /usr/sbin/httpd -f $config -D FOREGROUND& - diff --git a/smeserver-BackupPC.spec b/smeserver-BackupPC.spec index 4f877e4..cc534e4 100644 --- a/smeserver-BackupPC.spec +++ b/smeserver-BackupPC.spec @@ -4,7 +4,7 @@ Name: smeserver-BackupPC Version: 0.2 -Release: 21%{?dist} +Release: 22%{?dist} Summary: BackupPC integration into SME server Group: Applications/System @@ -52,6 +52,11 @@ This package contains specific configuration for SME server #---------------------------------------------------- %changelog +* Thu Oct 30 2025 Jean-Philippe Pialasse 0.2-22.sme +- remove sv files, rewrite systemd unit [SME: 11517] +- remove /var/log/httpd-bkpc/ [SME: 12197] +- remove logfiles2timestamp [SME: 12196] + * Sun Oct 05 2025 Brian Read 0.2-21.sme - Add UTF8 and avoid potential DB caching problems [SME: 13209] @@ -206,10 +211,6 @@ perl createlinks %install -%{__mkdir} -p $RPM_BUILD_ROOT/var/service/httpd-bkpc/supervise -%{__mkdir} -p $RPM_BUILD_ROOT/var/service/httpd-bkpc/log/supervise -%{__mkdir} -p $RPM_BUILD_ROOT/var/log/httpd-bkpc - (cd root ; /usr/bin/find . -depth -print | /bin/cpio -dump $RPM_BUILD_ROOT) /bin/rm -f %{name}-%{version}-filelist @@ -231,13 +232,6 @@ perl createlinks --file "/etc/BackupPC/remoteArchive.conf" "attr(640,backuppc,backuppc) %config(noreplace)" \ --file "/etc/BackupPC/remoteCopyPool.conf" "attr(640,backuppc,backuppc) %config(noreplace)" \ --dir "/etc/BackupPC/pc" "attr(750,backuppc,backuppc)" \ - --dir "/var/service/httpd-bkpc" "attr(01755,root,root)" \ - --file "/var/service/httpd-bkpc/run" "attr(0700,root,root)" \ - --dir "/var/service/httpd-bkpc/supervise" "attr(0700,root,root)" \ - --dir "/var/service/httpd-bkpc/log" "attr(0755,root,root)" \ - --file "/var/service/httpd-bkpc/log/run" "attr(0755,root,root)" \ - --dir "/var/service/httpd-bkpc/log/supervise" "attr(0700,root,root)" \ - --dir "/var/log/httpd-bkpc" "attr(0750,smelog,smelog)" \ --ignoredir "/root/var/" \ --ignoredir "/usr/share/BackupPC" \ --ignoredir "/usr/share/BackupPC/lib" \