Welcome to WebmasterWorld Guest from 54.205.119.93

Forum Moderators: bakedjake

Message Too Old, No Replies

How to set up specific time for cron job?

   
5:06 pm on Jul 23, 2007 (gmt 0)

5+ Year Member



I'm running on a Plesk 8 server, and I have two basic questions regarding the Crontab:

1. How do I specify a specific time for a cron job to run? For example, to run at 10:30 AM every day?

2. If I have a cron job that is set to run every day, but without any time specified, what time will the job actually run?

Thanks,
Ron

6:35 pm on Jul 23, 2007 (gmt 0)

WebmasterWorld Administrator phranque is a WebmasterWorld Top Contributor of All Time 10+ Year Member Top Contributors Of The Month



1 - daily@10:30am:
30 10 * * * /bin/sh /path/to/daily/command

2 - what do you mean by "without any time specified"?
if you mean the column is set "*" that means "every occurrence" for that column such as "every minute" or "every day".

6:40 pm on Jul 23, 2007 (gmt 0)

5+ Year Member



Sorry if I wasn't clear.

If I set the cron to run daily, I would use the "*". My question is, when does the job actually run? For example, does it run at midnight?

Thanks,
Ron

6:57 pm on Jul 23, 2007 (gmt 0)

WebmasterWorld Administrator phranque is a WebmasterWorld Top Contributor of All Time 10+ Year Member Top Contributors Of The Month



If I set the cron to run daily, I would use the "*". My question is, when does the job actually run? For example, does it run at midnight?

which column are you putting the "*" in?
if it's in the 3rd and/or 5th columns it will run every day of the month and/or every day of the week.
the time(s) it runs depends on what's in the 1st and 2nd columns...

7:21 pm on Jul 23, 2007 (gmt 0)

5+ Year Member



At first, I had the following:
0 0 * * *
to run the job every day of the week/month without a specific time.

I also tried: 0 15 * * *
to run the job every day at 15:00 hours. But for some reason the job did not run.

I wasn't sure if I have to specify an actual time to run a cron job daily. If I want a job to run daily, do I still need to specify a an actual time for the job to run?

Thanks,
Ron

8:33 pm on Jul 23, 2007 (gmt 0)

WebmasterWorld Administrator phranque is a WebmasterWorld Top Contributor of All Time 10+ Year Member Top Contributors Of The Month



At first, I had the following:
0 0 * * *
to run the job every day of the week/month without a specific time.

00:00 is a specific time.
this means run every day at midnight.

I also tried: 0 15 * * *
to run the job every day at 15:00 hours. But for some reason the job did not run.

this should have worked.
did you try a simple command?

I wasn't sure if I have to specify an actual time to run a cron job daily. If I want a job to run daily, do I still need to specify a an actual time for the job to run?

yes.

8:36 pm on Jul 23, 2007 (gmt 0)

5+ Year Member



Thanks, Phranque.
I understand it better now. I do have two other cron jobs running successfully (one is every 5 minutes and one is every hour), so I don't know why this particular script isn't running. I'll have to look into it.

Thanks,
Ron