blob: a0ddb9ccb530621590c139830a243389479272fe (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
|
#!/bin/bash
. /etc/rc.conf
. /etc/rc.d/functions
case "$1" in
start)
stat_busy "Starting laptop-mode"
[ ! -d /var/run/laptop-mode-tools ] && install -d /var/run/laptop-mode-tools
touch /var/run/laptop-mode-tools/enabled
/usr/sbin/laptop_mode auto >/dev/null 2>&1
if [ $? -gt 0 ]; then
stat_fail
else
add_daemon laptop-mode
stat_done
fi
;;
stop)
stat_busy "Stopping laptop-mode"
rm -f /var/run/laptop-mode-tools/enabled
/usr/sbin/laptop_mode stop >/dev/null 2>&1
if [ $? -gt 0 ]; then
stat_fail
else
rm_daemon laptop-mode
stat_done
fi
;;
restart)
stat_busy "Restarting laptop-mode"
rm -f /var/run/laptop-mode-tools/enabled
/usr/sbin/laptop_mode stop >/dev/null 2>&1
if [ $? -gt 0 ]; then
stat_fail
rm_daemon laptop-mode
else
rm -f /var/run/laptop-mode-tools/*
touch /var/run/laptop-mode-tools/enabled
/usr/sbin/laptop_mode auto force >/dev/null 2>&1
if [ $? -gt 0 ]; then
stat_fail
rm_daemon laptop-mode
else
stat_done
fi
fi
;;
status)
/usr/sbin/laptop_mode status
;;
*)
echo "Usage: $0 {stop|start|restart|status}"
;;
esac
exit 0
|