blob: 5aa71069983dd9022f7d41ea5ea9d3925fe5d90f (
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
|
#!/bin/sh
#
# Bcfg2Server - Bcfg2 configuration daemon
#
# chkconfig: 2345 19 81
# description: bcfg2 server for configuration requests
#
### BEGIN INIT INFO
# Provides: bcfg2-server
# Required-Start: $network
# Required-Stop:
# Default-Start: 2 3 4 5
# Default-Stop: S 0 1 6
# Short-Description: Configuration management Server
# Description: Bcfg2 is a configuration management system that builds
# installs configuration files served by bcfg2-server
### END INIT INFO
DAEMON=/usr/sbin/bcfg2-server
PIDFILE=/var/run/bcfg2-server.pid
PARAMS="-D $PIDFILE"
# Exit if $DAEMON doesn't exist and is not executable
test -x $DAEMON || exit 5
# Include lsb functions
. /lib/lsb/init-functions
alias l_msg=log_success_msg
alias l_fail=log_failure_msg
# Internal variables
BINARY=$(basename $DAEMON)
case "$1" in
start)
echo -n "Starting Configuration Management Server: "
start_daemon ${DAEMON} ${PARAMS}
STATUS=$?
if [ "$STATUS" = 0 ]
then
l_msg "bcfg2-server"
else
l_fail "bcfg2-server"
fi
exit $STATUS
;;
stop)
echo -n "Stopping Configuration Management Server: "
killproc ${BINARY}
STATUS=$?
if [ "$STATUS" = 0 ]; then
l_msg "bcfg2-server"
exit 0
else
l_fail "bcfg2-server"
fi
exit $STATUS
;;
restart|force-reload|reload)
$0 stop
sleep 5
$0 start
;;
status)
# Inspired by redhat /etc/init.d/functions status() call
PID=$(pidof -x $BINARY)
if [ -n "$PID" ]; then
echo "$BINARY (pid $PID) is running..."
exit 0
fi
if [ -f $PIDFILE ]; then
if [ -n "$PID" ]; then
l_fail "$BINARY dead but pid file exists..."
exit 1
fi
fi
l_fail "$BINARY is not running"
exit 3
;;
*)
l_msg "Usage: $0 {start|stop|status|reload|restart|force-reload}"
exit 1
;;
esac
exit 0
|