I haven't tested this, it's just an idea off the top of my head...<div><br></div><div>Given:</div><div>Policies run as root.</div><div>An "open" command run as root won't open the item in another user's session (I believe).<br>
</div><div><br></div><div>Try:</div><div><br></div><div>#!/bin/bash</div><div><br></div><div>if [ `who | grep -c "$3"` -gt 0 ] ; then<br></div><div> su $3</div><div> open /Applications/Utilities/MyApp.app</div>
<div> else echo "No user is logged in"</div><div>fi</div><div><br></div><div>Assuming I have my syntax right (and I'm not at a point in my day where I can test this), this will test to see if $3 is logged in ($3 being the username of the logged-in user as passed by Casper). If $3 is logged in, the script will switch users to $3 from root, then run the open command.</div>
<div><br>----------<br>Miles A. Leacy IV<br><br> Certified System Administrator 10.4<br> Certified Technical Coordinator 10.5<br> Certified Trainer<br>Certified Casper Administrator<br>----------<br>voice: 1-347-277-7321<br>
<a href="mailto:miles.leacy@themacadmin.com">miles.leacy@themacadmin.com</a><br><a href="http://www.themacadmin.com">www.themacadmin.com</a><br><br><br>
<br><br><div class="gmail_quote">2009/2/3 Dagel, Rich <span dir="ltr"><<a href="mailto:Rich.Dagel@landor.com">Rich.Dagel@landor.com</a>></span><br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
<div>
<font face="Verdana, Helvetica, Arial"><span style="font-size:10pt">I am trying to write a script that will open an app once it is installed by a policy. I have to script set to run after but no luck.<br>
<br>
#!/bin/sh<br>
<br>
open /Applications/Utilities/MyApp.app<br>
<br>
<br>
</span><font size="2"><span style="font-size:8pt">Rich Dagel<br>
Senior Technology Specialist<br>
<img src="cid:3316509365_295209"><br>
Landor Associates<br>
1001 Front Street<br>
San Francisco, CA 94111<br>
United States<br>
415 365 3933<br>
<font color="#0000FF"><u><a href="http://www.landor.com" target="_blank">http://www.landor.com</a><br>
</u></font></span></font></font><font size="2"><span style="font-size:8pt"><font color="#0000FF"><u><font face="Lucida Grande CE"><a href="http://Rich.Dagel@landor.com" target="_blank">Rich.Dagel@landor.com</a></font></u></font></span></font><font face="Verdana, Helvetica, Arial"><span style="font-size:10pt"><br>
</span></font>
</div>
<br>_______________________________________________<br>
Casper mailing list<br>
<a href="mailto:Casper@list.jamfsoftware.com">Casper@list.jamfsoftware.com</a><br>
<a href="http://list.jamfsoftware.com/mailman/listinfo/casper" target="_blank">http://list.jamfsoftware.com/mailman/listinfo/casper</a><br>
<br></blockquote></div><br></div>