fhem.3 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. #!/bin/sh
  2. # description: Start or stop the fhem server
  3. # Added by Alex Peuchert
  4. ### BEGIN INIT INFO
  5. # Provides: fhem.pl
  6. # Required-Start: $local_fs $remote_fs
  7. # Required-Stop: $local_fs $remote_fs
  8. # Default-Start: 2 3 4 5
  9. # Default-Stop: 0 1 6
  10. # Short-Description: FHEM server
  11. ### END INIT INFO
  12. set -e
  13. cd /opt/fhem
  14. port=7072
  15. if test "$2" != "noaptmark"; then
  16. apt-mark hold fhem > /dev/null
  17. fi
  18. case "$1" in
  19. 'start')
  20. echo "Starting fhem..."
  21. # if you need to start hmland for use with
  22. # Homematic, please start the hmland daemon
  23. # like this (please use correct path and port,
  24. # depending on your installation!)
  25. #
  26. # /opt/hmcfgusb/hmland -d -p 1234 -r 0
  27. #
  28. perl fhem.pl fhem.cfg
  29. # if you want to use configDB for configuration,
  30. # use this command to start fhem:
  31. #
  32. # perl fhem.pl configDB
  33. #
  34. # and remove/comment the above line including fhem.cfg
  35. RETVAL=$?
  36. ;;
  37. 'stop')
  38. echo "Stopping fhem..."
  39. # if you want to stop hmland during fhem stop:
  40. # pkill hmland
  41. pkill -U fhem perl
  42. RETVAL=$?
  43. ;;
  44. 'status')
  45. cnt=`ps -ef | grep "fhem.pl" | grep -v grep | wc -l`
  46. if [ "$cnt" -eq "0" ] ; then
  47. echo "fhem is not running"
  48. else
  49. echo "fhem is running"
  50. fi
  51. ;;
  52. *)
  53. echo "Usage: $0 { start | stop | status }"
  54. RETVAL=1
  55. ;;
  56. esac
  57. exit $RETVAL