SOURCES: gozerbot.init (NEW) - initial initscript from template

glen glen at pld-linux.org
Wed Nov 5 22:03:22 CET 2008


Author: glen                         Date: Wed Nov  5 21:03:22 2008 GMT
Module: SOURCES                       Tag: HEAD
---- Log message:
- initial initscript from template

---- Files affected:
SOURCES:
   gozerbot.init (NONE -> 1.1)  (NEW)

---- Diffs:

================================================================
Index: SOURCES/gozerbot.init
diff -u /dev/null SOURCES/gozerbot.init:1.1
--- /dev/null	Wed Nov  5 22:03:23 2008
+++ SOURCES/gozerbot.init	Wed Nov  5 22:03:17 2008
@@ -0,0 +1,95 @@
+#!/bin/sh
+#
+# gozerbot	Python IRC/Jabber bot
+#
+# chkconfig:	345 80 20
+#
+# description:	Python IRC/Jabber bot
+#
+# processname:	gozerbot
+# config:
+# pidfile:
+#
+# $Id$
+
+# Source function library
+. /etc/rc.d/init.d/functions
+
+# Get network config
+. /etc/sysconfig/network
+
+# Get service config - may override defaults
+[ -f /etc/sysconfig/gozerbot ] && . /etc/sysconfig/gozerbot
+
+# 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 gozerbot
+		exit 1
+	fi
+else
+	exit 0
+fi
+
+start() {
+	# Check if the service is already running?
+	if [ ! -f /var/lock/subsys/gozerbot ]; then
+		msg_starting gozerbot
+		daemon /usr/bin/gozerbot
+		RETVAL=$?
+		[ $RETVAL -eq 0 ] && touch /var/lock/subsys/gozerbot
+	else
+		msg_already_running gozerbot
+	fi
+}
+
+stop() {
+	if [ -f /var/lock/subsys/gozerbot ]; then
+		# Stop daemons.
+		msg_stopping gozerbot
+		killproc --pidfile /var/run/gozerbot.pid gozerbot -TERM
+		rm -f /var/lock/subsys/gozerbot
+	else
+		msg_not_running gozerbot
+	fi
+}
+
+condrestart() {
+	if [ -f /var/lock/subsys/gozerbot ]; then
+		stop
+		start
+	else
+		msg_not_running gozerbot
+		RETVAL=$1
+	fi
+}
+
+RETVAL=0
+# See how we were called.
+case "$1" in
+  start)
+  	start
+	;;
+  stop)
+  	stop
+	;;
+  restart)
+	stop
+	start
+	;;
+  try-restart)
+	condrestart 0
+	;;
+  force-reload)
+	condrestart 7
+	;;
+  status)
+	status gozerbot
+	RETVAL=$?
+	;;
+  *)
+	msg_usage "$0 {start|stop|restart|try-restart|force-reload|status}"
+	exit 3
+esac
+
+exit $RETVAL
================================================================


More information about the pld-cvs-commit mailing list