[Casper] Flushing User Caches

Thomas Larkin tlarki at kckps.org
Wed Jan 21 13:42:56 PST 2009


Yeah, the tidal can be a weird thing when it comes to syntax which I
have found out the hard way.  You can create a variable and that seems
to do it.

I would write the script like this personally:

#!/bin/sh

#go through user's home folder and get rid of cache files

home=~
file="   
        $home/Library/Cookies/*
        $home/Library/Safari/*
        $home/Library/Caches/Metadata/Safari/*
        $home/Library/Preferences/com.apple.Safari.plist
        $home/Library/Preferences/com.apple.Safari.RSS.plist
      "

for file in $file

   do

   if  [[ -e $file ]]

   then 

         rm -rf $file

   else 0

        echo "no file found"

done
exit

Of course I haven't quite tested it and you may need to tweak it, but
that is a quick and non tested version of what I would attempt at
doing.
 
 

___________________________
Thomas Larkin
TIS Department
KCKPS USD500
tlarki at kckps.org
blackberry:  913-449-7589
office:  913-627-0351





>>> Miles Leacy <miles.leacy at themacadmin.com> 01/21/09 3:30 PM >>> 
I see two problems with your script...

1. I don't believe "~" will work in your script since it's run by root.
 I
use the Casper variables to indicate "the home folder of the account
logged
in (or being logged in).  See my commands below.
2. If your clients are Leopard clients, you won't find anything at
~/Library/Caches/Safari/.  See below for the locations to be concerned
with.

If you want to emulate the "Reset Safari" menu item put this in your
script
instead:

m -Rf /Users/$3/Library/Cookies/*
m -Rf /Users/$3/Library/Safari/*
rm -Rf /Users/$3/Library/Caches/Metadata/Safari/*
rm -f /Users/$3/Library/Preferences/com.apple.Safari.plist
rm -f /Users/$3/Library/Preferences/com.apple.Safari.RSS.plist

You will, of course, need to reset any preferences you did want in
there
such as a default home page.  You can do this with "defaults write" or
"PlistBuddy" at the end of your script.

----------
Miles A. Leacy IV

 Certified System Administrator 10.4
 Certified Technical Coordinator 10.5
 Certified Trainer
Certified Casper Administrator
----------
voice: 1-347-277-7321
miles.leacy at themacadmin.com
www.themacadmin.com




On Wed, Jan 21, 2009 at 3:58 PM, Gene Anderson <ganderson at phrd.ab.ca>
wrote:

> "Thomas Larkin" <tlarki at kckps.org> writes:
> >What you can do is have a policy set for log in via JSS web front
end and
> have it execute the script.  Can you post your script?
>
> rm -Rf ~/Library/Caches/Safari/*
>
> > I assume removing the temp and cache files the application will
create
> new ones upon next launch, and they are stored in that user's home
> directory.
>
> yes. I'm mostly interested in the Safari cache.
>
> >So you can wild card or loop it for user's that are located in
/Users and
> exclude shared if need be.
>
> Casper policy is set to execute on login, frequency ongoing, scope
for all
> desired machines, and the script is specified in the Scripts tab.
>
> Do I have to specify any of the extra paramter options?
>
>
>
> Gene Anderson
> Systems Analyst, ACTC, MCP
> Pembina Hills Regional Division No.7
> Phone: (780) 674-8535 ext 6860
> email: ganderson at phrd.ab.ca
>
> "Passwords are like bubble gum, strongest when fresh, should never
be
> used by groups and create a sticky mess when left laying around"
>
> -anon
>
>
> _______________________________________________
> Casper mailing list
> Casper at list.jamfsoftware.com
> http://list.jamfsoftware.com/mailman/listinfo/casper
>



More information about the Casper mailing list