Commit 14d1980d authored by Paul Cammish's avatar Paul Cammish

Clean PHP Sessions (buster)

parent 0dd2f77d
CHANGELOG
---------
2019-12-16
sympl-web
* Added cron to clean up old PHP sessions
2019-12-05
sympl-core
......
sympl-web (10.0.191216.0) stable; urgency=medium
* Added cron to clean up old PHP sessions
-- Paul Cammish <sympl@kelduum.net> Mon, 16 Dec 2019 11:45:02 +0000
sympl-web (10.0.190709.0) stable; urgency=medium
* Updated sympl-web-rotate-logs to support new ownership
......
#!/bin/sh
# Script to clean up old Sympl PHP sessions in /srv/*/php_sessions, based on stock Debian version.
session_config=$(PHP_INI_SCAN_DIR=/etc/php/${version}/${conf_dir}/conf.d/ php${version} -c /etc/php/${version}/${conf_dir}/php.ini -d "error_reporting='~E_ALL'" -r 'foreach(ini_get_all("session") as $k => $v) echo "$k=".$v["local_value"]."\n";')
gc_maxlifetime=$(($(echo "$session_config" | sed -ne 's/^session\.gc_maxlifetime=\(.*\)$/\1/p')/60))
for domain in $( find /srv/ -mindepth 2 -maxdepth 2 -type d -name php_sessions ); do
find -O3 "$domain/" -ignore_readdir_race -depth -mindepth 1 -name 'sess_*' -type f -cmin "+$gc_maxlifetime" -delete
done
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment