#!/bin/bash echo "Starting..." # Change the name of the script here SCRIPT_NAME="wsMQTTbridge.py" LOG_FILE="wsMQTTbridge.log" # Find the process ID of any running instance of the script PID=$(ps aux | grep "$SCRIPT_NAME" | grep -v grep | awk '{print $2}') # If a running instance was found, kill it if [[ -n "$PID" ]]; then echo "Killing process $PID" kill "$PID" fi # Start the script cd "/volume1/homes/wagner/SolarManager/" # Angehaengt statt ueberschrieben: logrotate leert diese Datei mit # copytruncate, waehrend der Prozess sie offen haelt. Ohne Anhaengemodus # schriebe er danach an seiner alten Stelle weiter, und die Datei bekaeme ein # Loch aus Nullbytes in der Groesse des bisherigen Inhalts. /usr/bin/python3 "$SCRIPT_NAME" >> "$LOG_FILE" 2>&1 &