| 12345678910111213141516171819202122232425262728293031 |
- [Unit]
- Description=BamBuddy Print Archive
- After=network.target
- [Service]
- Type=simple
- User=claude
- Group=claude
- WorkingDirectory=<dir>/bambuddy
- Environment="PATH=<dir/bambuddy/venv/bin"
- # Force kill after 10 seconds if graceful shutdown fails
- TimeoutStopSec=10
- # Kill any zombie ffmpeg processes before starting/after stopping
- ExecStartPre=-/usr/bin/pkill -9 ffmpeg
- ExecStopPost=-/usr/bin/pkill -9 ffmpeg
- # Ensure directories exist and have correct permissions before starting
- # The + prefix runs the command as root even though User=claude
- ExecStartPre=+/bin/mkdir -p <dir>/bambuddy/logs
- ExecStartPre=+/bin/mkdir -p <dir>/bambuddy/archive
- ExecStartPre=+/bin/chown -R <user>:<user> <dir>/bambuddy/logs
- ExecStartPre=+/bin/chown -R <user>:<user> <dir>/bambuddy/archive
- ExecStart=<dir>/bambuddy/venv/bin/uvicorn backend.app.main:app --host 0.0.0.0 --port 8000
- Restart=always
- RestartSec=10
- [Install]
- WantedBy=multi-user.target
|