I'd like to perform selective shutdown of a server in my house after backing-up over SSH. My post-backup script waits for five minutes and then runs a very short 'safe shutdown' script located on the server. This script was using
who -q to get the number of users logged on, however as I started executing this script non-interactively, i.e. using
ssh user@server /home/common/bin/SafeShutdown.sh (well actually using PuTTY's plink right now but should make no difference), the user count being found was 0 if no interactive users were present. How can I either get who/w to work with non-interactive logins, or else use another method as an unpriveliged user to count how many people are logged on in any way, shape or form?