packages: accel-ppp/accel-ppp.init (NEW)=?UTF-8?Q?=20?=- added initscript, based on template

paszczus paszczus at pld-linux.org
Tue Apr 17 12:55:54 CEST 2012


Author: paszczus                     Date: Tue Apr 17 10:55:54 2012 GMT
Module: packages                      Tag: HEAD
---- Log message:
- added initscript, based on template

---- Files affected:
packages/accel-ppp:
   accel-ppp.init (NONE -> 1.1)  (NEW)

---- Diffs:

================================================================
Index: packages/accel-ppp/accel-ppp.init
diff -u /dev/null packages/accel-ppp/accel-ppp.init:1.1
--- /dev/null	Tue Apr 17 12:55:54 2012
+++ packages/accel-ppp/accel-ppp.init	Tue Apr 17 12:55:49 2012
@@ -0,0 +1,172 @@
+#!/bin/sh
+#
+# accel-ppp	accel-ppp service
+#
+# chkconfig:	345 90 15
+#
+# description:	accel-ppp (High performance VPN server application)
+#
+# processname:	accel-pppd
+# config:	/etc/accel-ppp.conf
+# pidfile:	
+#
+# $Id: 
+
+# Source function library
+. /etc/rc.d/init.d/functions
+
+# Get network config
+. /etc/sysconfig/network
+
+# Check that networking is up.
+if is_yes "${NETWORKING}"; then
+	if [ ! -f /var/lock/subsys/network -a "$1" != stop -a "$1" != status ]; then
+		msg_network_down "accel-ppp"
+		exit 1
+	fi
+else
+	exit 0
+fi
+
+# Set defaults
+OPTION1=""	# Strings
+OPTION2="-q"	#
+OPTION3=	# Values
+OPTION4=5	#
+
+# Get service config - may override defaults
+[ -f /etc/sysconfig/accel-ppp ] && . /etc/sysconfig/accel-ppp
+
+pidfile="/var/run/accel-ppp.pid"
+
+# configtest itself
+# must return non-zero if check failed
+# output is discarded if checkconfig is ran without details
+configtest() {
+	/usr/sbin/accel-pppd -t
+	return $?
+}
+
+# wrapper for configtest
+checkconfig() {
+	local details=${1:-0}
+
+	if [ $details = 1 ]; then
+		# run config test and display report (status action)
+		show "Checking %s configuration" "accel-ppp"; busy
+		local out
+		out=$(configtest 2>&1)
+		RETVAL=$?
+		if [ $RETVAL = 0 ]; then
+			ok
+		else
+			fail
+		fi
+		[ "$out" ] && echo >&2 "$out"
+	else
+		# run config test and abort with nice message if failed
+		# (for actions checking status before action).
+		configtest >/dev/null 2>&1
+		RETVAL=$?
+		if [ $RETVAL != 0 ]; then
+			show "Checking %s configuration" "accel-ppp"; fail
+			nls 'Configuration test failed. See details with %s "checkconfig"' $0
+			exit $RETVAL
+		fi
+	fi
+}
+
+start() {
+	# Check if the service is already running?
+	if [ -f /var/lock/subsys/accel-ppp ]; then
+		msg_already_running "accel-pppd"
+		return
+	fi
+
+	checkconfig
+	msg_starting "accel-pppd"
+	daemon /usr/sbin/accel-pppd
+	RETVAL=$?
+	[ $RETVAL -eq 0 ] && touch /var/lock/subsys/accel-ppp
+}
+
+stop() {
+	if [ ! -f /var/lock/subsys/accel-ppp ]; then
+		msg_not_running "accel-pppd"
+		return
+	fi
+
+	# Stop daemons.
+	msg_stopping "accel-pppd"
+	killproc accel-pppd
+	killproc --pidfile $pidfile accel-pppd -TERM
+	rm -f /var/lock/subsys/accel-ppp
+}
+
+reload() {
+	if [ ! -f /var/lock/subsys/accel-ppp ]; then
+		msg_not_running "accel-pppd"
+		RETVAL=7
+		return
+	fi
+
+	checkconfig
+	msg_reloading "accel-pppd"
+	killproc accel-pppd -HUP
+	killproc --pidfile $pidfile accel-pppd -HUP
+	RETVAL=$?
+}
+
+condrestart() {
+	if [ ! -f /var/lock/subsys/accel-ppp ]; then
+		msg_not_running "accel-pppd"
+		RETVAL=$1
+		return
+	fi
+
+	checkconfig
+	stop
+	start
+}
+
+RETVAL=0
+# See how we were called.
+case "$1" in
+  start)
+	start
+	;;
+  stop)
+	stop
+	;;
+  restart)
+	checkconfig
+	stop
+	start
+	;;
+  try-restart)
+	condrestart 0
+	;;
+# include force-reload here if program allows reloading without restart
+# otherwise remove reload action and support force-reload as restart if running
+  reload|force-reload)
+	reload
+	;;
+# use this one if program doesn't support reloading without restart
+  force-reload)
+	condrestart 7
+	;;
+  checkconfig|configtest)
+	checkconfig 1
+	;;
+  status)
+	status accel-ppp
+	status --pidfile $pidfile accel-ppp
+	status --pidfile $pidfile accel-ppp accel-pppd
+	RETVAL=$?
+	;;
+  *)
+	msg_usage "$0 {start|stop|restart|try-restart|reload|force-reload|checkconfig|status}"
+	exit 3
+esac
+
+exit $RETVAL
================================================================


More information about the pld-cvs-commit mailing list