This short video will show you how to set up cron jobs on CentOS 7.
Although the Linux distro in the tutorial is CentOS 7, this tutorial should work on most versions of Linux.
We first set up a script that will allow us to test cron.
We then enter cron by running crontab -e.
We then tell cron to run the script every minute of everyday to see if output is generated.
The cron test script that we use is called crontest.sh. It contains the following lines:
#!/bin/bash today=$(date) touch /home/scripts/"$today"
The crontab examples that we use in the video are:
* * * * * /home/darren/scripts/crontest.sh #runs every minute */5 * * * * /home/darren/scripts/crontest.sh #runs every minute 0 * * * * /home/darren/scripts/crontest.sh #runs every hour 0 0 * * * /home/darrenscripts/crontest.sh #runs every day
And the Cron website that was shown in the tutorial can be found here:
If you encouter any difficulty while following along to this tutorial please do comment below 🙂