Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

how to prevent crontab concurrent update ? 1

Status
Not open for further replies.
Jun 13, 2002
7
DE
Hi All,

last night a cronjob I had scheduled the day before didn't run.
Because I log all changes made in the crontabs (every minute I save the crontab if it differs from the last one),
I found out that a collegue also updated the crontab about the same time, but took longer to finish updating
and overwrote my changes ..... [thumbsdown]

Is there a way to prevent this ?

Cheers René

 
Each user can have their own crontab. Save the root crontab for root functions.
 
my colleagues use SCCS for versioning files, but afaik there is no way to use this for system files such as crontab...

Best Regards, Franz
--
Solaris System Manager from Munich, Germany
I used to work for Sun Microsystems Support (EMEA) for 5 years
 
just another mad idea: :)

you can write a wrapper script around /usr/bin/crontab
(move /usr/bin/crontab to /usr/bin/crontab.bin, write a new /usr/bin/crontab which checks for a lockfile, if is is not there, create one and continue with /usr/bin/crontab.bin and all Parameters ($*), if a lockfile exists you can print out a messages "lockfile $lockfile exists, exiting")



Best Regards, Franz
--
Solaris System Manager from Munich, Germany
I used to work for Sun Microsystems Support (EMEA) for 5 years
 
Thxs,

as Franz suggested, I have built a "shell" around my crontab.
another solution would have been to install vim.

Cheers René
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top