Extension Attribute - check to make sure a user (any user) is logged in
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Posted on 11-02-2010 02:44 PM
We have a policy that we want to kick in when a user (any user) is logged on. What's the best way to leverage Extension Attributes to check if a user is logged in?
Thanks,
Don
https://donmontalvo.com

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Posted on 11-02-2010 02:52 PM
I would do a script, grab the current user by checking ownership of the /dev/console. If a computer is at the login Window root will own the console if a user is logged in they will own the console.
so,
#!/bin/bash
# current user check
currentUser=ls -l /dev/console | awk '{ print $3 }'
if [[ $currentUser != root ]]
then jamf policy -trigger mypolicy
else echo "system is at the loginwindow"
fi
exit 0

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Posted on 11-02-2010 09:27 PM
You could probably use the 'last' command line tool. I believe 'last
On 11/2/10 2:44 PM, "Don Montalvo" <donmontalvo at gmail.com> wrote:
console' would show if anyone's currently logged in or not.
Wouldn't it be easier to trigger the policy at login, though? What are you
trying to accomplish?
--
William Smith
Technical Analyst
Merrill Communications LLC
(651) 632-1492

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Posted on 07-20-2012 10:16 AM
So what's the best way to combine the login script with the extension attribute? Would it be to call the script at login, and then trigger a policy, at the end of which recon would be run?
