[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 509
  • Last Modified:

cron, scheduled tasks, rsync, and sleeping powerbooks

Hello,

I have a folder on my powerbook that must be backed up all the time.  I can probably figure out how to write a shell script that uses rsync (launched from cron) to sync the folder with another mac I have in my subnet.  I worry about a couple of things...

What happens if the computer is sleeping when the scheduled task is set to happen?
What happens if a file is open as its trying to be rsynced?
How can I check to see if a certain application is open before running the task (I work with Digidesign Pro Tools often and many of the files I need protected are wave files that protools uses... I dont want this thing to run if Pro Tools is open!)

If anyone has any good ideas on ways to backup files to machines on the subnet... send them through!  Thanks experts:)
0
meuedyn
Asked:
meuedyn
2 Solutions
 
brettmjohnsonCommented:
> What happens if the computer is sleeping when the scheduled task is set to happen?

cron jobs don't kick off if the machine is sleeping.  Mac OS X does not yet support
scheduled wake-ups.  The standard unix scheduled maintenance tasks are set to
kick off in the middle of the night, but my iBook is always sleeping then.  I edited
/etc/chrontab, changing them to start during the day when my machines are awake,
specifically lunch time.


> What happens if a file is open as its trying to be rsynced?

That depends upon the access mode with which the file is opened.  If the file is opened
in exclusive access mode, rsync will fail to open the file, generating an error in the log
and continuing on to the next.


> How can I check to see if a certain application is open before running the task
> (I work with Digidesign Pro Tools often and many of the files I need protected are
> wave files that protools uses... I dont want this thing to run if Pro Tools is open!)

I have used "ps -auxww | grep TheProgam.app" to find out if an app is running.
However in my case, I generally leave all my major apps running all the time -
switching between them (rather than closing them) and sleeping the computer
(rather than shutting down).


> If anyone has any good ideas on ways to backup files to machines on the subnet...
> send them through!  Thanks experts:)

This is the normal use of rsync.  It is well documented  and easy to set up.  By the
way, I suggest you use RsyncX, a version of rsync that specifically understands
Macintosh filesystem data+resource forks.


0
 
zmoCommented:
Hi,

As said brettmjohnson, rsync has been design for what you do. But you may
also be interested in using Subversion, which, better than only syncing directories
is versioning them (i.e. each time you sync, you make a new version, and save the
old one).

That's very useful on software development, but can as well be used for a lot
of other purposes (I'm saving my home directory using this ;).

<http://www.subversion.org>

You could also consider using Unison, which is only a GUI, and works using rsync.
It enables rsyncing in both ways with OSX, Linux and windows.

<http://www.cis.upenn.edu/~bcpierce/unison/>

my 2cts,

--
Guyzmo
0

Featured Post

Vote for the Most Valuable Expert

It’s time to recognize experts that go above and beyond with helpful solutions and engagement on site. Choose from the top experts in the Hall of Fame or on the right rail of your favorite topic page. Look for the blue “Nominate” button on their profile to vote.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now