-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy pathkraken-bot.service
More file actions
33 lines (29 loc) · 1.02 KB
/
kraken-bot.service
File metadata and controls
33 lines (29 loc) · 1.02 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
[Unit]
Description=Kraken Trading Bot
After=network-online.target
Wants=network-online.target
# Stop restarting after 5 failures within 5 minutes (prevents CPU-thrashing on persistent bugs)
StartLimitIntervalSec=300
StartLimitBurst=5
[Service]
Type=simple
User=felix
WorkingDirectory=/home/felix/tradingbot
ExecStart=/home/felix/tradingbot/venv/bin/python /home/felix/tradingbot/main.py
Restart=always
# Longer restart delay avoids CPU-thrashing when Kraken API is down
RestartSec=30
# Raspberry Pi resource protection:
# Bot process is protected from OOM-killer (low score = protected)
OOMScoreAdj=-100
# Hard memory limit; prevents slow memory leaks from consuming all Pi RAM
MemoryMax=400M
# Forward stdout/stderr to journald for easy access via: journalctl -u kraken-bot -f
StandardOutput=journal
StandardError=journal
# Weekly restart to clear any accumulated memory fragmentation
RuntimeMaxSec=604800
# Watchdog: systemd kills + restarts the bot if it stops sending pings within 120s
WatchdogSec=120
[Install]
WantedBy=multi-user.target