From faf063d78fbe94e4e9934497dfaeff6e5c7b9da6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?W=C3=B6rsty?= Date: Sat, 3 Mar 2018 14:35:44 +0100 Subject: [PATCH] =?UTF-8?q?Sch=C3=B6nere=20Fehlermeldung=20beim=20Start?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit -Schönere Fehlermeldung beim Start -Logleveldateirechteanpassung --- daemon/daemon | 4 ++++ plugin.cfg | 2 +- prerelease.cfg | 6 +++--- templates/lang/language_de.ini | 2 ++ templates/lang/language_en.ini | 2 ++ webfrontend/html/index.php | 15 ++++++++++++--- webfrontend/htmlauth/bin/daemon.php | 2 +- 7 files changed, 25 insertions(+), 8 deletions(-) diff --git a/daemon/daemon b/daemon/daemon index 73b1d18..74d3b88 100644 --- a/daemon/daemon +++ b/daemon/daemon @@ -119,6 +119,10 @@ case "${1:-''}" in exit 1 else echo "`date` - BLE-Scanner Daemon started" >>$logfile 2>&1 + echo "$output" > /tmp/BLE-Scanner.daemon.pid + chown loxberry /tmp/BLE-Scanner.daemon.pid + chgrp loxberry /tmp/BLE-Scanner.daemon.pid + chmod 660 /tmp/BLE-Scanner.daemon.pid log_daemon_msg "BLE-Scanner Daemon started" "OK" log_end_msg 0 exit 0 diff --git a/plugin.cfg b/plugin.cfg index 4922fea..d9d46b7 100644 --- a/plugin.cfg +++ b/plugin.cfg @@ -10,7 +10,7 @@ NAME=Christian Woerstenfeld EMAIL=git@loxberry.woerstenfeld.de [PLUGIN] -VERSION=v2018.3.3.1 +VERSION=v2018.3.3.2 NAME=BLE-Scanner FOLDER=ble_scanner TITLE=BLE-Scanner diff --git a/prerelease.cfg b/prerelease.cfg index 3dab644..32ac19a 100644 --- a/prerelease.cfg +++ b/prerelease.cfg @@ -6,10 +6,10 @@ # If your plugin offers automatic updates, please enable the following option. # Version of the new release -VERSION=v2018.3.3.1 +VERSION=v2018.3.3.2 # Download URL of the ZIP Archive -ARCHIVEURL=https://github.com/Woersty/LoxBerry-Plugin-BLE-Scanner/archive/v2018.3.3.1.zip +ARCHIVEURL=https://github.com/Woersty/LoxBerry-Plugin-BLE-Scanner/archive/v2018.3.3.2.zip # URL for further information about this release -INFOURL=https://github.com/Woersty/LoxBerry-Plugin-BLE-Scanner/releases/tag/v2018.3.3.1 +INFOURL=https://github.com/Woersty/LoxBerry-Plugin-BLE-Scanner/releases/tag/v2018.3.3.2 diff --git a/templates/lang/language_de.ini b/templates/lang/language_de.ini index 991bcef..34a9ab3 100644 --- a/templates/lang/language_de.ini +++ b/templates/lang/language_de.ini @@ -7,6 +7,8 @@ ERR_SUCCESS_TEMPLATE_NOT_READABLE="Das success Template ist nicht lesbar. Wir m ERR_SAVE_CONFIG_FILE="Kann die Konfiguration nicht speichern." ERR_BUTTON_BACK="Zurück" ERR_NO_CONFIG_FILE="Keine Konfigurationsdatei gefunden." +DEAMON_NOT_YET_RUNNING="Daemon Prozess läuft nicht" +DEAMON_NOT_YET_RUNNING_SUGGESTION="Bitte warte einen Moment. Wenn der Fehler bestehen bleibt, versuche deinen LoxBerry neu zu starten." [LOGGING] LOG_AREA="Protokollierung" diff --git a/templates/lang/language_en.ini b/templates/lang/language_en.ini index ad14af0..483b04a 100644 --- a/templates/lang/language_en.ini +++ b/templates/lang/language_en.ini @@ -10,6 +10,8 @@ ERR_SUCCESS_TEMPLATE_NOT_READABLE="The success template file is not readable. We ERR_SAVE_CONFIG_FILE="Unable to save config file." ERR_BUTTON_BACK="Back" ERR_NO_CONFIG_FILE="No configuration file found. I try to create a default configuration file." +DEAMON_NOT_YET_RUNNING="Daemon process is not running" +DEAMON_NOT_YET_RUNNING_SUGGESTION="Please wait a moment. If the error persists, try to reboot your LoxBerry." [LOGGING] LOG_AREA="Logging" diff --git a/webfrontend/html/index.php b/webfrontend/html/index.php index 30f86c6..ef90bce 100644 --- a/webfrontend/html/index.php +++ b/webfrontend/html/index.php @@ -66,7 +66,7 @@ function debug($message = "", $loglevel = 7) } if ( $loglevel < 4 ) { - #if ( isset($message) && $message != "" ) notify ( LBPPLUGINDIR, $L['CC.MY_NAME'], $message); + #if ( isset($message) && $message != "" ) notify ( LBPPLUGINDIR, $L['BLE.MY_NAME'], $message); } } return; @@ -109,8 +109,17 @@ function convert_tag_format ($value) $client = stream_socket_client("tcp://$daemon_addr:$daemon_port", $errno, $errorMessage); if ($client === false) { - debug( "Error0002: reading tags from Daemon at tcp://$daemon_addr:$daemon_port! Reason:".$errorMessage, 2); - die(json_encode(array("error"=>"Error0002: Problem reading tags from Daemon tcp://$daemon_addr:$daemon_port","result"=>"$errorMessage"))); + + if ( file_exists("/tmp/BLE-Scanner.daemon.pid") ) + { + debug( "Error0002: reading tags from Daemon at tcp://$daemon_addr:$daemon_port! Reason:".$errorMessage, 2); + die(json_encode(array("error"=>"Error0002: Problem reading tags from Daemon tcp://$daemon_addr:$daemon_port","result"=>"$errorMessage"))); + } + else + { + debug( $L['ERRORS.DEAMON_NOT_YET_RUNNING'], 4); + die(json_encode(array("error"=>$L['ERRORS.DEAMON_NOT_YET_RUNNING'],"result"=>$L['ERRORS.DEAMON_NOT_YET_RUNNING_SUGGESTION']))); + } } else { diff --git a/webfrontend/htmlauth/bin/daemon.php b/webfrontend/htmlauth/bin/daemon.php index 99b1a44..0fc4568 100644 --- a/webfrontend/htmlauth/bin/daemon.php +++ b/webfrontend/htmlauth/bin/daemon.php @@ -22,7 +22,7 @@ $max_wait_python = 3; // Maximum time in seconds to wait for first results after BLE scan start file_put_contents("/tmp/BLE-Scanner.loglevel", 3); // Enable loglevel changes on the fly and in Python -chmod("/tmp/BLE-Scanner.loglevel", 666); +chmod("/tmp/BLE-Scanner.loglevel", 0660); chown("/tmp/BLE-Scanner.loglevel", "loxberry"); chgrp("/tmp/BLE-Scanner.loglevel", "loxberry");