Pause a script

Michael Welle m.welle at gmx.net
Tue Feb 6 15:14:35 UTC 2007


Hi,

"Mark Haney" <mhaney at ercbroadband.org> writes:

> Mircea Hutanu wrote:
>> On 2/6/07, Mark Haney <mhaney at ercbroadband.org> wrote:
>>> I have been trying for a bit to do something like this in cron:
>>>
>>> <script1><pause for 60 second>;<script2>
>>>
>> Why don't you try to put the scripts into one single main script and
>> put that main script into cron, for example.
>> #!/bin/bash
>> /path/to/script1
>> sleep 60s
>> /path/to/script2
>> Hope this helps you.
>>
>>
> I'm not sure this will help.  Here's the situation:
>
> script1 - checks for the existence of test.pid
> script2 - the job that actually will create the pid
>
> So if I do what you've suggested above, script1 will run and fail (I'll 
> get an email saying the PID didn't exist) then 60 seconds later script2 
> will run and create the pid.  Is that not how the sleep command works?
perhaps I do not understand your problem, but this may be a solution:

script1:

[ -r /tmp/k/pid ] &&  exit 1
exit 0


script2:

touch /tmp/k/pid


Call it:

script1 && sleep 60 && script2

Michael

-- 
biff4emacsen - A biff-like tool for (X)Emacs
http://www.c0t0d0s0.de/biff4emacsen/biff4emacsen.html




More information about the fedora-list mailing list