[init.d/ident2] Un fait un truc propre.
This commit is contained in:
parent
c48759ed91
commit
b229d8a77e
1 changed files with 30 additions and 23 deletions
|
@ -15,50 +15,57 @@
|
|||
PATH=/sbin:/usr/sbin:/bin:/usr/bin
|
||||
DESC="RFC 1413 ident2 daemon"
|
||||
NAME=ident2
|
||||
DAEMON=/usr/sbin/$NAME
|
||||
DAEMON_ARGS=""
|
||||
PIDFILE=/var/run/identd/$NAME.pid
|
||||
BIN=/usr/sbin/$NAME
|
||||
BIN_ARGS=""
|
||||
PIDFILE=/var/run/$NAME.pid
|
||||
SCRIPTNAME=/etc/init.d/$NAME
|
||||
|
||||
# Exit if the package is not installed
|
||||
[ -x "$DAEMON" ] || exit 0
|
||||
[ -x "$BIN" ] || exit 0
|
||||
|
||||
# Define LSB log_* functions.
|
||||
# Depend on lsb-base (>= 3.0-6) to ensure that this file is present.
|
||||
. /lib/lsb/init-functions
|
||||
|
||||
RETVAL=0
|
||||
|
||||
start(){
|
||||
log_begin_msg "Starting ident2 daemon."
|
||||
/usr/sbin/ident2
|
||||
RETVAL=$?
|
||||
echo
|
||||
[ $RETVAL -eq 0 ] && touch /var/run/identd/ident2.pid
|
||||
log_daemon_msg "Starting ident daemon " "$NAME"
|
||||
# Use start-stop-daemon, without make-pidfile, ident
|
||||
# is creating its own itself.
|
||||
if start-stop-daemon --start \
|
||||
--oknodo \
|
||||
--pidfile $PIDFILE \
|
||||
--quiet \
|
||||
--startas $BIN \
|
||||
-- $BIN_ARGS; then
|
||||
log_end_msg 0
|
||||
else
|
||||
log_end_msg 1
|
||||
fi
|
||||
}
|
||||
|
||||
stop(){
|
||||
log_begin_msg "Stopping ident2 daemon."
|
||||
killproc ident2
|
||||
RETVAL=$?
|
||||
echo
|
||||
[ $RETVAL -eq 0 ] && rm -f /var/run/identd/ident2.pid
|
||||
log_daemon_msg "Stopping ident daemon " "$NAME"
|
||||
if start-stop-daemon --stop \
|
||||
--oknodo \
|
||||
--pidfile $PIDFILE; then
|
||||
log_end_msg 0
|
||||
else
|
||||
log_end_msg 1
|
||||
fi
|
||||
}
|
||||
# See how we were called.
|
||||
case "$1" in
|
||||
start)
|
||||
start;
|
||||
start
|
||||
;;
|
||||
stop)
|
||||
stop;
|
||||
stop
|
||||
;;
|
||||
restart)
|
||||
stop;
|
||||
start;
|
||||
stop
|
||||
start
|
||||
;;
|
||||
*)
|
||||
log_success_msg "Usage: ident2 {start|stop}"
|
||||
log_success_msg "Usage: $NAME {start|stop|restart}"
|
||||
exit 1
|
||||
esac
|
||||
|
||||
exit $RETVAL
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue