2
0
mirror of https://github.com/fhem/fhem-mirror.git synced 2025-01-31 18:59:33 +00:00
fhem-mirror/fhem/contrib/init-scripts/fhem.3
rudolfkoenig 82ba490176 5.3 preparation/changes
git-svn-id: https://svn.fhem.de/fhem/trunk@2027 2b470e98-0d58-463d-a4d8-8e2adae1ed80
2012-10-27 16:23:09 +00:00

43 lines
916 B
Bash

#!/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
cd /opt/fhem
port=7072
case "$1" in
'start')
echo "Starting fhem..."
perl fhem.pl fhem.cfg
RETVAL=$?
;;
'stop')
echo "Stopping fhem..."
perl fhem.pl $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