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) # | | | .------- month (1 - 12) OR jan,feb,mar,apr ... # | | | | .---- day of week (0 - 6) (Sunday=0 or 7) OR sun,mon,tue,wed,thu,fri,sat # | | | | | # * * * * * user-name command to be executed Recently, I found an online cron scheduler editor - crontab.guru. It can be used to create a new task expression, or we can use it to verify the existing cron schedule expressions that we have. ...

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; cron included. To install it, # yum install cronie After the installation, you can verify that crond is running: # chkconfig --list crond crond 0:off 1:off 2:on 3:on 4:on 5:on 6:off

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