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

Linux OS Dev

Avatar of undefined
Last Comment
Steven Vona

8/22/2022 - Mon
Gerwin Jansen

0,30 * * * * root /home/root/scripts/my_backup.sh
Steven Vona

use the command:

crontab -e

then enter:

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

Gerwin Jansen

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

@savone, what is the root for?
Your help has saved me hundreds of hours of internet surfing.
fblack61
ASKER CERTIFIED SOLUTION
Steven Vona

Log in or sign up to see answer
Become an EE member today7-DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform
Sign up - Free for 7 days
or
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.
Not exactly the question you had in mind?
Sign up for an EE membership and get your own personalized solution. With an EE membership, you can ask unlimited troubleshooting, research, or opinion questions.
ask a question
nobleit

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

Gerwin Jansen

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)
Steven Vona

Run the cron job every hour and half (or every 90 minutes):

*/90 * * * * /home/root/scripts/my_backup.sh
Get an unlimited membership to EE for less than $4 a week.
Unlimited question asking, solutions, articles and more.