[Casper] Grep(?) or other method for a logged on user.
Thomas Larkin
tlarki at kckps.org
Thu May 7 12:03:18 PDT 2009
Are these accounts local or part of a directory?
This could be easily done a few different ways. First and foremost I
suggest anyone who manages Macs to keep their local admin accounts
hidden, in like /private/var for example. That way it keeps them out of
the /Users directory. Then all of your policies in place for your
managed users can loop through the /users directory. Since the admin
accounts won't be there you won't loop them out at all.
I kind of just came up with a quick way to do this, probably not that
efficient and someone who is a better script writer may want to try it.
#!/bin/bash
#get current user logged in
current_user=finger -lp | grep Directory | cut -c 19-40
#now loop through users
for i in `ls /Users`
do
if [[ $i == $current_user ]]
then jamf policy -trigger MyPolicy
else echo "not in /Users"
fi
exit
done
This was written very quick and you may want to write it a better way.
That is where I would start though.
___________________________
Thomas Larkin
TIS Department
KCKPS USD500
tlarki at kckps.org
blackberry: 913-449-7589
office: 913-627-0351
>>> Matt Oclassen <moclassen at salesforce.com> 05/07/09 1:32 PM >>>
Hello,
I was looking for a command that I could use to verify that a user is
logged onto their machine before a policy is run (as opposed to a
machine being on, but sitting at the login screen)
I want to make sure that they are logged in so they are sure to get the
messaging that this policy has run.
I am imagining something like the following:
If any user is logged in (except for our 2 admin accounts whose name I
can specify)
Execute jamf policy –trigger “custom trigger”
Else quit.
Does anyone have an idea on the scripting for this?
Thanks very much,
Matt Oclassen
Desktop Systems Specialist
sales
force.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://list.jamfsoftware.com/pipermail/casper/attachments/20090507/aef74c58/attachment.html
More information about the Casper
mailing list