Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 15 additions & 1 deletion templates/default/machine/init.d.erb
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,13 @@ stop() {
echo
}

is_running() {
[ -f "$pid_file" ] && ps -p `get_pid` > /dev/null 2>&1
}
get_pid() {
cat "$pid_file"
}

case "$1" in
start)
start
Expand All @@ -46,8 +53,15 @@ case "$1" in
stop
start
;;
status)
if is_running(); then
echo "Running"
else
echo "Not running"
exit 1
fi
*)
echo $"Usage: $0 {start|stop|restart}"
echo $"Usage: $0 {start|stop|restart|status}"
RETVAL=1
;;
esac
Expand Down