Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

MacHamman

macrumors newbie
Original poster
Jun 7, 2005
22
0
SW Iowa
Hey everyone, I work for a University and we have a issue that I am stumped on. Students have been complaining about the iMacs we have rebooting after doing updates at the scheduled time during the night. To fix this we thought it would be a good idea to write a shell script to check whether a user is logged into the system and put it into crontab to be run alongside the update scripts. This script would tell the computer to not reboot until the user logs out of the machine.

The problem I am having is which UNIX command to use. The 'users', 'whoami', and 'who' commands keep their values from whomever was logged into the system last and 'finger' says that no one is logged when someone is. So I am wondering is there another command that I could try.

I had another thought of checking if the login window is active, but have been unable to find the command. We are using Kerberos to login to the Windows Active Directory system here on campus. Any help would be appreciated. Thanks

MacHamman
 
The who command *should* work.

You could always process the /var/run/utmp and /var/log/wtmp logs yourself.

Well, the problem is the 'who' command does not clear out the ttyp1 logins from a user. The console logs are cleared, but not the ttyp1.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.