remie92

Untitled

Mar 1st, 2026 (edited)
54
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.04 KB | None | 0 0
  1. sudo nano /etc/systemd/system/oneshot-web.service
  2.  
  3. [Unit]
  4. Description=Oneshot Archive PHP Web Server
  5. After=network.target
  6.  
  7. [Service]
  8. WorkingDirectory=/mnt/sda1/Oneshot Archive
  9. ExecStart=/usr/bin/php -S 0.0.0.0:8080
  10. Restart=always
  11. RestartSec=5
  12.  
  13. [Install]
  14. WantedBy=multi-user.target
  15.  
  16. sudo nano /etc/systemd/system/oneshot-scraper.service
  17.  
  18. [Unit]
  19. Description=Oneshot Archive Scraper (single run)
  20.  
  21. [Service]
  22. WorkingDirectory=/mnt/sda1/Oneshot Archive
  23. ExecStart=/usr/bin/python3 main.py
  24.  
  25. sudo nano /etc/systemd/system/oneshot-scraper.timer
  26.  
  27. [Unit]
  28. Description=Run Oneshot scraper every 3 hours
  29.  
  30. [Timer]
  31. OnBootSec=20min
  32. OnUnitActiveSec=3h
  33. Persistent=true
  34.  
  35. [Install]
  36. WantedBy=timers.target
  37.  
  38.  
  39. sudo systemctl daemon-reload
  40. sudo systemctl enable --now oneshot-web.service
  41. sudo systemctl enable --now oneshot-scraper.timer
  42.  
  43.  
  44. sudo systemctl status oneshot-web.service
  45. sudo systemctl status oneshot-scraper.timer
  46.  
  47. # See scraper logs
  48. journalctl -u oneshot-scraper.service -f
  49.  
  50. # See PHP logs
  51. journalctl -u oneshot-web.service -f
Advertisement
Add Comment
Please, Sign In to add comment