From d5cbf87338c96adb7a5c75393ac210877c26a939 Mon Sep 17 00:00:00 2001 From: Gwenhael Le Moine Date: Wed, 6 Apr 2011 15:18:35 +0700 Subject: [PATCH] rc script for ulatencyd --- xap/ulatencyd/rc.ulatencyd.new | 51 ++++++++++++++++++++++++++++++++++ 1 file changed, 51 insertions(+) create mode 100755 xap/ulatencyd/rc.ulatencyd.new diff --git a/xap/ulatencyd/rc.ulatencyd.new b/xap/ulatencyd/rc.ulatencyd.new new file mode 100755 index 00000000..82a9a6d9 --- /dev/null +++ b/xap/ulatencyd/rc.ulatencyd.new @@ -0,0 +1,51 @@ +#!/bin/sh + +start() { + if [ -f /var/run/ulatencyd.pid ]; then + echo "ulatencyd is already running" + exit 1 + elif [ -x /usr/sbin/ulatencyd ]; then + /usr/sbin/ulatencyd || exit $? + pidof Ulatencyd > /var/run/ulatencyd.pid + echo "ulatencyd Started" + fi +} + +stop() { + if [ -f /var/run/ulatencyd.pid ]; then + kill $(cat /var/run/ulatencyd.pid) || echo "Unable to stop ulatencyd" + rm -f /var/run/ulatencyd.pid + echo "ulatencyd Stopped" + else + echo "ulatencyd is not started" + fi +} + +status() { + if [ -f /var/run/ulatencyd.pid ]; then + echo "ulatencyd Running" + echo "PID: $(cat /var/run/ulatencyd.pid)" + else + echo "ulatencyd is not started" + fi +} + +case "$1" in + "start") + start + ;; + "stop") + stop + ;; + "status") + status + ;; + "restart") + stop + sleep 1 + start + ;; + *) + echo "$0 Usage: [start|stop|restart|status]" + ;; +esac