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
This commit is contained in:
parent
b5ed906aa2
commit
87f0c9270d
2
debian/control
vendored
2
debian/control
vendored
|
@ -5,7 +5,7 @@ Maintainer: Debian PHP Maintainers <pkg-php-maint@lists.alioth.debian.org>
|
|||
Uploaders: Ondřej Surý <ondrej@debian.org>,
|
||||
Lior Kaplan <kaplan@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
|
||||
|
||||
|
|
2
debian/php-common.install
vendored
2
debian/php-common.install
vendored
|
@ -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/
|
||||
|
|
2
debian/php-common.php.cron.d
vendored
2
debian/php-common.php.cron.d
vendored
|
@ -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
|
||||
|
|
11
debian/phpsessionclean.service
vendored
Normal file
11
debian/phpsessionclean.service
vendored
Normal file
|
@ -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
|
9
debian/phpsessionclean.timer
vendored
Normal file
9
debian/phpsessionclean.timer
vendored
Normal file
|
@ -0,0 +1,9 @@
|
|||
[Unit]
|
||||
Description=Clean PHP session files every 30 mins
|
||||
|
||||
[Timer]
|
||||
OnCalendar=*-*-* *:09,39:00
|
||||
Persistent=true
|
||||
|
||||
[Install]
|
||||
WantedBy=timers.target
|
9
debian/rules
vendored
9
debian/rules
vendored
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue