Creating Cron Job on RHEL7

Found a great resource for creating cron jobs in Red Hat Enterprise Linux 7:

https://access.redhat.com/documentation/en-US/Red_Hat_Enterprise_Linux/6/html/Deployment_Guide/ch-Automating_System_Tasks.html

(Yes it is from the creator’s website!) How cron jobs are laid out in /etc/crontab:

SHELL=/bin/bash
PATH=/sbin:/bin:/usr/sbin:/usr/bin
MAILTO=root
HOME=/
# 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
# | | | | |
# * * * * * username  command to be executed

So for example, if you want to create a cron job that will start XAMPP Apache server every weekday:

0 8 * * mon,tue,wed,thu,fri root /opt/lampp/laampp start

If you aren’t sure if you have cron or anacron available on your machine, you can run:

$ rpm -q cronie cronie-anacron

If you have cron packages installed, the command above will list them.