1

Is there an easy way to warn an admin on shutdown, reboot, poweroff, halt, ... about:

  • ongoing computations (high load, high disk io)
  • open bash / zsh / ... terminal sessions
  • other logged in users
  • screen / tmux sessions

I'm looking for a solution that will support admins to not accidentally bin a lot of work.

Setting: Co-operative environment (15 users, all know each other). We use a shared server with multiple users and admins. Many users do long calculations in screen / tmux sessions. Even though admins should know better, it happens from time to time that they reboot the machine and accidentally disturb ongoing work of logged in users.

1 Answers1

1

There's a debian package called molly-guard. It asks you to type in the hostname so you don't accidentally shutdown the wrong machine. By default this is only switched on for SSH connections, but you can set ALWAYS_QUERY_HOSTNAME=true in /etc/molly-guard/rc so it always asks.

Also, to make the admin aware of what's going on, we added the following /etc/molly-guard/run.d/20-own-warning file:

#! /bin/bash

echo
echo "current logins: w:"
w
echo
echo "current logins: who:"
who
echo
echo "current open terminals: ps aux | grep -E '(bash)|(zsh)'"
ps aux | grep -E '(bash)|(zsh)'
echo
echo
echo "Before shutdown/reboot, please contact all of the above users!!!"
echo

exit 0