Linux Initscript: Unterschied zwischen den Versionen

Aus FHEMWiki
Keine Bearbeitungszusammenfassung
K (Interwiki-Link korrigiert)
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.
As I have been searching for such script for a while, I'd like to insert it here for other's convenience.


Provided for SuSE 11.4 but of course easily to adapt to other distributions.
Provided for SuSE 11.4 but can of course easily be adapted to other distributions.


  <nowiki>#! /bin/sh
  <nowiki>#! /bin/sh
Zeile 52: Zeile 52:
  esac
  esac
  exit 0</nowiki>
  exit 0</nowiki>
Insipired by [http://fhemwiki.de/index.php/Qnap_NAS http://fhemwiki.de/index.php/Qnap_NAS]
Insipired by [[Qnap_NAS]]
Thanks to ThostenS
Thanks to ThostenS


Wolfram May 5th, 2011
Wolfram May 5th, 2011
[[Kategorie:Code Snippets]]
[[Kategorie:Code Snippets]]

Version vom 15. Oktober 2013, 14:44 Uhr

As I have been searching for such script for a while, I'd like to insert it here for other's convenience.

Provided for SuSE 11.4 but can of course easily be adapted to other distributions.

#! /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

Insipired by Qnap_NAS Thanks to ThostenS

Wolfram May 5th, 2011