Sophie

Sophie

distrib > Mandriva > 2010.0 > i586 > media > contrib-release > by-pkgid > 38c09d610f9cd763e37d50a6a0b7e288 > files > 16

nufw-nuauth-2.2.21-4mdv2010.0.i586.rpm

#!/bin/sh
#
# Startup script for nuauth
#
# chkconfig: 345 86 16
# description: Nuauth is a authentifcation server for nufw. 
# processname: nuauth


# Source function library.
. /etc/rc.d/init.d/functions

DAEMON_NAME=nuauth

# this file should be commented, with proper pointer to the doc, and you should use
# more than one line of option, if possible.
[ -f /etc/sysconfig/$DAEMON_NAME ] && . /etc/sysconfig/$DAEMON_NAME

# here you can do what you want with the option
if [ ! "$VERBOSITY" ]; then
  VERBOSITY="vv"
fi

DAEMON_OPTS="-D -$VERBOSITY  "

if [ ! "$RUN_AS_ROOT" ]; then
        # need to be run as root as it check getent shadow output
        if ! egrep -q '^\s*nuauth_user_check_module\s*=\s*.*system.*' /etc/nufw/nuauth.conf ; then
                    RUN_AS_ROOT="y"
        fi
fi
USER_OPTION="--user nuauth"

if [ "$RUN_AS_ROOT" = "y" ]; then
        USER_OPTION=""
fi


case "$1" in
  start)
        gprintf "Starting $DAEMON_NAME: "
        DIR="/var/run/$DAEMON_NAME"
        [ -d $DIR ] || mkdir -p $DIR
        chown $DAEMON_NAME $DIR
                        
        daemon $USER_OPTION /usr/sbin/$DAEMON_NAME $DAEMON_OPTS
        echo
        touch /var/lock/subsys/$DAEMON_NAME
        ;;
  stop)
        gprintf "Shutting down $DAEMON_NAME: "
        killproc $DAEMON_NAME
        echo
        rm -f /var/lock/subsys/$DAEMON_NAME
        ;;
  status)
        status $DAEMON_NAME
        ;;
  reload|restart)
        $0 stop
        $0 start
        ;;
  *)
        gprintf "Usage: %s {start|stop|restart|reload|status}\n" "$0"
        exit 1
esac

exit 0