#! /bin/sh # # SuSE SysV init script skeleton # # Based on code (C) SuSE Gmbh Nuernberg, Germany. # # By Jason Spence # # Note that newer versions of SuSE use a slightly different config file # layout. See the SuSE docs for details. # # The stuff below is documented here: # http://www.suse.de/~mmj/Package-Conventions/SuSE-Package-Conventions-4.html # ### BEGIN INIT INFO # Provides: mydaemon # Required-Start: $remote_fs # Required-Stop: # Default-Start: 3 5 # Default-Stop: # Description: Mydaemon frobnicates the guzzly foo. ### END INIT INFO . /etc/rc.config test -s /etc/rc.config.d/mydaemon.rc.config && \ . /etc/rc.config.d/mydaemon.rc.config # Determine the base and follow a runlevel link name. base=${0##*/} link=${base#*[SK][0-9][0-9]} # Force execution if not called by a runlevel directory. test $link = $base && SMTP=yes test "$SMTP" = yes || exit 0 if test -z "MYDAEMON_ARGS" ; then MYDAEMON_ARGS="-a -b -xyz" fi # The echo return value for success (defined in /etc/rc.config). return=$rc_done case "$1" in start) echo -n "Initializing mydaemon. (mydaemon)" startproc /usr/sbin/mydaemon $MYDAEMON_ARGS || return=$rc_failed echo -e "$return" ;; stop) echo -n "Shutting down mydaemon:" killproc -TERM /usr/sbin/mydaemon || return=$rc_failed echo -e "$return" ;; restart) $0 stop && $0 start || return=$rc_failed ;; reload) echo -n "Reloading mydaemon: " killproc -HUP /usr/sbin/mydaemon || return=$rc_failed echo -e "$return" ;; status) echo -n "Checking status of mydaemon: " checkproc /usr/sbin/mydaemon && echo OK || echo No process ;; *) echo "Usage: $0 {start|stop|status|restart|reload}" exit 1 esac # Inform the caller not only verbosely and set an exit status. test "$return" = "$rc_done" || exit 1 exit 0