Add systemd user service

This commit is contained in:
maybetree
2025-08-07 11:15:11 +02:00
parent 289d4fbb85
commit 8b5f80bceb
4 changed files with 30 additions and 2 deletions

15
bardak.service Normal file
View File

@ -0,0 +1,15 @@
[Unit]
Description=Bardak inventory webapp
[Service]
Type=simple
#User=
#Group=
WorkingDirectory=/home/maybetree/srv/klankschool-bardak
ExecStart=./run.sh
Restart=on-failure
StandardOutput=file:%h/log_file
[Install]
WantedBy=default.target

View File

@ -1,5 +1,7 @@
#!/bin/sh #!/bin/sh
set -e
git submodule init git submodule init
git submodule update --recursive git submodule update --recursive

3
enable-user-service.sh Normal file
View File

@ -0,0 +1,3 @@
#!/bin/sh
systemctl --user enable bardak.service

12
run.sh
View File

@ -1,8 +1,16 @@
#!/bin/sh #!/bin/sh
set -e
mkdir -p ./data/things mkdir -p ./data/things
mkdir -p ./data/trash mkdir -p ./data/trash
if [ -z "$(podman images -q gateau-cuda11)" ]
then
echo "Container missing, building..."
./build.sh
fi
podman run \ podman run \
--name bardak \ --name bardak \
--init \ --init \
@ -10,8 +18,8 @@ podman run \
-v ./data/things:/app/things \ -v ./data/things:/app/things \
-v ./data/trash:/app/trash \ -v ./data/trash:/app/trash \
--publish 8085:8085 \ --publish 8085:8085 \
--detach \ `#--detach` \
--restart=always \ `#--restart=always` \
--replace \ --replace \
bardak bardak