---
thinkfan (511B)
---
1 #!/bin/sh
2
3 SERVICE="thinkfan"
4 BIN="/usr/bin/thinkfan"
5 PIDFILE="/var/run/thinkfan.pid"
6
7 [ -e "/bin/svc.d/default/$SERVICE" ] && . "/bin/svc.d/default/$SERVICE"
8
9 if [ -e "$PIDFILE" ];
10 then
11 PID="$(cat "$PIDFILE")"
12 else
13 PID=$(pidof -o %PPID $BIN)
14 fi
15
16 case $1 in
17 -s)
18 [ -e "$PIDFILE" ] && rm -f "$PIDFILE" && PID=""
19 [ -z "$PID" ] && $BIN $PARAMS >/dev/null 2>&1;
20 ;;
21 -k)
22 [ -n "$PID" ] && kill -HUP $PID &> /dev/null;
23 [ -e "$PIDFILE" ] && rm -f "$PIDFILE"
24 ;;
25 *)
26 echo "usage: $0 -s|-k"
27 exit 1
28 esac
29 |