wok annotate ypserv/stuff/ypserv @ rev 25076
Up marlin (886)
author | Pascal Bellard <pascal.bellard@slitaz.org> |
---|---|
date | Tue Jun 14 08:17:07 2022 +0000 (2022-06-14) |
parents | c994a5c94f9d |
children |
rev | line source |
---|---|
erjo@11349 | 1 #!/bin/sh |
al@19159 | 2 # /etc/init.d/ypserv: Start, stop and restart YP (NIS) Server on SliTaz, at |
erjo@11349 | 3 # boot time or with the command line. |
erjo@11349 | 4 # |
erjo@11349 | 5 # To start YP (NIS) Server at boot time, just put ypserver in the $RUN_DAEMONS |
erjo@11349 | 6 # variable of /etc/rcS.conf and configure options with /etc/daemons.conf |
erjo@11349 | 7 # |
erjo@11349 | 8 . /etc/init.d/rc.functions |
erjo@11349 | 9 . /etc/daemons.conf |
erjo@11349 | 10 |
erjo@11349 | 11 NAME=ypserv |
al@19159 | 12 DESC="$(_ '%s server' 'YP (NIS)')" |
erjo@11349 | 13 DAEMON=/usr/sbin/ypserv |
erjo@11349 | 14 OPTIONS=$YPSERV_OPTIONS |
erjo@11349 | 15 PIDFILE=/var/run/ypserv.pid |
erjo@11349 | 16 |
erjo@11349 | 17 case "$1" in |
erjo@11349 | 18 start) |
erjo@11349 | 19 if active_pidfile $PIDFILE ypserv ; then |
al@19159 | 20 _ '%s is already running.' $NAME |
erjo@11349 | 21 exit 1 |
erjo@11349 | 22 fi |
al@19159 | 23 action 'Starting %s: %s...' "$DESC" $NAME |
erjo@11349 | 24 $DAEMON $OPTIONS |
al@19159 | 25 pidof ypserv > $PIDFILE |
erjo@11349 | 26 status |
erjo@11349 | 27 ;; |
erjo@11349 | 28 stop) |
erjo@11349 | 29 if ! active_pidfile $PIDFILE ypserv ; then |
al@19159 | 30 _ '%s is not running.' $NAME |
erjo@11349 | 31 exit 1 |
erjo@11349 | 32 fi |
al@19159 | 33 action 'Stopping %s: %s...' "$DESC" $NAME |
al@19159 | 34 kill $(cat $PIDFILE) |
erjo@11349 | 35 status |
erjo@11349 | 36 ;; |
erjo@11349 | 37 restart) |
erjo@11349 | 38 if ! active_pidfile $PIDFILE ypserv ; then |
al@19159 | 39 _ '%s is not running.' |
erjo@11349 | 40 exit 1 |
erjo@11349 | 41 fi |
al@19159 | 42 action 'Restarting %s: %s...' "$DESC" $NAME |
al@19159 | 43 kill $(cat $PIDFILE) |
erjo@11349 | 44 sleep 2 |
erjo@11349 | 45 $DAEMON $OPTIONS |
erjo@11349 | 46 status |
erjo@11349 | 47 ;; |
erjo@11349 | 48 *) |
al@19159 | 49 emsg "<n><b>$(_ 'Usage:')</b> $0 [start|stop|restart]" |
al@19159 | 50 newline |
erjo@11349 | 51 exit 1 |
erjo@11349 | 52 ;; |
erjo@11349 | 53 esac |
erjo@11349 | 54 |
erjo@11349 | 55 exit 0 |