Skip to content

Commit

Permalink
fix(node-monitor): make sure it's really stopped
Browse files Browse the repository at this point in the history
Prevent this error on some machines:

 Failed to disable unit: Unit file node-monitor.service does not exist.

The error is likely caused by a race condition
  • Loading branch information
gsanchietti committed Feb 28, 2025
1 parent 91eda66 commit 65450c9
Showing 1 changed file with 14 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,20 @@ set -e

if systemctl -q is-active node-monitor.service; then
echo "Disabling node-monitor as service"
systemctl stop node-monitor
# Wait until node-monitor is really stopped, maximum wait time 1 minute
for i in {1..60}; do
if ! systemctl -q is-active node-monitor; then
echo "node-monitor is stopped"
break
fi
sleep 1
done
if systemctl -q is-active node-monitor; then
echo "Failed to stop node-monitor within 1 minute"
exit 1
fi
systemctl disable --now node-monitor
rm -f /etc/systemd/system/node-monitor.service
rm -fv etc/systemd/system/node-monitor.service
systemctl daemon-reload
fi

0 comments on commit 65450c9

Please sign in to comment.