I like to respawn a service when the service goes down. I have added it to inittab however I cannot kill it when i need to.
Is there away i can respawn a service however be able to kill it manually when i need to.
thanks in advance
Ubuntu has switched to Upstart for its
init daemon, so the best way would be to make an Upstart job file in
/etc/init/. Here's an example:
description "My important service" start on filesystem or runlevel  stop on runlevel [!2345] respawn exec /usr/bin/mydaemon --some-args
If this file is saved as
/etc/init/myjob.conf, it will create a job that starts at boot, respawns when it dies, and can be manually stopped (as root) with
service myjob stop, or
initctl stop myjob.
Old-school use of
The basic format is
Modern use of
.conf files in
inittab method from above will still work.