Source: php-defaults Version: 1:7.0+47 Severity: wishlist Tags: patch Hi,
The attached patch enables systemd timer support for phpsessionclean. It adds the neccessary timer and service and adds a check to the cron command line to run only when not using systemd. -- System Information: Debian Release: stretch/sid APT prefers unstable-debug APT policy: (500, 'unstable-debug'), (500, 'unstable'), (103, 'experimental') Architecture: amd64 (x86_64) Foreign Architectures: i386 Kernel: Linux 4.9.0-rc8-amd64 (SMP w/4 CPU cores) Locale: LANG=de_DE.UTF-8, LC_CTYPE=de_DE.UTF-8 (charmap=UTF-8) Shell: /bin/sh linked to /bin/dash Init: systemd (via /run/systemd/system)
From 79f31a42c268280bbb5909e24a8cfc65094964e9 Mon Sep 17 00:00:00 2001 From: Daniel Schaal <daniel@schaal.email> Date: Tue, 27 Dec 2016 09:31:46 +0100 Subject: [PATCH] Add support for systemd timers for phpsessionclean * Add systemd timer and service for phpsessionclean * Add check to run phphsessionclean from cron only when not using systemd --- debian/control | 2 +- debian/php-common.install | 2 ++ debian/php-common.php.cron.d | 2 +- debian/phpsessionclean.service | 11 +++++++++++ debian/phpsessionclean.timer | 9 +++++++++ debian/rules | 9 ++++++++- 6 files changed, 32 insertions(+), 3 deletions(-) create mode 100644 debian/phpsessionclean.service create mode 100644 debian/phpsessionclean.timer diff --git a/debian/control b/debian/control index 1227f1a..7d97b00 100644 --- a/debian/control +++ b/debian/control @@ -5,7 +5,7 @@ Maintainer: Debian PHP Maintainers <pkg-php-ma...@lists.alioth.debian.org> Uploaders: Ondřej Surý <ond...@debian.org>, Lior Kaplan <kap...@debian.org> Standards-Version: 3.9.8 -Build-Depends: debhelper (>= 9) +Build-Depends: debhelper (>= 9), dh-systemd Vcs-Browser: https://anonscm.debian.org/cgit/pkg-php/php-defaults.git Vcs-Git: git://anonscm.debian.org/pkg-php/php-defaults.git diff --git a/debian/php-common.install b/debian/php-common.install index 94d02b4..f9ca4a3 100644 --- a/debian/php-common.install +++ b/debian/php-common.install @@ -3,3 +3,5 @@ php-maintscript-helper /usr/lib/php/ phpenmod /usr/sbin/ phpquery /usr/sbin/ sessionclean /usr/lib/php/ +debian/phpsessionclean.timer /lib/systemd/system/ +debian/phpsessionclean.service /lib/systemd/system/ diff --git a/debian/php-common.php.cron.d b/debian/php-common.php.cron.d index 3628b34..84e5d10 100644 --- a/debian/php-common.php.cron.d +++ b/debian/php-common.php.cron.d @@ -11,4 +11,4 @@ # sessions yourself. # Look for and purge old sessions every 30 minutes -09,39 * * * * root [ -x /usr/lib/php/sessionclean ] && /usr/lib/php/sessionclean +09,39 * * * * root [ -x /usr/lib/php/sessionclean ] && if [ ! -d /run/systemd/system ]; then /usr/lib/php/sessionclean; fi diff --git a/debian/phpsessionclean.service b/debian/phpsessionclean.service new file mode 100644 index 0000000..80ab95c --- /dev/null +++ b/debian/phpsessionclean.service @@ -0,0 +1,11 @@ +[Unit] +Description=Clean php session files + +[Service] +Type=oneshot +ExecStart=/usr/lib/php/sessionclean +ProtectHome=true +ProtectSystem=true +PrivateTmp=true +PrivateDevices=true +PrivateNetwork=true diff --git a/debian/phpsessionclean.timer b/debian/phpsessionclean.timer new file mode 100644 index 0000000..65d98c5 --- /dev/null +++ b/debian/phpsessionclean.timer @@ -0,0 +1,9 @@ +[Unit] +Description=Clean PHP session files every 30 mins + +[Timer] +OnCalendar=*-*-* *:09,39:00 +Persistent=true + +[Install] +WantedBy=timers.target diff --git a/debian/rules b/debian/rules index 6f36c5c..9acd7f8 100755 --- a/debian/rules +++ b/debian/rules @@ -32,7 +32,7 @@ ifeq (Ubuntu,$(DEB_VENDOR)) endif %: - dh $@ + dh $@ --with systemd override_dh_auto_configure: : @@ -86,4 +86,11 @@ override_dh_gencontrol: dh_gencontrol -pphp-all-dev -- -v$(PHP_COMMON_DEB_VERSION) dh_gencontrol --remaining-packages -- -v$(PHP_DEB_VERSION) +override_dh_systemd_enable: + dh_systemd_enable --package=php-common phpsessionclean.timer + +override_dh_systemd_start: + dh_systemd_start --package=php-common phpsessionclean.timer + dh_systemd_start --package=php-common --no-start phpsessionclean.service + .PHONY: debian/control -- 2.11.0