Is there a command to reboot a machine whenever the next time that there are no current users logged in occur?
Currently, I have to SSH to machines and use the "w" command to see the users logged in so I know if its okay to reboot or not. If there is a user logged in, I simply can’t reboot because they might have unsaved work left on their Linux box, which is often the case. This can come very time consuming when I have to SSH to the same machine multiple times a week waiting for a time when there are no users logged in.
To make this really simple, I need the following.
A command that will reboot the computer when no users are currently logged in.