#!/bin/bash name=rygel host=$(hostname -s) start() { echo "Starting $name Services: " /usr/bin/$name > /dev/null 2>&1 & } stop() { echo "Stopping $name Services: " #Find the Process ID for $name running instance ps -ef | grep $name | grep -v grep | awk '{print $2}' | xargs kill } restart() { stop sleep 3 start } case "$1" in start) start ;; stop) stop ;; restart) stop; start ;; *) echo "usage: $0 start|stop|restart" >&2 exit 1 ;; esac