Autor Thema: FHEM auf QNAP TS-110 startet nicht automatisch  (Gelesen 4207 mal)

michael.jansen

  • Gast
FHEM auf QNAP TS-110 startet nicht automatisch
« am: 11 Dezember 2013, 14:40:09 »
Hallo,

ich habe FHEM 5.5 auf meiner Qnap TS-110 installiert, dabei habe ich das Verzeichnis /opt/fhem genutzt. Nun habe ich zwei Probleme, zum einen wenn ich versuche aus dem Wurzelverzeichnis heraus mit /opt/fhem/fhem.pl /opt/fhem/fhem.cfg zu starten erhalte ich folgende Meldung:
"Use of uninitialized value in concatenation (.) or string at /opt/fhem/fhem.pl line 448. "
In der besagten Zeile steht folgendes:
Log 0, "Server started with ".int(keys %defs).
        " defined entities (version $attr{global}{version}, $osuser, pid $$)";

Wenn ich vorher mit cd /opt/fhem in das Verzeichnis Wechsel und dann /opt/fhem/fhem.pl /opt/fhem/fhem.cfg eingebe, funktioniert alles einwandfrei.

Das andere Problem ist der automatische Start wenn das NAS neu gebootet wird. Hier habe ich folgendes gemacht:
in /share/HDA_DATA/.qpkg/Optware liegen die Dateien optstart.sh mit dem Inhalt

#!/bin/sh
# wait for optware init
while ( test -z "$(grep /opt/bin /etc/profile)" ); do sleep 10; done
# get new PATH
source /etc/profile
# Execute all start scripts in /opt/etc/init.d
# executing them in numerical order.
#
for i in /opt/etc/init.d/S??* ;do
  # Ignore dangling symlinks (if any).
  #[ ! -f "$i" ] && continue
  case "$i" in
 *.sh)
  # Source shell script for speed.
  (
  trap - INT QUIT TSTP
  set start
  . $i
  )
   ;;
 *)
  # No sh extension, so fork subprocess.
  $i start
   ;;
 esac
done

und optstop.sh mit dem Inhalt

#!/bin/sh
# Execute all kill scripts in /opt/etc/init.d
# executing them in numerical order.
#
for i in /opt/etc/init.d/K??* ;do
  # Ignore dangling symlinks (if any).
  #[ ! -f "$i" ] && continue
  case "$i" in
 *.sh)
  # Source shell script for speed.
  (
  trap - INT QUIT TSTP
  set stop
  . $i
  )
   ;;
 *)
  # No sh extension, so fork subprocess.
  $i stop
   ;;
 esac
done

Beide sind ausführbar gemacht worden.

Dann habe ich in /etc/init.d die Date Optware.sh mit folgendem Inhalt:

#!/bin/sh

RETVAL=0
QPKG_NAME="Optware"

_exit()
{
    /bin/echo -e "Error: $*"
    /bin/echo
    exit 1
}

# Determine BASE installation location according to smb.conf
BASE=
publicdir=`/sbin/getcfg Public path -f /etc/config/smb.conf`
if [ ! -z $publicdir ] && [ -d $publicdir ];then
        publicdirp1=`/bin/echo $publicdir | /bin/cut -d "/" -f 2`
        publicdirp2=`/bin/echo $publicdir | /bin/cut -d "/" -f 3`
        publicdirp3=`/bin/echo $publicdir | /bin/cut -d "/" -f 4`
        if [ ! -z $publicdirp1 ] && [ ! -z $publicdirp2 ] && [ ! -z $publicdirp3 ]; then
                [ -d "/${publicdirp1}/${publicdirp2}/Public" ] && BASE="/${publicdirp1}/${publicdirp2}"
        fi
fi

# Determine BASE installation location by checking where the Public folder is.
if [ -z $BASE ]; then
        for datadirtest in /share/HDA_DATA /share/HDB_DATA /share/HDC_DATA /share/HDD_DATA /share/MD0_DATA; do
                [ -d $datadirtest/Public ] && BASE="$datadirtest"
        done
fi
if [ -z $BASE ] ; then
        echo "The Public share not found."
        _exit 1
fi
QPKG_DIR=${BASE}/.qpkg/Optware

case "$1" in
  start)
  if [ `/sbin/getcfg ${QPKG_NAME} Enable -u -d FALSE -f /etc/config/qpkg.conf` = UNKNOWN ]; then
        /sbin/setcfg ${QPKG_NAME} Enable TRUE -f /etc/config/qpkg.conf
  elif [ `/sbin/getcfg ${QPKG_NAME} Enable -u -d FALSE -f /etc/config/qpkg.conf` != TRUE ]; then
        _exit  "${QPKG_NAME} is disabled."
  fi

  /bin/echo "Enable Optware/ipkg"
        # sym-link $QPKG_DIR to /opt
        /bin/rm -rf /opt
        /bin/ln -sf $QPKG_DIR /opt
        # determine the architecture
        arch=$(/bin/uname -m)
        #if not x09 then
        if [ "$arch" != "armv5tejl" ]; then
          #sym-link the html dir
          /bin/ln -sf $QPKG_DIR/html /home/httpd/
          #sym-link the management website to /(Q)Web
          [ -d /share/Web ] && WebDir="/share/Web"
          [ -d /share/Qweb ] && WebDir="/share/Qweb"
          [ -d $WebDir/Optware ] || /bin/ln -sf /home/httpd/html/Management $WebDir/Optware
        fi
        # adding Ipkg apps into system path ...
        /bin/cat /etc/profile | /bin/grep "PATH" | /bin/grep "/opt/bin" 1>>/dev/null 2>>/dev/null
        [ $? -ne 0 ] && /bin/echo "export PATH=\$PATH":/opt/bin:/opt/sbin >> /etc/profile
        if [ -x /opt/optstart.sh ]; then
            /opt/optstart.sh
        fi

        # determine the right feed based on cpu type
        case "$(/bin/uname -m)" in
        armv5tejl)
          #X09 architecture
          kmod_feed="http://ipkg.nslu2-linux.org/feeds/optware/tsx09/cross/unstable"
          modelrange="tsx09"
        ;;
        armv5tel)
          #X19 architecture
          kmod_feed="http://ipkg.nslu2-linux.org/feeds/optware/tsx19/cross/unstable"
          modelrange="tsx19"
        ;;
        x86_64)
          #x86 architecture
          kmod_feed=""
          modelrange="ts509"
        ;;
        i686)
          #x86 architecture
          kmod_feed=""
          modelrange="ts509"
        ;;
        *)
         #everyting else
         _exit "Unknown CPU architecture, quitting Optware start"
       ;;
       esac

       [ -z $kmod_feed ] || /bin/echo "src $modelrange $kmod_feed" > /opt/etc/ipkg/$modelrange-kmod.conf
       [ -z $kmod_feed ] || /usr/bin/wget -q $kmod_feed/Packages --spider || /bin/rm -rf /opt/etc/ipkg/$modelrange-kmod.conf

       ;;
  stop)
        /bin/echo "Disable Optware/ipkg"
        if [ -x /opt/optstop.sh ]; then
             /opt/optstop.sh
        fi

        export PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin

        [ -d /share/Web ] && WebDir="/share/Web"
        [ -d /share/Qweb ] && WebDir="/share/Qweb"
        /bin/rm -f $WebDir/Optware

        /bin/sync
        /bin/sleep 1
        ;;
  restart)
        $0 stop
        $0 start
        ;;
  *)
        echo "Usage: $0 {start|stop|restart}"
        exit 1
esac

exit $RETVAL

Und auch unter /opt/etc/init.de die Dateien init_fhem, S30fhem und K10fhem mit dem identischen Inhalt:

#!/bin/sh
# by Matthias Bauer
case "$1" in
 start)
  echo "Starting $0"
  /opt/fhem/fhem.pl /opt/fhem/fhem.cfg
   ;;
 stop)
  echo "Stopping $0"
  /opt/fhem/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

Hat jemand eine Idee?

LG
Michael


buzzmain

  • Gast
Antw:FHEM auf QNAP TS-110 startet nicht automatisch
« Antwort #1 am: 02 Januar 2014, 10:38:59 »
Ich habe auf einem QNAP 420 das selbe Problem.

Hat evtl jemand einen Lösungsvorschlag?


Offline Petrosilius Zwackelmann

  • Full Member
  • ***
  • Beiträge: 166
Antw:FHEM auf QNAP TS-110 startet nicht automatisch
« Antwort #2 am: 06 Januar 2014, 20:14:36 »
Hallo QNAP-Kollegen,
Ich hatte auch Anlaufprobleme, bekam aber im QNAP Forum Hilfe....
Schaut mal hier

http://forum.qnapclub.de/viewtopic.php?f=46&t=25681

Gruß Manuel


Gesendet von meinem iPad mit Tapatalk
FHEM 6 auf RaspPi V3:
HM_LAN / CUNX / HUEBridge /OneWire / Homebridge / SONOS / Harmony

 

decade-submarginal