CronTab Manager

Just installed crontab manager so I could create my own cronjobs easily. I created one to restart the php80-php-fpm daemon (to clear out PHP opcache weekly), having root as the user and/user/bin/systemctl restart php80-php-fpm.service for the command. Or should I leave the directories out of the command and just use systemctl restart php80-php-fpm.service? Which is the proper command to enter in the app? If I test it from a Putty terminal logged in as root, /user/bin/systemctl restart php80-php-fpm.service spits back no such file or directory, but that could be because I’m already logged in as root.

As a side note, it would be nice if the app had a RUN NOW button to test the cronjob out.

Is it even necessary to do this or does opcache flush itself automatically as needed?

2 Likes

Hi @dalbring

AFAIK, systemctl restart servicename (Call does NOT need full path!)will not give any feedback.
But systemctl status servicename will…

So I pack both lines in a small script, add in a logging output to /var/log/myjobs (The script actually checks in first run if this folder exists, if not it will create it and use that to place any logging / output).
and run the cronjob I need…

I keep alls such jobs in /etc/Jobs, this since more than 20 years now…

I’m not 100% sure, but AFAIK, php8 opcache cleans itself…
Maybe @stephdl can help here…

My 2 cents
Andy

for everything running under that php service a service reload would be enough.

This blog post explains conditions to be met for opcache to restart when cache is full:

opcache.force_restart_timeout may have also something to do.

This old blog post talks about ways to flush the cache, including service reload or cachetool (don’t know it the tool is up to date / maintained)

Thank you for the replies. I removed the path from the command. The code for crontab manager puts the script for the job directly in the crontab config file. That doesn’t bother me. I think it’s a nice feature. I’ll have to read through Marc’s links and see how I can see how full the opcache is and compare before and afters.