#!/bin/bash

APP_DIR="/home/vaslbott/public_html/vaslbot"
PYTHON="/home/vaslbott/virtualenv/public_html/vaslbot/3.11/bin/python3.11_bin"
LOG="$APP_DIR/logs/watchdog.log"

cd "$APP_DIR" || exit 1

if ! pgrep -f "$APP_DIR/main.py" > /dev/null 2>&1; then
    nohup "$PYTHON" "$APP_DIR/main.py" >> "$APP_DIR/logs/bot.log" 2>&1 &
    echo "$(date '+%Y-%m-%d %H:%M:%S') - Bot started" >> "$LOG"
fi
