summaryrefslogtreecommitdiffstats
path: root/aux/anamon.init
diff options
context:
space:
mode:
authorJames Cammarata <jimi@sngx.net>2009-03-07 21:44:00 -0600
committerJames Cammarata <jimi@sngx.net>2009-03-07 21:44:00 -0600
commitd3fdc6d4965b02ce18346f067c14080115943a38 (patch)
treed2fa630d3f0e941acb7f5115c31ea91aabb4ae11 /aux/anamon.init
parent54e462f3dca472d8bb8dc8a2b0a69c60ed9fe2ec (diff)
parent61db7baa541acc32b305ea6977a14ee8f5b3f470 (diff)
downloadcobbler-d3fdc6d4965b02ce18346f067c14080115943a38.tar.gz
cobbler-d3fdc6d4965b02ce18346f067c14080115943a38.tar.xz
cobbler-d3fdc6d4965b02ce18346f067c14080115943a38.zip
Merge branch 'devel' of git://git.fedorahosted.org/cobbler into ris-devel
Conflicts: cobbler/utils.py
Diffstat (limited to 'aux/anamon.init')
-rw-r--r--aux/anamon.init101
1 files changed, 101 insertions, 0 deletions
diff --git a/aux/anamon.init b/aux/anamon.init
new file mode 100644
index 00000000..b2fd9828
--- /dev/null
+++ b/aux/anamon.init
@@ -0,0 +1,101 @@
+#!/bin/bash
+## BEGIN INIT INFO
+# Provides: anamon
+# Default-Start: 3 5
+# Default-Stop: 0 1 2 4 6
+# Required-Start:
+# Should-Start: $network
+# Short-Description: Starts the cobbler anamon boot notification program
+# Description: anamon runs the first time a machine is booted after
+# installation.
+## END INIT INFO
+
+#
+# anamon: Starts the cobbler post-install boot notification program
+#
+# chkconfig: 35 99 95
+#
+# description: anamon runs the first time a machine is booted after
+# installation.
+#
+
+LOCKFILE="/var/lock/subsys/anamon"
+CFGFILE="/etc/sysconfig/anamon"
+
+# Source function library.
+. /etc/init.d/functions
+
+# Source anamon config
+. $CFGFILE
+
+LOGFILES=${LOGFILES:-/var/log/boot.log}
+
+# FIXME - can we rely on the koan snippet to update /etc/profile.d/cobbler.sh?
+if [ -z "$COBBLER_SERVER" ]; then
+ echo "No COBBLER_SERVER defined in $CFGFILE"
+ exit 1
+fi
+
+if [ -z "$COBBLER_NAME" ]; then
+ echo "No COBBLER_NAME defined in $CFGFILE"
+ exit 1
+fi
+
+if [ -z "$LOGFILES" ]; then
+ echo "No LOGFILES defined in $CFGFILE"
+ exit 1
+fi
+
+start() {
+ echo -n $"Starting anamon: "
+ daemon /usr/local/sbin/anamon.py --watchfile \"$LOGFILES\" --name $COBBLER_NAME --server $COBBLER_SERVER --port ${COBBLER_PORT:-80} --exit
+ RETVAL=$?
+ [ $RETVAL -eq 0 ] && touch $LOCKFILE
+ echo
+
+ # Disable service start
+ chkconfig anamon off
+
+ return $RETVAL
+}
+
+stop () {
+ echo -n $"Shutting down anamon: "
+ killproc /usr/local/sbin/anamon.py
+ RETVAL=$?
+ [ $RETVAL -eq 0 ] && rm -f $LOCKFILE
+ echo
+ return $RETVAL
+}
+
+restart() {
+ stop
+ start
+}
+
+case "$1" in
+ start)
+ start
+ ;;
+ stop)
+ stop
+ ;;
+ restart)
+ restart
+ ;;
+ condrestart)
+ if [ -f $LOCKFILE ]; then
+ restart
+ fi
+ ;;
+ status)
+ status anamon.py
+ RETVAL=$?
+ ;;
+ *)
+ echo $"Usage: $0 {start|stop|status|restart|condrestart}"
+ RETVAL=2
+ ;;
+esac
+
+exit $RETVAL