blob: 330cf4fdd5a4c35b96664b026ee8a3637d9f5715 (
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
102
103
104
105
106
107
108
109
110
111
|
#!/bin/sh
#
# bcfg2 - bcfg2 configuration client
#
# chkconfig: 2345 19 81
# description: bcfg2 client for configuration requests
#
### BEGIN INIT INFO
# Provides: bcfg2
# Required-Start: $network $named
# Required-Stop:
# Default-Start: 2 3 4 5
# Default-Stop: S 0 1 6
# Short-Description: Configuration management client
# Description: Bcfg2 is a configuration management system that builds
# installs configuration files served by bcfg2-server
# This is a client that installs the server provided
# Configuration.
### END INIT INFO
# This might need some better logic
BCFG2=/usr/sbin/bcfg2
# Set default options
# You can set script specific options with BCFG2_OPTIONS_INIT
# You can set agent-mode specific options with BCFG2_OPTIONS_AGENT
BCFG2_OPTIONS="-q"
# Disabled per default
BCFG2_ENABLED=0
BCFG2_INIT=0
BCFG2_AGENT=0
# Include default startup configuration if exists
test -f "/etc/default/bcfg2" && . /etc/default/bcfg2
[ "$BCFG2_ENABLED" -eq 0 ] && exit 0
[ "$BCFG2_AGENT" -eq 0 -a "$BCFG2_INIT" -eq 0 ] && exit 0
# Exit if bcfg2 doesn't exist and is not executable
test -x $BCFG2 || exit 5
# Agent mode daemon capability
PIDFILE=/var/run/bcfg2.pid
# Internal variables
BINARY=$(basename $BCFG2)
# Include lsb functions
. /lib/lsb/init-functions
case "$1" in
start)
echo -n "Running configuration management client: "
if [ "$BCFG2_AGENT" -eq 1 ]
then
start_daemon ${BCFG2} -A -i /var/run/bcfg2-agent.pid ${BCFG2_OPTIONS} ${BCFG2_OPTIONS_AGENT}
STATUS=$?
fi
if [ "$BCFG2_INIT" -eq 1 ]; then
${BCFG2} ${BCFG2_OPTIONS} ${BCFG2_OPTIONS_INIT}
STATUS=$?
fi
if [ "$STATUS" -eq 0 ]
then
log_success_msg "bcfg2"
else
log_failure_msg "bcfg2"
fi
exit $STATUS
;;
status)
# Since we are always OK, always return OK as status
exit 0
;;
stop)
if [ "$BCFG2_AGENT" -eq 1 ]
then
echo -n "Stopping configuration management client daemon: "
killproc ${BINARY}
STATUS=$?
if [ "$STATUS" -eq 0 ]
then
log_success_msg "bcfg2"
exit 0
else
log_failure_msg "bcfg2"
fi
exit $STATUS
else
true
fi
;;
restart|reload|force-reload)
if [ "$BCFG2_AGENT" -eq 1 ]
then
$0 stop
sleep 5
$0 start
else
true
fi
;;
*)
echo "Usage: $0 {start|stop|restart|reload|force-reload|status}"
exit 1
esac
exit 0
|