Setup a cron job and specified the start and end time
Hi guys,
How can I specify the start and end time of a cron job. And my start time and end time are specified by minutes. For example, I want to set up a cron runs every 3 minutes from 18:40 to midnight. How can i do this please? Many thanks
If I were doing this, I'd kick off a script at 18:40, just once, and let it run your programme/script every three minutes until midnight.
Your crontab entry would be simple:
If the command you are running takes several minutes to run, and you want it to start right at the next three minute mark, run it asynchronously (use &) so that the waking from the sleep is 3 minutes from when the programme started and not three minutes from when the programme ended.
Last edited by agama; 10-19-2011 at 08:55 PM..
Reason: clarification
Many thanks for this. We can't change the script that we are going to schedule in the cron. Does it mean this can't be done in one line of cron? Thanks.
You wouldn't need to change the script, add a new one that invokes the one you were going to start from cron. If you cannot add a new script, then you'll end up with two entries in the crontab.
Note that some versions of cron do not support */3 notation.
Last edited by agama; 10-19-2011 at 10:16 PM..
Reason: simplification and typo correction
I've created a script to copy backup files from an HP-UX 11iv3 system to an NFS share on another machine. I want to schedule the script to run via cron. The script is simply three lines of cp /backups/Backup /shared/Backup. I've saved the script as a .sh file and call it with KSH. Do I need to... (3 Replies)
Hi,
1)
If some job supposed to run on 1st of every month at 7 AM
In cron job when we have a blackout on the 1st ( i.e when 1st falls on a sunday ) how can we make the job run the next business day?
2) How can we run a job on 25th of every quarter 7 AM(jan,apr,jul,oct)
And if 25th... (5 Replies)
HI I am new to unix .
I wanted to create a cron job that runs a script every 10 min .So when I enter
vi /etc/crontab
I get the following output
SHELL=/bin/bash
PATH=/sbin:/bin:/usr/sbin:/usr/bin
MAILTO=root
HOME=/
# run-parts
01 * * * * root run-parts /etc/cron.hourly
02 4 * *... (1 Reply)
Hello All,
I have a problem calculating the time difference between start and end timings...!
the timings are given by 24hr format..
Start Date : 08/05/10 12:55
End Date : 08/09/10 06:50
above values are in mm/dd/yy hh:mm format.
Now the thing is, 7th(08/07/10) and... (16 Replies)
Is there anyway to get the start time and end time / status of a crontab job which was just completed? Of course, we know the start time of the crontab job since we are scheduling. But I would like to know process start and time recorded somewhere or can be fetched from a command like 'ps'. ... (3 Replies)
Hello,
I would like setup a CRON job to rename my server's name (host name) every day. For some reason it changes its own name every couple days to server-2.local fron server.local.
Thank you!
-Chris (3 Replies)
Hi,
can you please help me with one problem?
There is some server, there are a lot of AIX applications which run on this server under different UserIDs.
These applications starts via crontab.
From time to time some application doesn't start.
What can this "not-action" be dependent on?
At... (5 Replies)
I want to know if there is a way to make a certain set of programs start in order at system startup with cron or something else i dont know about. (3 Replies)