Comment 5 for bug 875817

Revision history for this message
DAP (akadap) wrote :

This re-clasification is a problem since the "checklogin.sh" script is not actually a part of mythtv. It is a user written script that exists and is maintained only on the mythtv wiki.

Let me give a bit of history of what was attempted to make this work:

The first attempt used 'last | grep "still logged in"' This failed once a month since it relied on a log file that was erased once a month. The first time the computer was turned on at the beginning of the month, the user would login, the log file would get erased, and there was no longer any record of the user being logged in, so mythtv would shut the computer down on them as they were using it.

The second attempt was the command 'w | grep " 0 users"' This failed when a user would use the ctl-alt-Fx command and log in on a different text screen. The problem here is that even though the user would log out, the users count would never decrement. This would leave the computer running forever even after the user logged out since the user count would never go to zero.

The third attempt was the command 'who -q | grep "users=0"'. This worked until the update to 10.10.

I just looked at the ck-list-sessions command. This does not give me a count of the number of users logged in. This command is undocumented, there is no man page or info page. A google search for 'ck-list-sessions' finds plenty of bug reports against it, but as far as I could tell, no documentation. Since it is not clear what this command is reporting, or what it will report when no one is logged in, I'm not clear on how I can use it.

Looking at the man page for utmp, it is clear that who -q will be unreliable for the purpose of determining how many are logged in since it appears both gnome and unity ignore the utmp file.

So I am left with no clear way of determining if anyone is currently logged into the computer. I'd like a solution that would survive OS upgrades so I don't have to keep patching this script.