]>
Commit | Line | Data |
---|---|---|
ee96ae59 | 1 | #!/bin/sh |
c29d80f3 | 2 | |
cebbf362 | 3 | [ -x /usr/sbin/tmpwatch ] || exit 0 |
c29d80f3 | 4 | |
cebbf362 ER |
5 | session_dir=/var/run/php |
6 | # find minimum gc time from any of the php engines | |
7 | gc_time=0 | |
8 | for php in php php4 php52 php53 php54 php55; do | |
9 | gc= | |
10 | if [ -x /usr/bin/$php ]; then | |
11 | gc=$($php -r 'echo max(round(ini_get("session.gc_maxlifetime")/3600), 1);' 2> /dev/null) | |
12 | elif [ -r /etc/$php/php.ini ]; then | |
13 | gc=$(awk -F"=" '/^session.gc_maxlifetime[ \t]*=/ { t=sprintf("%d", ($2/3600)); if (t<1) { t=1; }; print t; exit;}' /etc/$php/php.ini) | |
14 | fi | |
15 | [ -n "$gc" ] || continue | |
ee96ae59 | 16 | |
cebbf362 ER |
17 | if [ "$gc" -lt "$gc_time" ] || [ $gc_time -eq 0 ]; then |
18 | gc_time=$gc | |
19 | fi | |
20 | done | |
ee96ae59 | 21 | |
cebbf362 ER |
22 | [ $gc_time -gt 0 ] || exit 0 |
23 | /usr/sbin/tmpwatch $gc_time $session_dir |