blob: d029c881cd53c0410741900df5f18bf2a4ad9b0c (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
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 --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
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
RETVAL=$?
;;
*)
echo $"Usage: $0 {start|stop|status|restart|condrestart}"
RETVAL=2
;;
esac
exit $RETVAL
|