Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- sudo nano /etc/systemd/system/oneshot-web.service
- [Unit]
- Description=Oneshot Archive PHP Web Server
- After=network.target
- [Service]
- WorkingDirectory=/mnt/sda1/Oneshot Archive
- ExecStart=/usr/bin/php -S 0.0.0.0:8080
- Restart=always
- RestartSec=5
- [Install]
- WantedBy=multi-user.target
- sudo nano /etc/systemd/system/oneshot-scraper.service
- [Unit]
- Description=Oneshot Archive Scraper (single run)
- [Service]
- WorkingDirectory=/mnt/sda1/Oneshot Archive
- ExecStart=/usr/bin/python3 main.py
- sudo nano /etc/systemd/system/oneshot-scraper.timer
- [Unit]
- Description=Run Oneshot scraper every 3 hours
- [Timer]
- OnBootSec=20min
- OnUnitActiveSec=3h
- Persistent=true
- [Install]
- WantedBy=timers.target
- sudo systemctl daemon-reload
- sudo systemctl enable --now oneshot-web.service
- sudo systemctl enable --now oneshot-scraper.timer
- sudo systemctl status oneshot-web.service
- sudo systemctl status oneshot-scraper.timer
- # See scraper logs
- journalctl -u oneshot-scraper.service -f
- # See PHP logs
- journalctl -u oneshot-web.service -f
Advertisement
Add Comment
Please, Sign In to add comment