svc

Simple service scripts and examples, to be used everywhere.
git clone git://r-36.net/svc
Log | Files | Refs | LICENSE

laptop-mode (446B)


      1 #!/bin/sh
      2 
      3 SERVICE="laptop-mode"
      4 
      5 [ -e "/bin/svc.d/default/$SERVICE" ] && . "/bin/svc.d/default/$SERVICE"
      6 
      7 BIN="/usr/sbin/$SERVICE"
      8 
      9 case $1 in
     10 	-s)
     11 		[ ! -d /run/laptop-mode-tools ] && install -d /run/laptop-mode-tools
     12 		rm -f /run/laptop-mode-tools/*
     13 		touch /run/laptop-mode-tools/enabled
     14 		$BIN auto 2>&1 >/dev/null
     15 		;;
     16 	-k)
     17 		rm -f /run/laptop-mode-tools/enabled
     18 		$BIN stop 2>&1 >/dev/null
     19 		;;
     20 	*)
     21 		echo "usage: $0 -s|-k"
     22 		exit 1
     23 esac
     24