File: openstack-cluster-installer-agent.init

package info (click to toggle)
openstack-cluster-installer 43.0.18
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 4,484 kB
  • sloc: php: 19,127; sh: 18,142; ruby: 75; makefile: 31; xml: 8
file content (84 lines) | stat: -rwxr-xr-x 1,696 bytes parent folder | download | duplicates (4)
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
#!/bin/sh

### BEGIN INIT INFO
# Provides:          oci-agent-daemon
# Required-Start:    $network $local_fs
# Required-Stop:     $network $local_fs
# Default-Start:     2 3 4 5
# Default-Stop:      0 1 6
# Short-Description: A small daemon to report config of slave nodes
# Description:       A small daemon which starts a shell script that
#                    reports the hardware configuration of slave nodes
#                    back to the central server of OCI.
### END INIT INFO

DESC="OpenStack cluster installer agent daemon (oci-agent-daemon)"
NAME=oci-agent-daemon
DAEMON=/usr/bin/${NAME}
PIDFILE=/var/run/oci-agent-daemon.pid
DAEMON=/usr/bin/oci-agent-daemon

. /lib/lsb/init-functions

do_start() {
	start-stop-daemon \
		--start \
		--quiet \
		--background \
		--make-pidfile --pidfile ${PIDFILE} \
		--startas $DAEMON \
		--test > /dev/null \
		|| return 1
	start-stop-daemon \
		--start \
		--quiet \
		--background \
		--make-pidfile --pidfile ${PIDFILE} \
		--startas $DAEMON \
		|| return 2
}

do_stop() {
	start-stop-daemon \
		--stop \
		--quiet \
		--retry=TERM/30/KILL/5 \
		--pidfile $PIDFILE
	RETVAL=$?
	rm -f $PIDFILE
	return "$RETVAL"
}

do_systemd_start() {
	exec $DAEMON
}

case "$1" in
start|systemd-start)
	log_daemon_msg "Starting $DESC" "$NAME"
	do_start
	case $? in
		0|1) log_end_msg 0 ; RET=$? ;;
		2)   log_end_msg 1 ; RET=$? ;;
		esac
;;
stop)
	log_daemon_msg "Stopping $DESC" "$NAME"
	do_stop
	case $? in
		0|1) log_end_msg 0 ; RET=$? ;;
		2)   log_end_msg 1 ; RET=$? ;;
        esac
;;
restart|reload|force-reload)
        $0 stop
        sleep 1
        $0 start
;;
*)
        echo 'Usage: $0 {start|stop|restart|reload}'
        exit 1
;;
esac

exit 0