automatic cronjob injection

Reini Urban rurban@x-ray.at
Fri Sep 17 22:00:00 GMT 2004


Dave Korn schrieb:
>>-----Original Message-----
>>From: cygwin-owner On Behalf Of Reini Urban
>>Sent: 17 September 2004 18:22
>>I know that it might be possible and I know that is not advisable,
> 
>   So why are you asking?  You know the ropes: what does it say at the top of
> EVERY single file in /var/cron/tabs?
> 
> # DO NOT EDIT THIS FILE - edit the master and reinstall.
> 
>   If it's inadvisable, then it seems wildly reckless to attempt a flaky and
> improper technique in a postinstall script, because such scripts are going
> to be run by every conceivable kind of user in every conceivable combination
> of environments and if something can go wrong, it will.  A postinstall
> script should be utterly solid (well, as close to as possible) because it's
> such a critical part of the cygwin distribution mechanism.  A broken
> postinstall script that causes setup.exe to bomb out (rare, but I've seen it
> happen) can get users stuck in an endless cycle of download megs of files -
> get half-way through installing - setup crashes - restart setup and it
> doesn't remember what it's done and needs to re-download everything again.

Of course not in a postinstall script, because the user should be able 
to see it and correct it.

But in the following installation steps.
I thought of:

/etc/rc.d/init.d/$package install
/etc/rc.d/init.d/$package installcron
/etc/rc.d/init.d/$package uninstall

("install" / "uninstall" just un-/installs the service, not the package)

> So don't do it.  If you want to do this programatically, use "crontab -l"
> to dump it to a file, use a sed script to edit it - I don't think blindly
> appending a line without making sure you delete the old one would be good -
> then "crontab edited-file" to update it.

Good idea. I'll do a grep before blindly adding a new line.
I just add a commented line to crontab, and called:
crontab -e so the user will get an idea what to do.

> That doesn't seem to me any more hard than the three operations you have
> in your way of doing it, and it's guaranteed to work.  What motivation for
> doing it any other way could there be?

The motivation is: users prefer installers, which just do what they 
want, instead of reading docs about required installations steps.

And I wanted a place where all the logic which didn't fit into the 
postinstall script could be executed.
Give permissions to SYSTEM, run cygrunsrv --install with the correct 
settings, blabla.
it's about ten lines.
-- 
Reini Urban
http://xarch.tu-graz.ac.at/home/rurban/

--
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/



More information about the Cygwin mailing list