summaryrefslogtreecommitdiffstats
path: root/system/system76-power/config/rc.system76-power
diff options
context:
space:
mode:
author Erich Ritz2019-11-16 15:13:27 +0100
committer Willy Sudiarto Raharjo2019-11-16 15:13:54 +0100
commit5ed686759954a173c715912216babb3ab441d406 (patch)
tree97f495c83047f9528f6a86538e922eacc2ee9983 /system/system76-power/config/rc.system76-power
parentb873eb05f1c9f6e68c5b9a980e3ccd07be1cbcf2 (diff)
downloadslackbuilds-5ed686759954a173c715912216babb3ab441d406.tar.gz
system/system76-power: Added (utility for managing graphics/power)
Signed-off-by: Willy Sudiarto Raharjo <willysr@slackbuilds.org>
Diffstat (limited to 'system/system76-power/config/rc.system76-power')
-rw-r--r--system/system76-power/config/rc.system76-power60
1 files changed, 60 insertions, 0 deletions
diff --git a/system/system76-power/config/rc.system76-power b/system/system76-power/config/rc.system76-power
new file mode 100644
index 0000000000..93e3e25dfa
--- /dev/null
+++ b/system/system76-power/config/rc.system76-power
@@ -0,0 +1,60 @@
+#!/bin/sh
+# Start system76-power daemon
+#
+
+LOG_FILE=/var/log/system76-power.log
+
+add_log_msg() {
+ echo "[$(date "+%Y-%m-%d %T")] $1" >> $LOG_FILE
+}
+
+s76pwr_start() {
+ PWR_DIR=/usr/bin
+ if [ -x $PWR_DIR/system76-power ] ; then
+ echo "Starting system76-power..."
+ add_log_msg "Starting system76-power daemon from /etc/rc.d/rc.system76-power"
+ $PWR_DIR/system76-power daemon >>$LOG_FILE 2>&1 &
+ fi
+}
+
+s76pwr_stop() {
+ add_log_msg "Killing system76-power daemon from /etc/rc.d/rc.system76-power"
+ killall system76-power 2> /dev/null
+}
+
+s76pwr_restart() {
+ s76pwr_stop
+ sleep 1
+ s76pwr_start
+}
+
+s76pwr_help() {
+ cat <<EOF
+usage: $0 start|stop|restart
+
+$0 start
+ Starts the system76-power daemon
+
+$0 stop
+ Stops the system76-power daemon
+
+$0 restart
+ Restarts the system76-power daemon
+
+EOF
+}
+
+case "$1" in
+'start')
+ s76pwr_start
+ ;;
+'stop')
+ s76pwr_stop
+ ;;
+'restart')
+ s76pwr_restart
+ ;;
+*)
+ s76pwr_help
+ ;;
+esac