#!/bin/sh pidfile="/var/run/puppet/puppetd.pid" options="--pidfile $pidfile" puppet_start() { echo "Starting puppet" start-stop-daemon --start --quiet \ --pidfile $pidfile \ --exec /usr/bin/puppetd -- $options if [ "$?" != "0" ]; then echo "Failed to start puppet" fi } puppet_stop() { echo "Stopping puppet" start-stop-daemon --stop --quiet \ --pidfile $pidfile if [ "$?" != "0" ]; then echo "Failed to stop puppet" fi rm -f "/var/run/puppet/puppetd.pid" } case "$1" in 'start') puppet_start ;; 'stop') puppet_stop ;; 'restart') puppet_stop puppet_start ;; *) echo "usage $0 start|stop|restart" esac