-
Notifications
You must be signed in to change notification settings - Fork 11
/
Copy pathS61hmlangw
50 lines (40 loc) · 1.23 KB
/
S61hmlangw
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
#!/bin/sh
#
# Start CCU2 LAN Gateway
#
HMLANGW_PATH=/usr/local/addons/hmlangw
SERIALNUMBER_FILE=/usr/local/addons/serialnumber.txt
start() {
echo -n "Starting LAN Gateway Daemon: "
echo none > /sys/class/leds/info/trigger
echo none > /sys/class/leds/internet/trigger
echo 0 > /sys/class/leds/info/brightness
echo 0 > /sys/class/leds/internet/brightness
[[ ! -e ${SERIALNUMBER_FILE} ]] && (echo CCU2GW0001 > ${SERIALNUMBER_FILE} && echo "new CCU2GW0001 serialnumber.txt created")
start-stop-daemon -S -b -m -p /var/run/hmlangw.pid --startas /bin/sh -- -c "exec ${HMLANGW_PATH} -n read -r -1 >/var/log/hmlangw.log 2>&1"
[[ $? -eq 0 ]] && (echo "OK" && echo 255 > /sys/class/leds/info/brightness) || ( echo "ERROR" && echo timer > /sys/class/leds/info/trigger)
}
stop() {
echo -n "Stopping LAN Gateway Daemon: "
start-stop-daemon -K -q -o -p /var/run/hmlangw.pid
[[ $? -eq 0 ]] && ( rm -f /var/run/hmlangw.pid && echo "OK" && echo 0 > /sys/class/leds/info/brightness) || (echo "ERROR" && echo timer > /sys/class/leds/info/trigger)
}
restart() {
stop
start
}
case "$1" in
start)
start
;;
stop)
stop
;;
restart|reload)
restart
;;
*)
echo "Usage: $0 {start|stop|restart|reload}"
exit 1
esac
exit $?