wok view ypserv/stuff/ypserv @ rev 19366

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