aboutsummaryrefslogtreecommitdiff
path: root/system/i8kutils/rc.i8kmon
diff options
context:
space:
mode:
authorFabio Sangiovanni <sjh+sbo@sanjioh.org>2013-06-02 23:31:49 -0500
committerRobby Workman <rworkman@slackbuilds.org>2013-06-04 00:11:27 -0500
commitddbd1b525955be986151fcbf10ba342ca4fba12c (patch)
tree5717a1ee796ae9a8083bede05d640ab4feaf61b3 /system/i8kutils/rc.i8kmon
parent7e6d55c4b3a4b22aeec97875e3ee1390d27e57db (diff)
system/i8kutils: Added (utilities for Dell Inspiron and Latitude laptops)
Signed-off-by: Robby Workman <rworkman@slackbuilds.org>
Diffstat (limited to 'system/i8kutils/rc.i8kmon')
-rw-r--r--system/i8kutils/rc.i8kmon68
1 files changed, 68 insertions, 0 deletions
diff --git a/system/i8kutils/rc.i8kmon b/system/i8kutils/rc.i8kmon
new file mode 100644
index 000000000000..1d88d42ccbb5
--- /dev/null
+++ b/system/i8kutils/rc.i8kmon
@@ -0,0 +1,68 @@
+#!/bin/sh
+# Start/stop/restart i8kmon.
+
+I8KMON_PARAMS="--auto --daemon"
+
+# Start i8kmon
+i8kmon_start() {
+ if [ -x /usr/bin/i8kmon -a -f /proc/i8k ]; then
+ echo "Starting i8kmon daemon: /usr/bin/i8kmon $I8KMON_PARAMS &"
+ /usr/bin/i8kmon $I8KMON_PARAMS &
+ fi
+}
+
+# Stop i8kmon
+i8kmon_stop() {
+ echo "Stopping i8kmon daemon"
+ pkill -f "tclsh /usr/bin/i8kmon -- $I8KMON_PARAMS"
+}
+
+# Check status
+i8kmon_status() {
+ pgrep -f "tclsh /usr/bin/i8kmon -- $I8KMON_PARAMS" > /dev/null
+ local I8KMON_STATUS=$?
+ if [ $I8KMON_STATUS -ne 0 ]; then
+ return 1
+ fi
+}
+
+# Restart i8kmon
+i8kmon_restart() {
+ $0 stop
+ sleep 1
+ $0 start
+}
+
+case "$1" in
+'start')
+ if ( ! i8kmon_status ); then
+ i8kmon_start
+ else
+ echo "i8kmon is already running"
+ fi
+ ;;
+
+'stop')
+ if ( i8kmon_status ); then
+ i8kmon_stop
+ else
+ echo "i8kmon is already stopped"
+ fi
+ ;;
+
+'status')
+ if ( i8kmon_status ); then
+ echo "i8kmon is currently running"
+ else
+ echo "i8kmon is NOT running"
+ fi
+ ;;
+
+'restart')
+ i8kmon_restart
+ ;;
+
+*)
+ echo "Usage: $0 start|stop|status|restart"
+ ;;
+esac