#!/bin/bash echo "Starting..." # Change the name of the script here SCRIPT_NAME="wecker.py" LOG_FILE="wecker.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. Dieses Skript laeuft jede Nacht um drei, # und mit "&>" war die Datei danach jedes Mal leer - was der Wecker am # Vortag gemeldet hat, war morgens nicht mehr nachzulesen. Ausserdem braucht # logrotate den Anhaengemodus: es leert die Datei mit copytruncate, waehrend # der Prozess sie offen haelt. /usr/bin/python3 "$SCRIPT_NAME" >> "$LOG_FILE" 2>&1 &