<br><font size=2 face="sans-serif">I found this one to work the best for
me</font>
<br>
<br><font size=2 face="sans-serif">username=`/usr/bin/w | grep console
| awk '{print $1}'`</font>
<br>
<br>
<br><font size=2 face="sans-serif">than using variable like this /Users/$username/</font>
<br>
<br>
<br>
<br>
<br><font size=2>D. Trey Howell</font>
<p><font size=2>trey.howell@austinisd.org</font>
<p><font size=2>Desktop Engineering</font>
<p><img src=cid:_2_2911B26C2911B02C0070CCAD862575AF><img src=cid:_2_2911B4642911B02C0070CCAD862575AF><img src=cid:_2_2911B65C2911B02C0070CCAD862575AF><img src=cid:_2_2911B8542911B02C0070CCAD862575AF>
<p><font size=2>This email message, including all attachments, is for the
sole use of the intended recipient(s) and may contain confidential student
and/or employee information. Unauthorized use of disclosure is prohibited
under the federal Family Education Rights & Privacy Act (20 U.S.C.
§1232g, 34 CFR Part 99, 19 TAC 247.2, Gov&#8217, t Code 552.023, Educ.
Code 21.355, 29 CFR 1630.14(b)(c)). If you are not the intended recipient,
you may not use, disclose, copy or disseminate this information. Please
call the sender immediately or reply by email and destroy all copies of
the original message, including attachments.</font>
<p><font size=2> </font><font size=2 face="sans-serif"><br>
</font>
<br>
<br>
<br>
<table width=100%>
<tr valign=top>
<td width=40%><font size=1 face="sans-serif"><b>"Thomas Larkin"
<tlarki@kckps.org></b></font>
<br><font size=1 face="sans-serif"> </font>
<br><font size=1 face="sans-serif">Sent by: casper-bounces@list.jamfsoftware.com</font>
<p><font size=1 face="sans-serif">05/07/09 02:03 PM</font>
<td width=59%>
<table width=100%>
<tr valign=top>
<td>
<div align=right><font size=1 face="sans-serif">To</font></div>
<td><font size=1 face="sans-serif">"casper@list.jamfsoftware.com"
<casper@list.jamfsoftware.com>, "Matt Oclassen" <moclassen@salesforce.com></font>
<tr valign=top>
<td>
<div align=right><font size=1 face="sans-serif">cc</font></div>
<td>
<tr valign=top>
<td>
<div align=right><font size=1 face="sans-serif">Subject</font></div>
<td><font size=1 face="sans-serif">Re: [Casper] Grep(?) or other method
for a logged on user.</font></table>
<br>
<table>
<tr valign=top>
<td>
<td></table>
<br></table>
<br>
<br>
<br><font size=3 face="Lucida Grande">Are these accounts local or part
of a directory?</font><font size=3> </font>
<br>
<br><font size=3 face="Lucida Grande">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.</font><font size=3> </font>
<p>
<br><font size=3 face="Lucida Grande">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.</font><font size=3> </font>
<p>
<br><font size=3 face="Lucida Grande">#!/bin/bash</font><font size=3> </font>
<p>
<br><font size=3 face="Lucida Grande">#get current user logged in</font><font size=3>
</font>
<p>
<br><font size=3 face="Lucida Grande">current_user=finger -lp | grep Directory
| cut -c 19-40</font><font size=3> </font>
<p>
<br><font size=3 face="Lucida Grande">#now loop through users</font><font size=3>
</font>
<p>
<br><font size=3 face="Lucida Grande">for i in `ls /Users`</font><font size=3>
</font>
<p>
<br><font size=3 face="Lucida Grande">do</font><font size=3> </font>
<p>
<br><font size=3 face="Lucida Grande">if [[ $i == $current_user ]]</font><font size=3>
</font>
<p>
<br><font size=3 face="Lucida Grande">then jamf policy -trigger MyPolicy</font><font size=3>
</font>
<p>
<br><font size=3 face="Lucida Grande">else echo "not in /Users"</font><font size=3>
</font>
<p>
<br><font size=3 face="Lucida Grande">fi</font><font size=3> </font>
<p>
<br><font size=3 face="Lucida Grande">exit</font><font size=3> </font>
<br><font size=3 face="Lucida Grande">done</font><font size=3> </font>
<p>
<br><font size=3 face="Lucida Grande">This was written very quick and you
may want to write it a better way. That is where I would start though.</font><font size=3><br>
<br>
<br>
___________________________<br>
Thomas Larkin<br>
TIS Department<br>
KCKPS USD500</font><font size=3 color=blue><u><br>
</u></font><a href=mailto:tlarki@kckps.org><font size=3 color=blue><u>tlarki@kckps.org</u></font></a><font size=3><br>
blackberry: 913-449-7589<br>
office: 913-627-0351<br>
<br>
<br>
<br>
<br>
<br>
>>> Matt Oclassen <moclassen@salesforce.com> 05/07/09 1:32
PM >>></font>
<br><font size=2>Hello,<br>
<br>
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)<br>
<br>
I want to make sure that they are logged in so they are sure to get the
messaging that this policy has run.<br>
<br>
I am imagining something like the following:<br>
<br>
If any user is logged in (except for our 2 admin accounts whose name I
can specify)<br>
<br>
Execute jamf policy –trigger “custom trigger”<br>
<br>
Else quit.<br>
<br>
Does anyone have an idea on the scripting for this?<br>
<br>
Thanks very much,<br>
Matt Oclassen<br>
<br>
Desktop Systems Specialist</font>
<br><font size=5>sales </font>
<br><font size=5 color=red>force</font><font size=5 color=#000080>.</font><font size=5 color=#808080>com</font>
<br><font size=2><br>
<br>
</font><tt><font size=2>_______________________________________________<br>
Casper mailing list<br>
Casper@list.jamfsoftware.com<br>
</font></tt><a href=http://list.jamfsoftware.com/mailman/listinfo/casper><tt><font size=2>http://list.jamfsoftware.com/mailman/listinfo/casper<br>
</font></tt></a>
<br>