Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!


Click here to return to the 'Log out background users after time limit' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
Log out background users after time limit
Authored by: Azur Logix on Aug 30, '10 03:24:06PM

I put this in /Library/LaunchAgents but I'm guessing I must not have properly integrated your code into the above hints code.

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Label</key>
<string>com.global.backgroundUserLogout</string>
<key>ProgramArguments</key>
<array>
<string>/bin/bash</string>
<string>-c</string>
<string>if [ $(id $UID | grep "80(admin)") = "" ]; then logouttime=60; else logouttime=1440; fi; if [ $(stat -f %u /dev/console) == $UID ]; then if [ -e /tmp/backgroundUserLogout.$UID ]; then rm /tmp/backgroundUserLogout.$UID; fi; elif [ ! -e /tmp/backgroundUserLogout.$UID ]; then touch /tmp/backgroundUserLogout.$UID; elif [ $(( <code>date +%s</code> - <code>stat -f %m /tmp/backgroundUserLogout.$UID || printf 0</code> )) -ge $logouttime ]; then rm /tmp/backgroundUserLogout.$UID; osascript -e ‘tell application “System Events” to log out’; fi</string>
</array>
<key>RunAtLoad</key>
<true/>
<key>StartInterval</key>
<integer>60</integer>
</dict>
</plist>



[ Reply to This | # ]