Auto Rebuilt (#1670)

Create a systemd service that triggers the rebuilding of Dashy whenever changes are made to the configuration file.
This commit is contained in:
spooknik 2023-08-07 14:52:42 +02:00 committed by GitHub
parent 4da3ef9bfd
commit 80ad523a24
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 25 additions and 2 deletions

View File

@ -42,7 +42,7 @@ export NODE_OPTIONS=--max-old-space-size=1000
$STD yarn build $STD yarn build
msg_ok "Installed Dashy" msg_ok "Installed Dashy"
msg_info "Creating Service" msg_info "Creating Services"
cat <<EOF >/etc/systemd/system/dashy.service cat <<EOF >/etc/systemd/system/dashy.service
[Unit] [Unit]
Description=dashy Description=dashy
@ -56,7 +56,30 @@ WantedBy=multi-user.target
EOF EOF
$STD systemctl enable dashy $STD systemctl enable dashy
systemctl start dashy systemctl start dashy
msg_ok "Created Service"
cat > /etc/systemd/system/dashy-rebuild.service << EOF
[Unit]
Description=Rebuild Dashy on Config Changes
[Service]
Type=oneshot
ExecStart=/usr/bin/yarn --cwd=/dashy build
EOF
cat > /etc/systemd/system/dashy-rebuild.path << EOF
[Unit]
Description=Monitor Dashy Config for Changes
[Path]
PathChanged=/dashy/public/conf.yml
[Install]
WantedBy=multi-user.target
EOF
$STD systemctl enable dashy-rebuild
systemctl start dashy-rebuild
msg_ok "Created Services"
motd_ssh motd_ssh
customize customize