Skip to content

Commit

Permalink
Reboot on script update
Browse files Browse the repository at this point in the history
  • Loading branch information
vitalybuka committed Jul 16, 2024
1 parent d81d512 commit 97078a5
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions buildbot/start_script.sh
Original file line number Diff line number Diff line change
Expand Up @@ -150,12 +150,18 @@ function is_worker_connected() {
)
}

function script_needs_update() {
git -C ${SCRIPT_DIR} fetch && ! git -C ${SCRIPT_DIR} diff FETCH_HEAD -- buildbot/
}

function shutdown_maybe() {
[[ $(cat /proc/uptime | grep -oP "^\d+") -lt $((3600*72)) ]] && return
(w -h | wc -l) && return
if ! script_needs_update ; then
[[ $(cat /proc/uptime | grep -oP "^\d+") -lt $((3600*72)) ]] && return
(w -h | wc -l) && return
w -h
cat /proc/uptime
fi
echo "Rebooting..."
w -h
cat /proc/uptime
while sudo pkill -SIGHUP buildbot-worker; do sleep 5; done;
shutdown now
sleep 1000
Expand Down

0 comments on commit 97078a5

Please sign in to comment.