Add systemd units to run actions and homelab

This commit is contained in:
2025-09-24 23:03:40 -05:00
parent b66697d924
commit 2bf9ef29ac
2 changed files with 36 additions and 0 deletions

20
homelab.service Normal file
View File

@@ -0,0 +1,20 @@
[Unit]
Description=Homelab services
Requires=docker.service
After=docker.service
[Service]
Restart=always
User=root
Group=docker
TimeoutStopSec=15
WorkingDirectory=/home/matthew/homelab
# Shutdown container (if running) when unit is started
ExecStartPre=/usr/bin/docker compose -f docker-compose.yaml down
# Start container when unit is started
ExecStart=/usr/bin/docker compose -f docker-compose.yaml up
# Stop container when unit is stopped
ExecStop=/usr/bin/docker compose -f docker-compose.yaml down
[Install]
WantedBy=multi-user.target