diff --git a/bin/sudo/mosq_readconfig.sh b/bin/sudo/mosq_readconfig.sh index 40a1c27..ec04173 100644 --- a/bin/sudo/mosq_readconfig.sh +++ b/bin/sudo/mosq_readconfig.sh @@ -1,5 +1,5 @@ #!/bin/bash - +ln -f -s /var/log/mosquitto/mosquitto.log REPLACELBPLOGDIR/ pgrep mosquitto if [ $? -ne 0 ]; then echo "Restarting Mosquitto" diff --git a/bin/sudo/mosq_restart.sh b/bin/sudo/mosq_restart.sh index 79251db..20736c6 100644 --- a/bin/sudo/mosq_restart.sh +++ b/bin/sudo/mosq_restart.sh @@ -1,2 +1,3 @@ #!/bin/bash +ln -f -s /var/log/mosquitto/mosquitto.log REPLACELBPLOGDIR/ systemctl restart mosquitto diff --git a/config/mqtt.json.example b/config/mqtt.json.example index 3d02712..f4eadb5 100644 --- a/config/mqtt.json.example +++ b/config/mqtt.json.example @@ -1 +1,14 @@ -{"Main":{"brokeraddress":"localhost","msno":"1","udpport":"11883","convert_booleans":true,"use_udp":true,"use_http":false,"udpinport":"11883"},"subscriptions":["shellies/#"]} \ No newline at end of file +{ + "Main": { + "brokeraddress": "localhost", + "msno": "1", + "udpport": "11883", + "convert_booleans": true, + "use_udp": true, + "use_http": false, + "udpinport": "11883" + }, + "subscriptions": [ + "shellies/#" + ] +} \ No newline at end of file diff --git a/postupgrade.sh b/postupgrade.sh deleted file mode 100644 index e992274..0000000 --- a/postupgrade.sh +++ /dev/null @@ -1,24 +0,0 @@ -#!/bin/bash - -ARGV0=$0 # Zero argument is shell command -ARGV1=$1 # First argument is temp folder during install -ARGV2=$2 # Second argument is Plugin-Name for scipts etc. -ARGV3=$3 # Third argument is Plugin installation folder -ARGV4=$4 # Forth argument is Plugin version -ARGV5=$5 # Fifth argument is Base folder of LoxBerry - -echo " Copy back existing config files" -cp -p -v -r /tmp/$ARGV1\_upgrade/config/$ARGV3/* $ARGV5/config/plugins/$ARGV3/ - -#echo " Copy back existing log files" -#cp -p -v -r /tmp/$ARGV1\_upgrade/log/$ARGV3/* $ARGV5/log/plugins/$ARGV3/ - -echo " Remove temporary folders" -rm -r /tmp/$ARGV1\_upgrade - -echo " Restarting MQTT Gateway" -cd REPLACELBPBINDIR -REPLACELBPBINDIR/mqttgateway.pl > /dev/null 2>&1 & - -# Exit with Status 0 -exit 0 diff --git a/webfrontend/htmlauth/ajax_brokercred.cgi b/webfrontend/htmlauth/ajax_brokercred.cgi index 33df8c1..91744d3 100644 --- a/webfrontend/htmlauth/ajax_brokercred.cgi +++ b/webfrontend/htmlauth/ajax_brokercred.cgi @@ -120,7 +120,13 @@ sub setcred $mosq_config = "# This file is directly managed by the MQTT-Gateway plugin.\n"; $mosq_config .= "# Do not change this file, as your changes will be lost on saving in the MQTT-Gateway webinterface.\n\n"; - $mosq_config .= "port 1883\n"; + $mosq_config .= "port 1883\n\n"; + $mosq_config .= "# To reduce SD writes, save Mosquitto DB only once a day\n"; + $mosq_config .= "autosave_interval 86400\n\n"; + + ## Not working because of permissions (user mosquitto has no access) + # $mosq_config .= "# Use LoxBerry's Plugin logging directory for Mosquitto logfile\n"; + # $mosq_config .= "log_dest file $lbplogdir/mosquitto.log\n\n"; # User and pass, or anonymous if(!$brokeruser and !$brokerpass) {