scraper.service
1 # systemd service file for News Scraper Daemon 2 # 3 # Installation: 4 # 1. Copy this file to /etc/systemd/system/news-scraper.service 5 # 2. Edit the file to set correct paths and user 6 # 3. Run: sudo systemctl daemon-reload 7 # 4. Run: sudo systemctl enable news-scraper 8 # 5. Run: sudo systemctl start news-scraper 9 # 10 # Commands: 11 # sudo systemctl status news-scraper # Check status 12 # sudo systemctl stop news-scraper # Stop daemon 13 # sudo systemctl restart news-scraper # Restart daemon 14 # journalctl -u news-scraper -f # View logs 15 16 [Unit] 17 Description=Hong Kong Fire Documentary News Scraper Daemon 18 After=network-online.target 19 Wants=network-online.target 20 21 [Service] 22 Type=simple 23 User=YOUR_USERNAME 24 Group=YOUR_USERNAME 25 26 # Set the working directory to the repo root 27 WorkingDirectory=/home/YOUR_USERNAME/Hong-Kong-Fire-Documentary 28 29 # Load environment variables from file (recommended - more secure) 30 # This file should contain: 31 # GITHUB_TOKEN=your_token_here 32 # FORK_REPO=username/repo-name 33 EnvironmentFile=/home/YOUR_USERNAME/.scraper_env 34 35 # Run the daemon 36 ExecStart=/usr/bin/python3 /home/YOUR_USERNAME/Hong-Kong-Fire-Documentary/scripts/scraper/daemon.py 37 38 # Restart on failure 39 Restart=on-failure 40 RestartSec=30 41 42 # Logging 43 StandardOutput=journal 44 StandardError=journal 45 46 [Install] 47 WantedBy=multi-user.target 48