From: Ezra Zygmuntowicz Date: 2006-03-14T02:14:54+09:00 Subject: Re: Init Script Installer On Mar 13, 2006, at 7:51 AM, zdennis wrote: > Checking for feedback this morning on this thread I see that my > post doesn't make a whole lot sense. Perhaps a rephrase will help > it out, as mentionend previously I wrote an init script installer. > Currently you run it like: > ruby install_init_script.rb myscriptname /path/to/where/script/ > should/be/run > > This will create an /etc/init.d script which which utilizes the > start-stop-daemon (i am on a debian system). It will handle forking > your program for you and it will run it in the background as a > system daemon. > > Right now that is all it does. I would like to have it wrap the > script itself in code that generates the pid file for the user and > handles removing it etc.. I am thinking of doing something like: > > init_script_install( scriptname, path2scriptdir ) do |script, > rootdir| > ensure_script_exists rootdir + '/' + script > > create_and_install :initscript, :script=>script, :rootdir=>rootdir, :t > o => '/etc/init.d/' > create_and_install :scriptwrapper, :script=>script > end > > Where the first 'create_and_install :initscript' creates the init > script, and the second part creates a wrapper for it which handles > the creation and removal of the pid file. For the wrapper I think I > need to either rename the original script, and put my wrapper in > it's place, then have my wrapper require the renamed script, or I > need to modify the contents of the script itself. > > Anyone have any ideas or thoughts on this? I'm not looking for > code, just input and opinions. I would like to get a decent base so > I can expand this to handle other types of system init scripts ( I > believe RH doesn't use start-stop-daemon like debian does, etc.. ) > before I release on rubyforge. Thanks, > > Zach Zach- I could use a script like this. i think its a good idea. Will you be sharing the code? I can help test it for you if you want. Cheers- -Ezra