~bkerensa/ubuntu/raring/puppet/new-upstream-release

« back to all changes in this revision

Viewing changes to conf/suse/client.init

  • Committer: Benjamin Kerensa
  • Date: 2012-11-21 23:50:52 UTC
  • mfrom: (1.1.30)
  • Revision ID: bkerensa@ubuntu.com-20121121235052-ah7nzabp77sh69gb
New Upstream Release

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
#!/bin/bash
2
 
# puppet        Init script for running the puppet client daemon
3
 
#
4
 
# Author:       Duane Griffin <d.griffin@psenterprise.com>
5
 
#               David Lutterkort <dlutter@redhat.com>
6
 
#               Martin Vuk <martin.vuk@fri.uni-lj.si> (SuSE support)
7
 
#
8
 
# chkconfig: - 98 02
9
 
#
10
 
# description: Enables periodic system configuration checks through puppet.
11
 
# processname: puppet
12
 
# config: /etc/sysconfig/puppet
13
 
 
14
 
### BEGIN INIT INFO
15
 
# Provides: puppet
16
 
# Required-Start: $local_fs $remote_fs $network $syslog
17
 
# Should-Start: puppet
18
 
# Required-Stop: $local_fs $remote_fs $network $syslog
19
 
# Should-Stop: puppet
20
 
# Default-Start: 3 4 5
21
 
# Default-Stop: 0 1 2 6
22
 
# Short-Description: puppet
23
 
# Description: Enables periodic system configuration checks through puppet.
24
 
### END INIT INFO
25
 
 
26
 
# Shell functions sourced from /etc/rc.status:
27
 
#      rc_check         check and set local and overall rc status
28
 
#      rc_status        check and set local and overall rc status
29
 
#      rc_status -v     ditto but be verbose in local rc status
30
 
#      rc_status -v -r  ditto and clear the local rc status
31
 
#      rc_failed        set local and overall rc status to failed
32
 
#      rc_reset         clear local rc status (overall remains)
33
 
#      rc_exit          exit appropriate to overall rc status
34
 
[ -f /etc/rc.status ] && . /etc/rc.status
35
 
[ -f /etc/sysconfig/puppet ] && . /etc/sysconfig/puppet
36
 
lockfile=${LOCKFILE-/var/lock/subsys/puppet}
37
 
pidfile=${PIDFILE-/var/run/puppet.pid}
38
 
puppetd=${PUPPETD-/usr/sbin/puppetd}
39
 
 
40
 
PUPPET_OPTS=""
41
 
[ -n "${PUPPET_SERVER}" ] && PUPPET_OPTS="--server=${PUPPET_SERVER}"
42
 
[ -n "$PUPPET_LOG" ] && PUPPET_OPTS="${PUPPET_OPTS} --logdest=${PUPPET_LOG}"
43
 
[ -n "$PUPPET_PORT" ] && PUPPET_OPTS="${PUPPET_OPTS} --port=${PUPPET_PORT}"
44
 
 
45
 
# First reset status of this service
46
 
rc_reset
47
 
 
48
 
# Return values acc. to LSB for all commands but status:
49
 
# 0 - success
50
 
# 1 - misc error
51
 
# 2 - invalid or excess args
52
 
# 3 - unimplemented feature (e.g. reload)
53
 
# 4 - insufficient privilege
54
 
# 5 - program not installed
55
 
# 6 - program not configured
56
 
#
57
 
# Note that starting an already running service, stopping
58
 
# or restarting a not-running service as well as the restart
59
 
# with force-reload (in case signalling is not supported) are
60
 
# considered a success.
61
 
 
62
 
case "$1" in
63
 
    start)
64
 
        echo -n "Starting puppet services."
65
 
        ## Start daemon with startproc(8). If this fails
66
 
        ## the echo return value is set appropriate.
67
 
 
68
 
        # startproc should return 0, even if service is
69
 
        # already running to match LSB spec.
70
 
        startproc $puppetd ${PUPPET_OPTS} ${PUPPET_EXTRA_OPTS} && touch ${lockfile}
71
 
        # Remember status and be verbose
72
 
        rc_status -v
73
 
        ;;
74
 
    stop)
75
 
        echo -n "Shutting down puppet:"
76
 
        ## Stop daemon with killproc(8) and if this fails
77
 
        ## set echo the echo return value.
78
 
 
79
 
        killproc -QUIT $puppetd && rm -f ${lockfile} ${pidfile}
80
 
 
81
 
        # Remember status and be verbose
82
 
        rc_status -v
83
 
        ;;
84
 
    try-restart)
85
 
        ## Stop the service and if this succeeds (i.e. the
86
 
        ## service was running before), start it again.
87
 
        $0 status >/dev/null &&  $0 restart
88
 
 
89
 
        # Remember status and be quiet
90
 
        rc_status
91
 
        ;;
92
 
    restart)
93
 
        ## Stop the service and regardless of whether it was
94
 
        ## running or not, start it again.
95
 
        $0 stop
96
 
        $0 start
97
 
 
98
 
        # Remember status and be quiet
99
 
        rc_status
100
 
        ;;
101
 
    force-reload)
102
 
        ## Signal the daemon to reload its config. Most daemons
103
 
        ## do this on signal 1 (SIGHUP).
104
 
        ## If it does not support it, restart.
105
 
 
106
 
        echo -n "Reload service puppet"
107
 
        ## if it supports it:
108
 
        killproc -HUP $puppetd
109
 
        rc_status -v
110
 
        ;;
111
 
    reload)
112
 
        ## Like force-reload, but if daemon does not support
113
 
        ## signalling, do nothing (!)
114
 
 
115
 
        # If it supports signalling:
116
 
        echo -n "Reload puppet services."
117
 
        killproc -HUP  $puppetd
118
 
        rc_status -v
119
 
        ;;
120
 
    status)
121
 
        echo -n "Checking for service puppetd: "
122
 
        ## Check status with checkproc(8), if process is running
123
 
        ## checkproc will return with exit status 0.
124
 
 
125
 
        # Status has a slightly different for the status command:
126
 
        # 0 - service running
127
 
        # 1 - service dead, but /var/run/  pid  file exists
128
 
        # 2 - service dead, but /var/lock/ lock file exists
129
 
        # 3 - service not running
130
 
 
131
 
        # NOTE: checkproc returns LSB compliant status values.
132
 
        checkproc $puppetd
133
 
        rc_status -v
134
 
        ;;
135
 
    once)
136
 
        shift
137
 
        $puppetd -o ${PUPPET_OPTS} ${PUPPET_EXTRA_OPTS} $@
138
 
        ;;
139
 
    *)
140
 
        echo "Usage: $0 {start|stop|status|try-restart|restart|force-reload|reload|once}"
141
 
        exit 1
142
 
esac
143
 
rc_exit