How to run a bash script via cron


Sometimes we need to run a shell script at some regular intervals, like once everyday. We can do this using cron. In this tutorial we will see how to run a shell script using cron.

Shell Script file

Let’s assume our shell script file is located at:


Cron command

Create your cron command so that we can run the shell script at a regular interval. We recommend for generating cron command.

Let’s assume we want to run the shell script every hour. So, we will use below cron command.

0 * * * *

Open crontab

Login to your Linux system via SSH and use below command to open crontab.

crontab -e

Add cron

Add below code in crontab to run our shell script every hour.

0 * * * * /root/


Our Top Rated Host

Related Posts