Aaron Perry
Aaron Perry

Reputation: 1051

Execute a Cronjob Every Minute Between Two Times

I need to run a bash script in crontab every minute between 8:45am and 9:50am of every day.

Code:

45,46,47,48,49,50,51,52,53,54,55,56,57,58,59 8 * * * /home/pull.sh > /home/logs/pull.log 2>&1
00/50 9 * * * /home/pull.sh > home/logs/pull.log 2>&1

Is this correct and/or the most efficient way to do this?

Upvotes: 0

Views: 1514

Answers (2)

Aaron Perry
Aaron Perry

Reputation: 1051

Try this:

45-59/1 8 * * * /home/pull.sh > /home/pull.log 2>&1
00-50/1 9 * * * /home/pull.sh > /home/pull.log 2>&1

Upvotes: 1

Steve Winston
Steve Winston

Reputation: 1

http://www.nncron.ru/help/EN/working/cron-format.htm

According to that website, you can do something like this:

45-59 8 * * * /home/pull.sh > /home/logs/pull.log 2>&1

I'm not certain what you're looking to do with this line:

00/50 9 * * * /home/pull.sh > home/logs/pull.log 2>&1

I actually don't know what that will do.

Upvotes: 0

Related Questions