LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - General (https://www.linuxquestions.org/questions/linux-general-1/)
-   -   crontab question (https://www.linuxquestions.org/questions/linux-general-1/crontab-question-233502/)

linuxtesting2 09-21-2004 04:14 PM

crontab question
 
this is just an example...

if i want to be able to make a backup from 12:00 to 14:00, but not not from 12:30 to 13:00 how can i do this, can i use

* 12-12.30,13-14 * * *

dont mind the *... its just an example...the question is if i can spesify 1/2 hours, or do i need to put in the first tab, where its minute ?


-ole

btmiller 09-21-2004 04:16 PM

How frequently do you want the backup made? To run a backup every half hour between 12:00 and 14:00:

0,30 12-14 * * * <backup-script>

should do the trick.

michaelk 09-21-2004 04:41 PM

Not really, cron does not specify a time frame to run a command. It will only execute the command at the specified time. For example
* 13-14 * * * <command>

13-14 would mean run the command 2 times every day. Once at 1300 and once at 1400.

* 12,13-14 * * *

Would mean execute the command 3 times, 1200, 1300 and 1400. Can't have fractional numbers. And,

* 9-15/2 * * *

Would mean execute command every 2 hours from 0900 - 1500.

Stopping or pausing a backup process once started would depend on the application and might not be possible. Do you know how long the backup process will take? What application are you using to create the backup?

linuxtesting2 09-21-2004 04:46 PM

its an example, not an actual backup, just a test. So here is the question...

I want to kill a prosess every second minute in the time between 08:00-16:00. But between 12:00-12:30 i dont want to kill the prosess, and this job is supposed to go every day except saturday and sunday, and time from 16:00-08:00...hehe...:)


thanks for helping, just a scenario...

ole

Tinkster 09-21-2004 04:46 PM

Re: crontab question
 
Quote:

Originally posted by linuxtesting2
this is just an example...

if i want to be able to make a backup from 12:00 to 14:00, but not not from 12:30 to 13:00 how can i do this, can i use

* 12-12.30,13-14 * * *

dont mind the *... its just an example...the question is if i can spesify 1/2 hours, or do i need to put in the first tab, where its minute ?


-ole

I'm afraid that there's some misapprehension
as to what cron does ... it just starts a process.
It won't suspend it for half an hour unless you
create a second script that does exactly that at
a given time, and keeps track of the time half
an hour gap) itself.

If the way your backup is set-up is in two chunks
the first of which complete's in half an hour that
would work, too...


Cheers,
Tink

Tinkster 09-21-2004 04:54 PM

Quote:

Originally posted by linuxtesting2
I want to kill a prosess every second minute in the time between 08:00-16:00. But between 12:00-12:30 i dont want to kill the prosess, and this job is supposed to go every day except saturday and sunday, and time from 16:00-08:00...hehe...:)
*/2 8-12 * * mon-fri <job>
30/2 12-13 * * mon-fri <job>
*/2 13-18 * * mon-fri <job>

Something like that should do, I'm not sure whether
it works, or whether it can be simplified.


Cheers,
Tink


All times are GMT -5. The time now is 08:22 AM.