LJ Archive

Listing 6. Sample SysV init Script

#!/bin/sh

# Listing 6:
# Sample SysV init script
# Ivan Griffin (ivan.griffin@ul.ie)
#
# Source Red Hat function library
. /etc/rc.d/init.d/functions
#
# Source networking configuration.
. /etc/sysconfig/network
#
# Check that networking is up
[ ${NETWORKING} = no ] & exit 0
case $1 in
    start)
          echo -n Starting daemon foobar:
          daemon foobar
          echo
          ;;
    stop)
          echo -n Shutting down daemon foobar:
          killproc foobar
          echo
          ;;
    *)
          echo Usage: foobar {start|stop}
          exit 1
esac
LJ Archive