summaryrefslogtreecommitdiff
path: root/sitemodules/profiles/files/puppet.init
diff options
context:
space:
mode:
authorJan Dittberner <jandd@cacert.org>2016-11-05 11:41:46 +0100
committerroot <root@puppet.intra.cacert.org>2016-11-05 11:43:06 +0100
commitbef9c83e74228604c5e7ed46c3e308408b5f6ca6 (patch)
tree997a1c116ae1db03430d8dc9005636e8d08fb882 /sitemodules/profiles/files/puppet.init
parent1dad9bcf5c2f3212052ce493b08b1a2af754b7f1 (diff)
downloadcacert-puppet-bef9c83e74228604c5e7ed46c3e308408b5f6ca6.tar.gz
cacert-puppet-bef9c83e74228604c5e7ed46c3e308408b5f6ca6.tar.xz
cacert-puppet-bef9c83e74228604c5e7ed46c3e308408b5f6ca6.zip
Restructure to use r10k
This commit adds metadata to the profiles module, introduces a Puppetfile for r10k and moves site specific modules to its own sitemodules directory.
Diffstat (limited to 'sitemodules/profiles/files/puppet.init')
-rw-r--r--sitemodules/profiles/files/puppet.init113
1 files changed, 113 insertions, 0 deletions
diff --git a/sitemodules/profiles/files/puppet.init b/sitemodules/profiles/files/puppet.init
new file mode 100644
index 0000000..8d909bc
--- /dev/null
+++ b/sitemodules/profiles/files/puppet.init
@@ -0,0 +1,113 @@
+#! /bin/sh
+### BEGIN INIT INFO
+# Provides: puppet
+# Required-Start: $network $named $remote_fs $syslog
+# Required-Stop: $network $named $remote_fs $syslog
+# Should-Start: puppet
+# Default-Start: 2 3 4 5
+# Default-Stop: 0 1 6
+### END INIT INFO
+
+DAEMON=/opt/puppetlabs/puppet/bin/puppet
+DAEMON_OPTS=""
+NAME="agent"
+PROCNAME="puppet"
+DESC="puppet agent"
+PIDFILE="/var/run/puppetlabs/${NAME}.pid"
+
+test -x $DAEMON || exit 0
+
+[ -r /etc/default/puppet ] && . /etc/default/puppet
+
+. /lib/lsb/init-functions
+
+reload_puppet_agent() {
+ start-stop-daemon --stop --quiet --signal HUP --pidfile $PIDFILE --name $PROCNAME
+}
+
+start_puppet_agent() {
+ start-stop-daemon --start --quiet --pidfile $PIDFILE --startas $DAEMON -- $NAME $DAEMON_OPTS
+}
+
+stop_puppet_agent() {
+ start-stop-daemon --stop --retry TERM/10/KILL/5 --quiet --oknodo --pidfile $PIDFILE --name $PROCNAME
+ rm -f "$PIDFILE"
+}
+
+restart_puppet_agent() {
+ log_begin_msg "Restarting $DESC"
+ stop_puppet_agent
+ start_puppet_agent
+ log_end_msg $?
+}
+
+status_puppet_agent() {
+ if (type status_of_proc > /dev/null 2>&1) ; then
+ status_of_proc -p "${PIDFILE}" "${DAEMON}" "${NAME}"
+ else
+ status_of_proc() {
+ local pidfile daemon name status
+
+ pidfile=
+ OPTIND=1
+ while getopts p: opt ; do
+ case "$opt" in
+ p) pidfile="$OPTARG";;
+ esac
+ done
+ shift $(($OPTIND - 1))
+
+ if [ -n "$pidfile" ]; then
+ pidfile="-p $pidfile"
+ fi
+ daemon="$1"
+ name="$2"
+ status="0"
+ pidofproc $pidfile $daemon >/dev/null || status="$?"
+ if [ "$status" = 0 ]; then
+ log_success_msg "$name is running"
+ return 0
+ elif [ "$status" = 4 ]; then
+ log_failure_msg "could not access PID file for $name"
+ return $status
+ else
+ log_failure_msg "$name is not running"
+ return $status
+ fi
+ }
+ status_of_proc -p "${PIDFILE}" "${DAEMON}" "${NAME}"
+ fi
+}
+
+case "$1" in
+ start)
+ log_begin_msg "Starting $DESC"
+ start_puppet_agent
+ log_end_msg $?
+ ;;
+ stop)
+ log_begin_msg "Stopping $DESC"
+ stop_puppet_agent
+ log_end_msg $?
+ ;;
+ reload)
+ log_begin_msg "Reloading $DESC"
+ reload_puppet_agent
+ log_end_msg $?
+ ;;
+ status)
+ status_puppet_agent
+ ;;
+ restart|force-reload)
+ restart_puppet_agent
+ ;;
+ condrestart)
+ if status_puppet_agent >/dev/null 2>&1; then
+ restart_puppet_agent
+ fi
+ ;;
+ *)
+ echo "Usage: $0 {start|stop|status|restart|condrestart|force-reload|reload}" >&2
+ exit 1
+ ;;
+esac