Crontab Info

Examples:
https://crontab.guru/examples.html

Info:
https://crontab.guru/crontab.5.html

for Nextcloud:
https://docs.nextcloud.com/server/11/admin_manual/configuration_server/background_jobs_configuration.html

Nextcloud better example:
https://help.nextcloud.com/t/error-on-cron-php-execute-via-crontab-or-command-line/583/2

$ sudo -u www-data crontab -e

then enter the code below at the bottom (runs every 4 hours):

* */4 * * * php -f /var/www/html/nextcloud/cron.php

0r everyday at 2am:

* 2 * * * php -f /var/www/html/nextcloud/cron.php

To verify if the cron job has been added and scheduled:

$ sudo -u www-data crontab -l

More info & editing crontabs:
https://help.ubuntu.com/community/CronHowto

to edit the crontab:

sudo -u www-data crontab -e

How can I tell if my crontab has run:
check ‘/var/log/syslog’

or better yet:
http://askubuntu.com/questions/149504/how-can-i-tell-if-my-hourly-cron-job-has-run

to check cron status:

$ systemctl status cron

also, how to run a cron manually (the example below is for nextcloud):

$ sudo -u www-data php -f /var/www/html/nextcloud/cron.php

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.