[Casper] Script Help: Logged On user
Ernst, Craig S.
ERNSTCS at uwec.edu
Fri Sep 26 12:03:51 PDT 2008
Wanted to mention that I put in a sleep of 60 before that command to ensure the user was fully logged on, particularly on slow machines...
Have a great weekend.
Craig E
On 9/26/08 1:40 PM, "Ernst, Craig S." <ERNSTCS at uwec.edu> wrote:
I don't want it for every user though, just a particular group of AD users that will be doing laptop check-ins etc for a laptop pool. And this way I can change out the groups, or individuals easily within the scope of the policy. =)
It's ok. Nick from JAMF helped me out a little here with two different versions. Could have just used $3 if the script was being run directly from Casper stuffs, which I already knew wouldn't work.
username=`/usr/bin/w | grep console | awk '{print $1}'`
OR
username=`/usr/bin/last -1 | grep awk '{print $1}'`
However, I had to make sure that the command in the advanced tab of the JSS policy was backgrounded otherwise the login never completes fully until AFTER the script was running. So I had to have the command in the JSS '/bin/sh /some/file/ondisk.sh &'.
Thanks all!
Craig E
On 9/26/08 1:25 PM, "Thomas Larkin" <tlarki at kckps.org> wrote:
If the script is already on the local machine why not make a lauchd item under /Library/LaunchAgents which will trigger at log in for each user and then just wild card the script out to copy to each user in /Users?
___________________________
Thomas Larkin
TIS Department
KCKPS USD500
tlarki at kckps.org
blackberry: 913-449-7589
office: 913-627-0351
>>> "Ernst, Craig S." <ERNSTCS at uwec.edu> 09/26/08 1:07 PM >>>
I tried $1 earlier because that was everything I had ready online, but that came back with nothing, at least in Leopard. =)
Craig
On 9/26/08 9:56 AM, "Miles Leacy IV" <miles.leacy at gmail.com> wrote:
I don't have my script library with me, but I believe in a bash login
script, $1 returns the short name of the user logging in. It might be
$2 or $3. I really ought to put my scripts on my iDisk. :)
On Fri, Sep 26, 2008 at 10:37 AM, Ernst, Craig S. <ERNSTCS at uwec.edu> wrote:
> This is the dumbest thing, but I need some help with some scripting if
> possible.
>
> I have a policy that calls a shell script that's already local on the box
> (why it has to be local I won't get into here) when a particular set of
> users logs on as defined in the policy. So the advanced tab has a command
> for '/bin/sh /some/file/ondisk.sh'
>
> What I need it to do is copy a file also local on the machine to the Desktop
> of the user that just logged on. I can't just use username=$(whoami) because
> the policy calls the script as root, and it shouldn't copy to root of
> course.
>
> Can someone help? Let me know if you need more clarification. I'm sure this
> should be the simplest thing ever for me to do, but for the life of me...
>
> Thanks,
>
> Craig Ernst
> Systems Management & Configuration
> ----------------------------------
> University of Wisconsin-Eau Claire
> Learning & Technology Services
> 105 Garfield Ave
> Eau Claire, WI 54701
> Phone: (715) 836-3639
> Fax: (715) 836-6001
> ----------------------------------
> ernstcs at uwec.edu
>
> _______________________________________________
> Casper mailing list
> Casper at list.jamfsoftware.com
> http://list.jamfsoftware.com/mailman/listinfo/casper
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://list.jamfsoftware.com/pipermail/casper/attachments/20080926/9a4c744e/attachment.htm
More information about the Casper
mailing list