management scripts

This commit is contained in:
Maximilian Schneider 2023-12-28 22:38:54 +01:00
parent 76ce75a523
commit 21dbe7ab29
4 changed files with 38 additions and 0 deletions

7
scripts/ctl.sh Executable file
View File

@ -0,0 +1,7 @@
#!/bin/bash
for config in ./env/*.sh
do
asset=$(basename "$config" .sh)
systemctl $1 raven-taker-$asset
done

9
scripts/install.sh Executable file
View File

@ -0,0 +1,9 @@
#!/bin/bash
for config in ./env/*.sh
do
asset=$(basename "$config" .sh)
[[ $asset == "_shared" ]] && continue
./scripts/service-template.sh $asset >/lib/systemd/system/raven-taker-$asset.service
systemctl enable raven-taker-$asset
done

5
scripts/raven-taker.sh Executable file
View File

@ -0,0 +1,5 @@
#!/bin/bash
source ~/.nvm/nvm.sh
source env.sh
source env/$1.sh
yarn ts-node src/taker.ts

17
scripts/service-template.sh Executable file
View File

@ -0,0 +1,17 @@
#!/bin/sh
cat << EOF
[Unit]
Description=raven taker $1
After=network.target
[Service]
User=max
ExecStart=$PWD/scripts/raven-taker.sh $1
WorkingDirectory=$PWD
Restart=on-failure
RestartSec=60
[Install]
WantedBy=multi-user.target
EOF