Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Cannot Execute when trying to change IDLEOUT time

Status
Not open for further replies.
Mar 5, 2003
53
US
Does anyone know why I cannot execute changes to the script I created to log users out automatically after 2 hours?
 
I presume you have IDLETIME=120 in /etc/default/idleout

to change type in command

idleout new_idleout_time
 
Log in and wait 120 minutes, see what happens. ;-)

ps -fp `cat /var/spool/lock/LCK..idleout` will tell you whether it's running.

You could make your own copy of /usr/bin/idleout and modify it, putting the following at line 181:

[tt]GREPFILE=/tmp/grep$$
awk -F: '$1 == "groupname" {print $4}' /etc/group | tr ',' '^J' > $GREPFILE[/tt]

"^J" is actually one control character; enter it in vi by typing Ctrl-V Ctrl-J while in insert mode. Change the previous line 181 to read:

[tt]LANG=C who -u | grep -f $GREPFILE > $TMPFILE[/tt]

And change the previous line 193 to read:

[tt]rm $TMPFILE $GREPFILE[/tt]

It's not foolproof, but it's a start. The first part creates a file containing the names of all members of "groupname", which of course should be changed to the group you want to use.

The second part filters only users that are in that group out of the who -u output. Annihilannic.
 
In retrospect, I forgot to account for users' primary groups in /etc/passwd... Annihilannic.
 
After the awk command mentioned above add this one to take account of the users' primary groups:

[tt]awk -F: '$4 == 123 { print $1}' /etc/passwd >> $GREPFILE[/tt]

Where 123 is the GID of the group in question. I've not tested any of this! Annihilannic.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top