forked from hexenmeister/MyFHEM
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathetc_init.d_fhem_script.txt
More file actions
52 lines (48 loc) · 1.19 KB
/
etc_init.d_fhem_script.txt
File metadata and controls
52 lines (48 loc) · 1.19 KB
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
#!/bin/sh
# description: Start or stop the fhem server
# Added by Alex Peuchert
# modified by A. Schulz
### BEGIN INIT INFO
# Provides: fhem.pl
# Required-Start: $local_fs $remote_fs
# Required-Stop: $local_fs $remote_fs
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: FHEM server
### END INIT INFO
set -e
cd /opt/fhem
port=7072
case "$1" in
'start')
echo "Starting fhem..."
#perl fhem.pl fhem.cfg
/opt/fhem/startfhem
RETVAL=$?
;;
'stop')
echo "Stopping fhem..."
/opt/fhem/stopfhem
#perl fhem.pl $port "shutdown"
RETVAL=$?
;;
'status')
cnt=`ps -ef | grep "watchdogloop.sh" | grep -v grep | wc -l`
if [ "$cnt" -eq "0" ] ; then
echo "watchdog is not running"
else
echo "watchdog is running"
fi
cnt=`ps -ef | grep "fhem.pl" | grep -v grep | wc -l`
if [ "$cnt" -eq "0" ] ; then
echo "fhem is not running"
else
echo "fhem is running"
fi
;;
*)
echo "Usage: $0 { start | stop | status }"
RETVAL=1
;;
esac
exit $RETVAL