From 80ad523a248138b3067b78bf6b8a57eb4c41ba21 Mon Sep 17 00:00:00 2001 From: spooknik <40317809+spooknik@users.noreply.github.com> Date: Mon, 7 Aug 2023 14:52:42 +0200 Subject: [PATCH] Auto Rebuilt (#1670) Create a systemd service that triggers the rebuilding of Dashy whenever changes are made to the configuration file. --- install/dashy-install.sh | 27 +++++++++++++++++++++++++-- 1 file changed, 25 insertions(+), 2 deletions(-) diff --git a/install/dashy-install.sh b/install/dashy-install.sh index 44d85f86..ef8106be 100644 --- a/install/dashy-install.sh +++ b/install/dashy-install.sh @@ -42,7 +42,7 @@ export NODE_OPTIONS=--max-old-space-size=1000 $STD yarn build msg_ok "Installed Dashy" -msg_info "Creating Service" +msg_info "Creating Services" cat </etc/systemd/system/dashy.service [Unit] Description=dashy @@ -56,7 +56,30 @@ WantedBy=multi-user.target EOF $STD systemctl enable 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 customize