first commit
This commit is contained in:
29
systemd/news-agent.service
Normal file
29
systemd/news-agent.service
Normal file
@@ -0,0 +1,29 @@
|
||||
[Unit]
|
||||
Description=News Agent - Daily Tech News Aggregator
|
||||
After=network-online.target
|
||||
Wants=network-online.target
|
||||
|
||||
[Service]
|
||||
Type=oneshot
|
||||
User=%u
|
||||
WorkingDirectory=/home/%u/news-agent
|
||||
Environment="PATH=/home/%u/news-agent/.venv/bin:/usr/local/bin:/usr/bin"
|
||||
|
||||
# Run the news agent
|
||||
ExecStart=/home/%u/news-agent/.venv/bin/python -m src.main
|
||||
|
||||
# Logging
|
||||
StandardOutput=journal
|
||||
StandardError=journal
|
||||
SyslogIdentifier=news-agent
|
||||
|
||||
# Resource limits
|
||||
MemoryLimit=512M
|
||||
CPUQuota=50%
|
||||
|
||||
# Restart policy (only on failure)
|
||||
Restart=on-failure
|
||||
RestartSec=5min
|
||||
|
||||
[Install]
|
||||
WantedBy=default.target
|
||||
15
systemd/news-agent.timer
Normal file
15
systemd/news-agent.timer
Normal file
@@ -0,0 +1,15 @@
|
||||
[Unit]
|
||||
Description=News Agent Daily Timer
|
||||
Requires=news-agent.service
|
||||
|
||||
[Timer]
|
||||
# Run daily at 07:00 Europe/Oslo time
|
||||
OnCalendar=07:00
|
||||
Persistent=true
|
||||
|
||||
# If system was off at trigger time, run on next boot
|
||||
# but wait 5 minutes after system is up
|
||||
OnBootSec=5min
|
||||
|
||||
[Install]
|
||||
WantedBy=timers.target
|
||||
Reference in New Issue
Block a user