User Login Issues

Discussion in 'Mac Programming' started by MacHamman, Jan 4, 2007.

  1. macrumors newbie

    MacHamman

    Joined:
    Jun 7, 2005
    Location:
    SW Iowa
    #1
    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
     
  2. macrumors 603

    jeremy.king

    Joined:
    Jul 23, 2002
    Location:
    Fuquay Varina, NC
    #2
    The who command *should* work.

    You could always process the /var/run/utmp and /var/log/wtmp logs yourself.
     
  3. thread starter macrumors newbie

    MacHamman

    Joined:
    Jun 7, 2005
    Location:
    SW Iowa
    #3
    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.
     

Share This Page