In this blog post, I will explain and show you how to create your first Cron job on a Linux system.
Linux Cron is a task scheduler that allows how to run a routine task that can be automated.
By default, any Linux server can Cron jobs on the following schedule:
We Cron jobs by copying Bash Shell scripts into the Cron system folders which goes by the names above.
The Cron schedule folders are located under /etc as shown below:
Let get going and create Docker script the deploy a container every hour.
I will create a script in the /etc/cron.hourly folder which will run the script every hour.
I will copy the following line to the script:
#!/bin/bash docker run -d httpd
We also need to confgire he script to run using the following command.
chmod +x docker.sh
The Cron job will run the script at the begining of every round hour.