I (or one of my colleagues) need to write one or more shell scripts to control the execution of a daemon. We need to be able to start the daemon, tell it to gracefully shut down, and force a shutdown. Basically, it's the sort of thing one would traditionally use a script in
We will be deploying to Ubuntu. We may want to deploy to RedHat/CentOS, and possibly AIX. I'd like to have the ability to deploy to any unix, because i like doing things portably.
So, is it possible to write portable service scripts?
I suppose i can write a portable Bourne shell script which works like a normal init.d script, and accepts 'start' and 'stop' as commands. That would work anywhere, and would offer a natural interface on at least Debian and RedHat style systems. Would it fit in elsewhere? Is init.d universal? Are there any pitfalls to watch out for?
Are there any tools for generating service scripts in different forms? Something where i can write script fragments for starting and stopping, and have the tool produce scripts for various different platforms.
Are there any alternatives to platform-specific service script conventions? I've come across daemontools and runit; are these alternatives to init.d scripts? Are they any good? What else is there like this?
Does this make any sense?