📄 openser.init
字号:
#! /bin/sh## skeleton example file to build /etc/init.d/ scripts.# This file should be used to construct scripts for /etc/init.d.## Written by Miquel van Smoorenburg <miquels@cistron.nl>.# Modified for Debian GNU/Linux# by Ian Murdock <imurdock@gnu.ai.mit.edu>.## Version: @(#)skeleton 1.8 03-Mar-1998 miquels@cistron.nl## adapted for openser by Daniel-Constantin Mierla <daniel@voice-system.ro># $Id: openser.init,v 1.7 2006/07/10 13:32:38 miconda Exp $PATH=/sbin:/bin:/usr/sbin:/usr/binDAEMON=/usr/sbin/openserNAME=openserDESC=openserHOMEDIR=/var/run/openserPIDFILE=$HOMEDIR/$NAME.pidDEFAULTS=/etc/default/openserRUN_OPENSER=nocheck_openser_config (){ # Check if openser configuration is valid before starting the server set +e out=$($DAEMON -c > /dev/null 2>&1) retcode=$? set -e if [ "$retcode" != '0' ]; then echo "Not starting $DESC: invalid configuration file!" exit 1 fi}create_radius_seqfile (){ # Create a radius sequence file to be used by the radius client if # radius accounting is enabled. This is needed to avoid any issue # with the file not being writable if openser first starts as user # root because DUMP_CORE is enabled and creates this file as user # root and then later it switches back to user openser and cannot # write to the file. If the file exists before openser starts, it # won't change it's ownership and will be writable for both root # and openser, no matter what options are chosen at install time RADIUS_SEQ_FILE=/var/run/openser/openser_radius.seq if [ -d /var/run/openser ]; then chown ${USER}:${GROUP} /var/run/openser if [ ! -f $RADIUS_SEQ_FILE ]; then touch $RADIUS_SEQ_FILE fi chown ${USER}:${GROUP} $RADIUS_SEQ_FILE chmod 660 $RADIUS_SEQ_FILE fi}test -f $DAEMON || exit 0# Load startup options if availableif [ -f $DEFAULTS ]; then . $DEFAULTS || truefiif [ "$RUN_OPENSER" != "yes" ]; then echo "OpenSER not yet configured. Edit /etc/default/openser first." exit 0fiset -eMEMORY=$((`echo $MEMORY | sed -e 's/[^0-9]//g'`))[ -z "$USER" ] && USER=openser[ -z "$GROUP" ] && GROUP=openser[ $MEMORY -le 0 ] && MEMORY=32if test "$DUMP_CORE" = "yes" ; then # Ignore USER and GROUP in this case and use root, # else it won't write the core file. OPTIONS="-P $PIDFILE -m $MEMORY -u root -g root -w $HOMEDIR" ulimit -c unlimitedelse OPTIONS="-P $PIDFILE -m $MEMORY -u $USER -g $GROUP"ficase "$1" in start) check_openser_config create_radius_seqfile echo -n "Starting $DESC: $NAME" start-stop-daemon --start --quiet --pidfile $PIDFILE \ --exec $DAEMON -- $OPTIONS || echo -n " already running" echo "." ;; stop) echo -n "Stopping $DESC: $NAME" start-stop-daemon --oknodo --stop --quiet --pidfile $PIDFILE \ --exec $DAEMON echo "." ;; restart|force-reload) check_openser_config create_radius_seqfile echo -n "Restarting $DESC: $NAME" start-stop-daemon --oknodo --stop --quiet --pidfile \ $PIDFILE --exec $DAEMON sleep 1 start-stop-daemon --start --quiet --pidfile \ $PIDFILE --exec $DAEMON -- $OPTIONS echo "." ;; *) N=/etc/init.d/$NAME echo "Usage: $N {start|stop|restart|force-reload}" >&2 exit 1 ;;esacexit 0
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -