|
|
(3 dazwischenliegende Versionen von 3 Benutzern werden nicht angezeigt) |
Zeile 1: |
Zeile 1: |
| As I have been searching for such script for a while, I'd like to insert it here for other's convenience.
| | #WEITERLEITUNG [[Kategorie:Linux Initscript]] |
| | |
| Provided for SuSE 11.4 but of course easily to adapt to other distributions.
| |
| | |
| <nowiki>#! /bin/sh
| |
| # Copyright (c) 2011 Wolfram Plettscher
| |
| # All rights reserved
| |
| #
| |
| # Author: Wolfram Plettscher, 2011
| |
| #
| |
| # /etc/init.d/fhem
| |
| #
| |
| ### BEGIN INIT INFO
| |
| # Provides: fhem
| |
| # Required-Start:
| |
| # Required-Stop:
| |
| # Default-Start: 3 5
| |
| # Default-Stop: 0 1 2 6
| |
| # Short-Description: starts FHEM house automation server
| |
| # Description: during start it also reconfigures /dev/ttyACM0 to rwrwrw rights
| |
| # (this is hardcoded for busware CUL device)
| |
| # Last maintained for SuSE 11.4
| |
| #
| |
| # Installation:
| |
| # - copy this file to /etc/init.d
| |
| # - chmod 744 /etc/init.d/fhem
| |
| # - ln -s /etc/init.d/fhem /sbin/fhem
| |
| # - enable and edit in YAST system services
| |
| ### END INIT INFO
| |
|
| |
| case "$1" in
| |
| start)
| |
| echo "Start $0"
| |
| chmod 666 /dev/ttyACM0
| |
| /usr/bin/fhem.pl /etc/fhem.cfg
| |
|  ;;
| |
| stop)
| |
| echo "Stop $0"
| |
| /usr/bin/fhem.pl 7072 shutdown
| |
|  ;;
| |
| status)
| |
| cnt=`ps -ef | grep "fhem.pl" | grep -v grep | wc -l`
| |
| if [ "$cnt" -eq "0" ] ; then
| |
| echo "$0 is not running"
| |
| else
| |
| echo "$0 is running"
| |
| fi
| |
|  ;;
| |
| *)
| |
| echo "Usage: $0 {start|stop|status}"
| |
| exit 1
| |
| esac
| |
| exit 0</nowiki>
| |
| Insipired by [http://fhemwiki.de/index.php/Qnap_NAS http://fhemwiki.de/index.php/Qnap_NAS]
| |
| Thanks to ThostenS
| |
| | |
| Wolfram May 5th, 2011
| |