Link to home
Start Free TrialLog in
Avatar of nobleit
nobleit

asked on

cronjob

I have a script my_backup.sh
I want to generate in every 12 hrs
how we will create a crontab file first

* * * * * root /home/root/scripts/my_backup.sh

Avatar of Gerwin Jansen
Gerwin Jansen
Flag of Netherlands image

0,30 * * * * root /home/root/scripts/my_backup.sh
use the command:

crontab -e

then enter:

0 0,12 * * * root /home/root/scripts/my_backup.sh

Hmm, I misread and posted a crontab entry that will run twice each hour...

@savone, what is the root for?
ASKER CERTIFIED SOLUTION
Avatar of Steven Vona
Steven Vona
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of nobleit
nobleit

ASKER

what will be the difference if I want to run in every half an hour..

Here's a reference of a crontab entry:

*    *    *   *   *        command to be executed
-    -    -   -   -
|     |     |   |    |
|     |     |   |    +----- day of week (0 - 6) (Sunday=0)
|     |     |   +------- month (1 - 12)
|     |     +--------- day of month (1 - 31)
|     +----------- hour (0 - 23)
+------------- min (0 - 59)
Run the cron job every hour and half (or every 90 minutes):

*/90 * * * * /home/root/scripts/my_backup.sh