diff options
| author | James Turnbull <james@lovedthanlost.net> | 2008-07-15 17:15:05 +1000 |
|---|---|---|
| committer | James Turnbull <james@lovedthanlost.net> | 2008-07-15 17:15:05 +1000 |
| commit | 65b9869362cd39f20609abb93729cb0c3977f0cf (patch) | |
| tree | 2e13f202324da4be57d2a2a54191c42d2e53fb58 /examples/etc/init.d | |
| parent | 4ce7159baba4c637867c91519b5a3b16627dfca5 (diff) | |
| download | puppet-65b9869362cd39f20609abb93729cb0c3977f0cf.tar.gz puppet-65b9869362cd39f20609abb93729cb0c3977f0cf.tar.xz puppet-65b9869362cd39f20609abb93729cb0c3977f0cf.zip | |
Further moves from the examples directory and ext directory
Diffstat (limited to 'examples/etc/init.d')
| -rwxr-xr-x | examples/etc/init.d/sleeper | 72 |
1 files changed, 72 insertions, 0 deletions
diff --git a/examples/etc/init.d/sleeper b/examples/etc/init.d/sleeper new file mode 100755 index 000000000..6da5eae32 --- /dev/null +++ b/examples/etc/init.d/sleeper @@ -0,0 +1,72 @@ +#!/bin/bash + +# $Id$ + +script=$0 +path=`echo $script | sed 's/etc..*/bin/'` + +PATH=$PATH:$path + +ps=`facter ps` + +if [ -z "$ps" ]; then + ps="ps -ef" +fi + +function start +{ + cd $path + ./sleeper +} + +function stop +{ + #if [ -n `which pgrep` ]; then + # pid=`pgrep sleeper` + #else + pid=`$ps | grep -v grep | grep sleeper | grep ruby | awk '{print $2}'` + #fi + if [ -n "$pid" ]; then + kill $pid + fi +} + +function restart +{ + stop + start +} + +function status +{ + #if [ -n `which pgrep` ]; then + # cmd="pgrep sleeper" + #else + #cmd="$ps | grep -v grep | grep sleeper | grep ruby | awk '{print $2}'" + #fi + #$cmd + $ps | grep -v grep | grep sleeper | grep ruby +} + +case "$1" in + start) + start + ;; + stop) + stop + ;; + restart) + stop; start + ;; + status) + output=`status` + #status + exit $? + ;; + *) + echo "Usage: $N {start|stop|restart|force-reload}" >&2 + exit 1 + ;; +esac + +exit 0 |
