Home > Utility > Deleting Flash Cookies Daily Using Snow Leopard’s Semi-Broken Periodic Scripts

Deleting Flash Cookies Daily Using Snow Leopard’s Semi-Broken Periodic Scripts

I was trying to find a convenient way to delete Flash cookies every day and wanted to run two simple lines automatically:

rm -rf /Users/rob/Library/Preferences/Macromedia/Flash\ Player/\#SharedObjects
rm -rf /Users/rob/Library/Preferences/Macromedia/Flash\ Player/macromedia.com/support/flashplayer/sys

There are many ways to do this of course: launchd, cron, at, etc, but I thought it would be most elegant to tie into the Mac’s periodic maintenance scripts, and what a time I had debugging why I couldn’t get it to work.

The script at /etc/periodic/daily/999.local is supposed to execute all scripts residing in the $daily_local variable (set in /etc/defaults/periodic.conf) which is /etc/daily.local by default, but it doesn’t, and I had to change a line in 999.local from this:

for script in $daily_local

to this:

for script in $daily_local/*

Script junkies can see that the original for loop will iterate over exactly one item: the string /etc/daily.local.

With the change, I created a directory at /etc/daily.local and put a simple script in it.

$ sudo mkdir /etc/daily.local
$ sudo vi /etc/daily.local/delete_flash_cookies.sh
$ sudo chmod +x /etc/daily.local/delete_flash_cookies.sh

The script looks like this:

#!/bin/sh
echo ""
echo "Local Script: Removing Flash Cookies:"
rm -rf /Users/rob/Library/Preferences/Macromedia/Flash\ Player/\#SharedObjects
rm -rf /Users/rob/Library/Preferences/Macromedia/Flash\ Player/macromedia.com/support/flashplayer/sys

Summary

Edit /etc/periodic/daily/999.local (and similar scripts for weekly and monthly) to read around line 19:

for script in $daily_local/*

Create a directory at /etc/daily.local.

Add executable scripts to the /etc/daily.local directory.

Enjoy.

  1. June 5th, 2013 at 07:12 | #1

    Great article! We will be linking to this particularly great content on our website.
    Keep up the great writing.

  2. June 20th, 2013 at 23:53 | #2

    I got this site from my buddy who informed me concerning this web page and at the moment this time I
    am browsing this website and reading very informative content
    at this time.

  3. July 1st, 2013 at 02:45 | #3

    I’m not sure where you’re getting your info, but good topic.
    I needs to spend some time learning much more or understanding
    more. Thanks for wonderful info I was looking for this info for my mission.

  1. No trackbacks yet.