Shell script /usr/bin/checklogin .sh has to be updated

For discussion of topics specific to MythTV on linux
Post Reply
abrogle
Newcomer
Posts: 2
Joined: Fri Jan 03, 2025 10:04 pm
Germany

Shell script /usr/bin/checklogin .sh has to be updated

Post by abrogle »

Hello,
Debian doesn't create /var/run/utmp anymore.
The command "who" can't work longer.

USERS=`who -q | tail -n 1 | sed 's/[a-z #]*=//'`

Replacement of the line above with the line below does the job for me.

USERS=`loginctl list-users | tail -n 1 | cut -c 1`

Greetings, Andreas :)
User avatar
bill6502
Developer
Posts: 2439
Joined: Fri Feb 07, 2014 5:28 pm
United States of America

Re: Shell script /usr/bin/checklogin .sh has to be updated

Post by bill6502 »

Hi,

I did update the 2 Wiki pages that include the script. But only to add a comment about
loginctl as I'ts not clear that that exists in all linux distributions. For example:
https://www.mythtv.org/wiki/ACPI_Wakeup#Desktop_users
abrogle
Newcomer
Posts: 2
Joined: Fri Jan 03, 2025 10:04 pm
Germany

Re: Shell script /usr/bin/checklogin .sh has to be updated

Post by abrogle »

Thanks,

I have forgotten to mention loginctl doesn't return zero, instead it returns something like "No one is logged in".
So we have to change the line
if [ "$USERS" == "0" ] && [ "$XFCE_PROCS" == "" ]; then
to
if [ "$USERS" == "N" ] && [ "$XFCE_PROCS" == "" ]; then
Post Reply