wok annotate freeradius/stuff/freeradius @ 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 | |
children |
rev | line source |
---|---|
pascal@19366 | 1 #!/bin/sh |
pascal@19366 | 2 # /etc/init.d/freeradius : Start, stop and restart freeradius server on SliTaz, at |
pascal@19366 | 3 # boot time or with the command line. |
pascal@19366 | 4 # |
pascal@19366 | 5 # To start freeradius server at boot time, just put freeradius in the $RUN_DAEMONS |
pascal@19366 | 6 # variable of /etc/rcS.conf and configure options with /etc/daemons.conf |
pascal@19366 | 7 # |
pascal@19366 | 8 . /etc/init.d/rc.functions |
pascal@19366 | 9 . /etc/daemons.conf |
pascal@19366 | 10 |
pascal@19366 | 11 NAME=freeradius |
pascal@19366 | 12 DESC="freeradius server" |
pascal@19366 | 13 DAEMON=/usr/sbin/radiusd |
pascal@19366 | 14 OPTIONS=$FREERADIUS_OPTIONS |
pascal@19366 | 15 PIDFILE=/var/run/radiusd/radiusd.pid |
pascal@19366 | 16 [ -n "$OPTIONS" ] || OPTIONS="-d /etc/raddb -i 0.0.0.0 -p 1812" |
pascal@19366 | 17 |
pascal@19366 | 18 case "$1" in |
pascal@19366 | 19 start) |
pascal@19366 | 20 if active_pidfile $PIDFILE radiusd ; then |
pascal@19366 | 21 echo "$NAME already running." |
pascal@19366 | 22 exit 1 |
pascal@19366 | 23 fi |
pascal@19366 | 24 echo -n "Starting $DESC: $NAME... " |
pascal@19366 | 25 $DAEMON $OPTIONS |
pascal@19366 | 26 status |
pascal@19366 | 27 ;; |
pascal@19366 | 28 stop) |
pascal@19366 | 29 if ! active_pidfile $PIDFILE radiusd ; then |
pascal@19366 | 30 echo "$NAME is not running." |
pascal@19366 | 31 exit 1 |
pascal@19366 | 32 fi |
pascal@19366 | 33 echo -n "Stopping $DESC: $NAME... " |
pascal@19366 | 34 kill $(cat $PIDFILE) |
pascal@19366 | 35 status |
pascal@19366 | 36 ;; |
pascal@19366 | 37 restart) |
pascal@19366 | 38 if ! active_pidfile $PIDFILE radiusd ; then |
pascal@19366 | 39 echo "$NAME is not running." |
pascal@19366 | 40 exit 1 |
pascal@19366 | 41 fi |
pascal@19366 | 42 echo -n "Restarting $DESC: $NAME... " |
pascal@19366 | 43 kill $(cat $PIDFILE) |
pascal@19366 | 44 sleep 2 |
pascal@19366 | 45 $DAEMON $OPTIONS |
pascal@19366 | 46 status |
pascal@19366 | 47 ;; |
pascal@19366 | 48 *) |
pascal@19366 | 49 echo "" |
pascal@19366 | 50 echo -e "\033[1mUsage:\033[0m /etc/init.d/$(basename $0) [start|stop|restart]" |
pascal@19366 | 51 echo "" |
pascal@19366 | 52 exit 1 |
pascal@19366 | 53 ;; |
pascal@19366 | 54 esac |
pascal@19366 | 55 |
pascal@19366 | 56 exit 0 |