mirror of
https://github.com/fhem/fhem-mirror.git
synced 2025-02-01 07:19:24 +00:00
45 lines
925 B
Groff
45 lines
925 B
Groff
|
#!/bin/sh
|
||
|
# description: Start or stop the fhem server
|
||
|
# Added by Alex Peuchert
|
||
|
|
||
|
### 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
|
||
|
|
||
|
fhz=/usr/bin/fhem.pl
|
||
|
conf=/etc/fhem.cfg
|
||
|
port=7072
|
||
|
|
||
|
case "$1" in
|
||
|
'start')
|
||
|
echo "Starting fhem..."
|
||
|
$fhz $conf
|
||
|
RETVAL=$?
|
||
|
;;
|
||
|
'stop')
|
||
|
echo "Stopping fhem..."
|
||
|
$fhz $port "shutdown"
|
||
|
RETVAL=$?
|
||
|
;;
|
||
|
'status')
|
||
|
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
|