feat: add systemd scripts
This commit is contained in:
parent
d265b92f1d
commit
5666b87124
2 changed files with 27 additions and 0 deletions
13
py-dj.service
Normal file
13
py-dj.service
Normal file
|
@ -0,0 +1,13 @@
|
|||
[Unit]
|
||||
Description=Start py-dj FastAPI service
|
||||
After=network.target
|
||||
|
||||
[Service]
|
||||
User=pi
|
||||
WorkingDirectory=/home/pi/py-dj
|
||||
ExecStart=/home/pi/py-dj/start-api.sh
|
||||
Restart=on-failure
|
||||
Environment=PATH=/home/pi/.local/bin:/usr/bin:/bin
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
14
start-api.sh
Executable file
14
start-api.sh
Executable file
|
@ -0,0 +1,14 @@
|
|||
#!/bin/bash
|
||||
set -e
|
||||
|
||||
cd /home/pi/py-dj
|
||||
|
||||
# Pull latest changes
|
||||
git pull
|
||||
|
||||
# Clear the queue directory
|
||||
rm -rf queue/*
|
||||
mkdir -p queue # Ensure it exists
|
||||
|
||||
# Start the API
|
||||
uv run fastapi run
|
Loading…
Add table
Add a link
Reference in a new issue