#!/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/" /usr/bin/python3 "$SCRIPT_NAME" &> "$LOG_FILE" &