![]() |
cronjob for php-session
Hello all,
I want session files older than 30 minutes automatic deleted and according to this information found in php.in I have to create cronjob or a script Code:
; NOTE: If you are using the subdirectory option for storing session files[root@obelix ~]# crontab -e Code:
*/30 * * * * root find -cmin +30 | xargs rm /var/lib/php/session &> /dev/nullCode:
*/30 * * * * root /var/lib/php/session find -cmin +30 | xargs rm /var/lib/php/session &> /dev/nullCode:
*/30 * * * * cd /var/lib/php/session find -cmin +30 | xargs rm &> /dev/nullWho knows the right syntax ? |
Take a look at http://www.howtoforge.com/back_up_my..._interruptions
The /usr/local/sbin/mysqlbackup.sh script should give you the idea how to do this. :) |
My php set up has this cron job to delete sessions every 30 minutes. In /etc/cron.d/php5 file...
Code:
0,30 * * * * root [ -x /usr/lib/php5/maxlifetime ] && [ -d /var/lib/php5 ] && find /var/lib/php5/ -type f -cmin +$(/usr/lib/php5/maxlifetime) -print0 | xargs -n 200 -r -0 rm |
@ Falko,
At first I thought "stop this is too difficult for me" my second thought was "a challenge" What you say is make a script and make a cronjob for the script. From your example I only need Code:
#!/bin/shCode:
"$( /usr/bin/find /home/sqlbackup -type f -mtime +2 )"Code:
"$( /usr/bin/find /var/lib/php/session -type f -cmin +30 )"Code:
chmod 755 /usr/local/sbin/cleanup.shCode:
*/30 * * * * /usr/local/sbin/cleanup.sh &> /dev/null@BorderAmigos, I am challenged by Falko's suggestion, if I fail I use your cronjob. |
| All times are GMT +2. The time now is 13:11. |
Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2013, vBulletin Solutions, Inc.