I have 3 FW drives that go to sleep (no matter what) and I was wondering how to make an Apple Script that could poll the drives every X minutes to keep them awake. I've never worke w/Apple Script before so guidance would be great, and someone actually writing the script for me would be awesome.

Were you aware of pmset? I think "pmset -a disksleep 0" should do it, maybe.

To actually poll the drives, how about a shell script instead - name it "nosleep.sh", probably has to be run as root. Could also name it .command instead of .sh in order to make it double-clickable but I'm not sure how it would run as root in that case. (I haven't tested it):

That's basically a script that reads out the names of the files in the root of your drives automatically.

2) Go into the terminal, type:

Code:

sudo cp /the/path/to/poll.sh/ /usr/bin/poll.sh

then

Code:

sudo chmod 777 /usr/bin/poll.sh

that will copy the shell script to a special folder, and set its permissions to be able to be run

3) Again in the terminal, type:

Code:

sudo pico /etc/crontab

then it'll bring up like a really basic text editor, with a list of jobs that your computer will do automatically, so you don't have to run the script by hand. The columns are tab delimited, so keep that in mind. Make the file look like this (or at least add this line if there are others):

I've been messing with this for a few days. Here's what I can add to the discussion....

Tiger no longer uses 'cron' to schedule things. You should be using 'launchd' combined with .plist files. I also chose to use 'touch' instead of 'ls' as it should use less resources, at least if there are many files on the drive. I also made my touched file invisible to the finder by prefixing the filename with a dot.

So my script is based on the following command:

touch -m /path/to/.file.txt

and the .plist (saved in ~/Library/LaunchAgents/) is something along the lines of: