title: init.d start/stop scripts
body: <p>I have to call a perl program in start/stop script. I have my perl program in path/to/program: /home/nuthan/server.
  Now, my task is to create a start/stop script. i.e., need to call command <strong>daemon -d -v -r perl /home/nuthan/server -l /tmp/k</strong> on start and kill the pid on stop. I found too many scripts on net, i found this at <a href="http://www.cyberciti.biz/tips/linux-write-sys-v-init-script-to-start-stop-service.html" rel="nofollow">http://www.cyberciti.biz/tips/linux-write-sys-v-init-script-to-start-stop-service.html</a>. but I don't understand this, as I am new to Perl. Please help, where do i add the commands, or Am i wrong?</p>
  
  <pre><code>#!/bin/bash
  # description: Foo server
  
  # Get function from functions library
  . /etc/init.d/functions
  # Start the service FOO
  start() {
      initlog -c "echo -n Starting FOO server: "
      /path/to/FOO &amp;
      ### Create the lock file ###
      touch /var/lock/subsys/FOO
      success $"FOO server startup"
      echo
  }
  # Restart the service FOO
  stop() {
      initlog -c "echo -n Stopping FOO server: "
      killproc FOO
      ### Now, delete the lock file ###
      rm -f /var/lock/subsys/FOO
      echo
  }
  ### main logic ###
  case "$1" in
  start)
  start
      ;;
    stop)
      stop
      ;;
   status)
      status FOO
      ;;
  restart|reload|condrestart)
      stop
      start
      ;;
  *)
      echo $"Usage: $0 {start|stop|restart|reload|status}"
      exit 1
  esac
  exit 0
  </code></pre>