Mac OS X,  Mac Security,  Unix

Managing SyncPlans from the PresSTORE CLI

PresSTORE has a Synchronize module, that can be used to copy data from one location to another. This is done by the use of synchronization plans, or sync plans for short. Each plan is given a name and has a number of attributes associated with it, such as whether it is enabled or disabled. PresSTORE has a command line interface called nsdchat that is available at /usr/local/asw. To run it in interactive mode you can run the following command:

/usr/local/asw/nsdchat

From here, you can use the SyncPlan command to interface with the plans that you have created. To see a list of plans you will use the SyncPlan command from the interactive mode, along with the names method:

SyncPlan names

Once you see a list of defined sync plans you can use the describe method to obtain an explanation of what each is comprised of. Let’s say we have a sync plan called XsanSync. If you wanted to see a human readable description of what it does, you could then use the following:

SyncPlan XsanSync describe

To enable one of your sync plans use the enable method. For example, to continue on with the plan called XsanSync you can use the following command to enable it:

SyncPlan XsanSync enable

To verify that the plan was enabled, use the enabled method. This past tense is only used to return a 1 for enabled or a 0 for disabled:

SyncPlan XsanSync enabled

Note: The disabled method can be used to achieve the opposite result.

The sourcehost and targethost methods can be used to indicate what computer is having data synchronized from and which is having data synchronized to. The sourcepath and targetpath methods can then be used to indicate what path on the sourcehost and targethost is being sync’d, respectively. You cannot then change the host or path of either using the SyncPlan command.

Once you’re comfortable with what is being sync’d and why, you can fire off a sync job, either immediately or send it to the PresSTORE scheduler. To submit a job to run immediately, use the submit method along with the now option like so:

SyncPlan XsanSync submit now

Running the same command without the now simply submits the job to the scheduler based on the schedule in the plan. To stop a running job, the aptly named stop method will be used:

SyncPlan XsanSync stop

The stop method can only be used on a running sync plan, and so if you have a job that has been submitted to the scheduler that you would like to cancel, you would use the cancel method:

SyncPlan XsanSync cancel

The -c (BTW, thanks Beau for showing me what I was doing wrong with -c) can be used to run nsdchat in a non-interactive mode. For example, to cancel the SyncPlan job referenced above, you can do the following:

/usr/local/aw/nsdchat -c SyncPlan XsanSync cancel

Overall, the ability to script logic (bash, AppleScript, etc) for sync plans based on system events, 3rd party apps (Podcast Producer and Final Cut Server for starters) or anything else you can obtain a variable for provides a lot of versatility and extensibility to the out-of-the-box PresSTORE solution for data synchronization. Granted, you can do any of the aforementioned commands by using either the web GUI or the iPhone app. But, as usual, we don’t need no stinkin’ GUI (even if the PresSTORE 4 GUI is a lot better than in previous versions)!