Browse Source

Fix add php session cleanup cron

Robert Zollner 6 years ago
parent
commit
2feb35b425
3 changed files with 14 additions and 1 deletions
  1. 5 0
      install/hst-install-debian.sh
  2. 5 0
      install/hst-install-ubuntu.sh
  3. 4 1
      install/upgrade/0.10.0-190430.sh

+ 5 - 0
install/hst-install-debian.sh

@@ -1235,6 +1235,11 @@ for pconf in $(find /etc/php* -name php.ini); do
     sed -i 's%_open_tag = Off%_open_tag = On%g' $pconf
 done
 
+# Cleanup php session files not changed in the last 7 days (60*24*7 mintes)
+echo '#!/bin/sh' > /etc/cron.daily/php-session-cleanup
+echo "find -O3 /home/*/tmp/ -ignore_readdir_race -depth -mindepth 1 -name 'sess_*' -type f -cmin '+10080' -delete > /dev/null 2>&1" >> /etc/cron.daily/php-session-cleanup
+chmod 644 /etc/cron.daily/php-session-cleanup
+
 
 #----------------------------------------------------------#
 #                    Configure Vsftpd                      #

+ 5 - 0
install/hst-install-ubuntu.sh

@@ -1199,6 +1199,11 @@ for pconf in $(find /etc/php* -name php.ini); do
     sed -i 's%_open_tag = Off%_open_tag = On%g' $pconf
 done
 
+# Cleanup php session files not changed in the last 7 days (60*24*7 mintes)
+echo '#!/bin/sh' > /etc/cron.daily/php-session-cleanup
+echo "find -O3 /home/*/tmp/ -ignore_readdir_race -depth -mindepth 1 -name 'sess_*' -type f -cmin '+10080' -delete > /dev/null 2>&1" >> /etc/cron.daily/php-session-cleanup
+chmod 644 /etc/cron.daily/php-session-cleanup
+
 
 #----------------------------------------------------------#
 #                    Configure Vsftpd                      #

+ 4 - 1
install/upgrade/0.10.0-190430.sh

@@ -239,7 +239,10 @@ for ipaddr in $(ls /usr/local/hestia/data/ips/ 2>/dev/null); do
     fi
 done
 
-
+# Cleanup php session files not changed in the last 7 days (60*24*7 mintes)
+echo '#!/bin/sh' > /etc/cron.daily/php-session-cleanup
+echo "find -O3 /home/*/tmp/ -ignore_readdir_race -depth -mindepth 1 -name 'sess_*' -type f -cmin '+10080' -delete > /dev/null 2>&1" >> /etc/cron.daily/php-session-cleanup
+chmod 644 /etc/cron.daily/php-session-cleanup
 
 # Fix empty pool error message for MultiPHP
 php_versions=$(ls /etc/php/*/fpm -d 2>/dev/null |wc -l)