How do I set up cron to run in my nextcloud instance?
In the nextcloud settings page I have a message:
There are some errors regarding your setup.
*Last background job execution ran 4 days ago. Something seems wrong. Check the background job settings ↗.*
Can you give me detailed instructions how to fix this? (I am a complete novice at server admin)
Ian
4 Replies
You can find a lot on google but here is my nextcloud cron job for root:
0 2 * * * sudo -u www-data php < path to occ > files:scan --all
30 2 * * * sudo -u www-data php < path to occ > preview:generate-all
Use crontab -e as root.
Filescan starts at 2am and preview generates at 2:30am every day.
Thanks Kenneth, unfortunately I don't seem to be able to run the crontab -u www-data -e command as root.
This is the response crontab: user `www-data' unknown
To add crontab jobs, enter: crontab -e
You will then be asked to use a editor, default is nano. Then you will see some info about crontab etc (all comments). Add the fullscan line or both, remember to update path.
Hit CTRL+X, Y, Enter
The author of the utube tutorial informed me that:
Instead of www-data use httpd, that is the webserver user name for rhel based distros
but I still get
[root@avi*** ~]# crontab -e -u httpd
crontab: user `httpd' unknown*
Also tried using systemd (nextcloudcron.service and nextcloudcron.timer) as suggested on the Nextcloud Background jobs instructions but that doesn't seem to work either.