This is the mail archive of the cygwin mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

How to prevent duplicate cron jobs?


I apologize if this is sent twice. I sent it once a couple of hours ago and
did not see it appear so I am sending it again.

I have a cron job running perl and it is taking a very long time -- 
sometimes over 24 hours.

How can I have cron schedule my job daily, or even hourly, and have 
the perl code  exit if a previouse instance of the job is still 
running?

Some have suggested creating a file in /tmp and checking it before 
proceding. But what if a cron job exits prematurely, perhaps because 
of a division by zero, and does not delete the /tmp file?

Others have suggested checking /proc (which seems to exist in cygwin :)) for
my pid and send a semaphore or a SIGUSR1 to determine if it's not hung.
 
Will this work in cygwin? 

Thanks,

Siegfried


--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]