Replacing cron with systemd timer

Well, I don’t currently really have a good reason to replace a working cron job with systemd-timer beside practicing it. The following is the existing cron task for www-data user. I want to convert this cron to a systemd-timer: $ sudo crontab -l -u www-data # m h dom mon dow command */5 * * * * php -f /var/www/nextcloud/cron.php The above output indicates that the command php -f /var/www/nextcloud/cron.php is run at every 5th minute, of course by www-data user....

September 3, 2024 · 3 min · 428 words · kenno

Crontab Tip

On Fedora based system, whenever I need help writing a cron task and confused which field is minute, hour, day,..etc, I usually check the /etc/crontab file. ❯ cat /etc/crontab SHELL=/bin/bash PATH=/sbin:/bin:/usr/sbin:/usr/bin MAILTO=root # For details see man 4 crontabs # Example of job definition: # .---------------- minute (0 - 59) # | .------------- hour (0 - 23) # | | .---------- day of month (1 - 31) # | | | ....

December 13, 2020 · 1 min · 164 words · kenno

How to test cron

So you drop a script in /etc/cron.daily. How to check if that script does what it is expected to do without having to wait, in this case, a day? Here is how: # run-parts -v /etc/cron.daily Reference: http://stackoverflow.com/questions/4984725/how-to-test-cron-job

February 18, 2014 · 1 min · 38 words · kenno

Install crontab on CentOS 6

When you install CentOS 6 using minimal CD, a lot of packages aren’t installed by default; <strong>cron</strong> included. To install it, After the installation, you can verify that crond is running:

May 27, 2013 · 1 min · 31 words · kenno