aboutsummaryrefslogtreecommitdiff
path: root/system/powernowd/rc.powernowd.new
diff options
context:
space:
mode:
authorDaniel LEVAI <leva@ecentrum.hu>2010-05-12 23:33:46 +0200
committerRobby Workman <rworkman@slackbuilds.org>2010-05-12 23:33:46 +0200
commit84c1b62f41c085e6fd8edc44766b45b7f894f277 (patch)
tree875009b1d132620e184c3be503567b30f33643f5 /system/powernowd/rc.powernowd.new
parent9e6923f009ca94403b6ee172b7fca3408e085ae9 (diff)
system/powernowd: Added to 12.2 repository
Diffstat (limited to 'system/powernowd/rc.powernowd.new')
-rw-r--r--system/powernowd/rc.powernowd.new54
1 files changed, 54 insertions, 0 deletions
diff --git a/system/powernowd/rc.powernowd.new b/system/powernowd/rc.powernowd.new
new file mode 100644
index 0000000000000..fe6f50f15e9dc
--- /dev/null
+++ b/system/powernowd/rc.powernowd.new
@@ -0,0 +1,54 @@
+#!/bin/sh
+
+# Written by Daniel LEVAI for the Slackware package
+# Modified by Robby Workman <rworkman@slackbuilds.org>
+
+# For the options, see the README of the man page
+#OPTS='-q'
+
+powernowd_start() {
+ local PID=$(pgrep -x powernowd);
+ if [ $PID ];then
+ echo "powernowd is already running ($PID)"
+ exit 1
+ else
+ /usr/sbin/powernowd $OPTS
+ fi
+}
+
+powernowd_stop() {
+ local PID=$(pgrep -x powernowd);
+ if [ -z $PID ];then
+ echo "powernowd is not running"
+ exit 1
+ else
+ local i=1
+ while pgrep -x powernowd > /dev/null;do
+ if [ $i -gt 3 ];then
+ echo "Couldn't stop powernowd..."
+ exit 1
+ fi
+ pkill -x powernowd
+ i=$(( $i + 1 ));
+ sleep 1;
+ done
+ fi
+}
+
+case "$1" in
+start)
+ powernowd_start
+;;
+stop)
+ powernowd_stop
+;;
+restart)
+ powernowd_stop
+ sleep 1
+ powernowd_start
+;;
+*)
+ echo "$0 <start|stop|restart>"
+;;
+esac
+