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 19fe72b1be deb: Fixing startup problems while installing
git-svn-id: https://svn.fhem.de/fhem/trunk@6925 2b470e98-0d58-463d-a4d8-8e2adae1ed80
2014-11-09 13:19:57 +00:00

69 lines
1.4 KiB
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
if test "$2" != "noaptmark"; then
apt-mark hold fhem > /dev/null
fi
case "$1" in
'start')
echo "Starting fhem..."
# if you need to start hmland for use with
# Homematic, please start the hmland daemon
# like this (please use correct path and port,
# depending on your installation!)
#
# /opt/hmcfgusb/hmland -d -p 1234 -r 0
#
perl fhem.pl fhem.cfg
# if you want to use configDB for configuration,
# use this command to start fhem:
#
# perl fhem.pl configDB
#
# and remove/comment the above line including fhem.cfg
RETVAL=$?
;;
'stop')
echo "Stopping fhem..."
# if you want to stop hmland during fhem stop:
# pkill hmland
pkill -U fhem perl
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