Revert "Revert "oran-shell-release: release image for F""
[pti/rtp.git] / meta-starlingx / meta-stx-cloud / recipes-support / puppet / files / puppet / 4.8.2 / puppet.init
1 #!/bin/bash
2 #
3 # chkconfig: 35 20 80
4 # description: The puppet agent connects to a puppet master, requests a
5 #              catalog of resources, and configures the local system.
6 #
7
8 # Get function from functions library
9 . /etc/init.d/functions
10
11 PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
12 DAEMON=/usr/bin/puppet
13 DAEMON_OPTS="agent --server master --no-daemonize"
14 NAME="agent"
15 DESC="puppet agent"
16 PIDFILE="/var/run/${NAME}.pid"
17 PID=`test -f $PIDFILE && cat $PIDFILE`
18 RETVAL=0
19
20 test -x $DAEMON || exit 0
21
22 [ -r /etc/default/puppet ] && . /etc/default/puppet
23
24 reload_puppet_agent() {
25     start-stop-daemon --stop --quiet --signal HUP --pidfile $PIDFILE
26 }
27
28 start_puppet_agent() {
29     start-stop-daemon --start --quiet --pidfile $PIDFILE \
30         --startas $DAEMON -- $NAME $DAEMON_OPTS
31 }
32
33 stop_puppet_agent() {
34     start-stop-daemon --stop --retry TERM/10/KILL/5 --quiet --oknodo --pidfile $PIDFILE
35 }
36
37 status_puppet_agent() {
38     status_of_proc -p "${PIDFILE}" "${DAEMON}" "${NAME}"
39 }
40
41 case "$1" in
42     start)
43         echo -n "Starting $DESC"
44         start_puppet_agent
45         log_end_msg $?
46         ;;
47     stop)
48         echo -n "Stopping $DESC"
49         stop_puppet_agent
50         log_end_msg $?
51         ;;
52     reload)
53         echo -n "Reloading $DESC"
54         reload_puppet_agent
55         log_end_msg $?
56         ;;
57     status)
58         status_puppet_agent
59         ;;
60     restart|force-reload)
61         echo -n "Restarting $DESC"
62         stop_puppet_agent
63         start_puppet_agent
64         log_end_msg $?
65         ;;
66 *)
67         echo "Usage: $0 {start|stop|status|restart|force-reload|reload}" >&2
68         exit 1
69         ;;
70 esac
71
72 exit 0