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