linux how to create a service

First of all read http://upstart.ubuntu.com/getting-started.html upstart is beautiful 🙂 If your linux supports it.
But in some systems you should use old init style scripts 🙁

cp /etc/init.d/sceleton /etc/init.d/rec-runner
and edit it.

/etc/init.d/rec-runner

do_stop()
{
    start-stop-daemon --stop --quiet --retry=TERM/30/KILL/5/9 --pidfile $PIDFILE

/home/scripts/rec-runner

#!/bin/sh

sudo -u mahout java -jar -server some variables \
some other variables \
> /var/log/recommender.log 2>&1 & echo $! > /var/run/rec-runner.pid
#EOF

update-rc.d rec-runner defaults

Leave a Comment


NOTE - You can use these HTML tags and attributes:
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>