Getting e-mails from root cron

ramasaig

Member
Aug 25, 2007
9
1
53
Isle of Mull, Scotland
I have been trying to understand when and how php sessions are being deleted from my server. Some websites are my own, others belong to clients. All have their own user names (and groups. The session files are stored at '/var/cpanel/php/sessions/ea-php73' but I also have some current ones at '/../ea-php72'. I'm not sure why I have both.

I have looked at 'clean_user_php_sessions', and I can see it's running as a root cron job at 9 and 39 minutes past every hour. The output is directed to NULL. I would like to have the output sent to me as an e-mail (as a temporary measure) in the hope that I can see what's going on. I have edited the crontab, and added MAILTO='[email protected]' and removed the ' > /dev/null 2>&1' from the end of the relevant cron command line ('9,39 * * * * /usr/local/cpanel/scripts/clean_user_php_sessions').

But I still get no e-mails. Do I need to do something further? I'm assuming that if there's actually no output I'd still get an e-mail telling me that?
 

ramasaig

Member
Aug 25, 2007
9
1
53
Isle of Mull, Scotland
Hello! Are you able to set a custom session folder for the domains?
I probably could, but the documentation suggests that I'd then have to set up a custom means of clearing old sessions for each one. I'm not sure this would be a good use of time!

In regards to the cronjob, can you see if this article helps?
From this article it looks as if an e-mail is NOT sent if there's no output (contrary to my assumption). I have run the job script in Putty and get no output, so it would seem I'm not going to get any e-mail.

Having now had a lengthy run around the whole matter of deleting old sessions I think the best thing to do will be to delete manually the sessions from 2020 lingering in the directory '/.../ea-php70' (over 250 of them!), and leave the existing cron job to deal with sessions in '/.../ea-php72' and '/.../ea-php73', which it seems to be doing quite well. Thanks for your help.