#!/bin/bash set -e echo "=== Telegram Expiry Notifier — Setup ===" DIR="/home/player/telegram-notif" PORT=8080 SERVICE="telegram-notif" # 1. Install PHP + curl echo "[1/4] Installing PHP + php-curl..." sudo apt update -qq sudo apt install -y -qq php-cli php-curl curl 2>/dev/null # 2. Create directory echo "[2/4] Creating directory..." mkdir -p "$DIR" # 3. Copy files (run this script from the same dir as the PHP files) echo "[3/4] Copying files..." SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)" cp "$SCRIPT_DIR/notify-expire.php" "$DIR/" cp "$SCRIPT_DIR/telegram-cb.php" "$DIR/" # 4. Create systemd service echo "[4/4] Creating systemd service..." sudo tee /etc/systemd/system/$SERVICE.service > /dev/null <