|
From: Friedrich L. <fl...@fl...> - 2003-10-10 21:39:55
|
Bruce Smith wrote: > If I was going to run a real service/daemon, then sure, I'd create a > script. But sometimes start scripts don't apply, IMO. > > Suppose I just want to run a simple command, like delete a file. > There is no service to "start" or "stop", as the skeleton script reads. Then create an init script called "cleanup" or whatever you want to call it. According to http://www.linuxbase.org/spec/refspecs/LSB_1.3.0/gLSB/gLSB/iniscrptact.html your script then can eg. return the exitcode 3 - unimplemented feature if someone calls it with the option "stop". And in the head of the script between "### BEGIN INIT INFO" and "### END INIT INFO" just leave "Default-Stop:" empty. http://www.linuxbase.org/spec/refspecs/LSB_1.3.0/gLSB/gLSB/initscrcomconv.html Nice and clean. And you even can have dependences and running insserv will take care that everything is in the right order. Now if you want to do some cleanup at shutdown to then just implement the stop, add the runlevel you want it to do the cleanup in "Default-Stop:" and you are done. > It's really handy just to have a script for miscellaneous commands. But where do you call this rc.local script then? Always at the end? If someone wants to do something not always at the end, what do we gona tell him? I'd rather tell everybody the same - no exceptions. I know this might be some more work to do when you want to accomplish some little task but I think it pays of later. -- MfG / Regards Friedrich Lobenstock ____________________________________________________________________ Friedrich Lobenstock Linux Services Lobenstock URL: http://www.lsl.at/ Email: fl...@fl... ____________________________________________________________________ |