Directory Wizards Inc.

Solutions For Your Directory Needs

RSS feed
Add to Google


 

Categories

Knowledgebase

Automating (Scheduling) your SimpleSync connections

Category:General

Last Updated:2009-06-04

 

Download PDF version

 

You may easily automate (schedule) your SimpleSync connections.

 

Initial creation and run of connections is typically performed in the SimpleSync GUI. Thereafter, your SimpleSync connections may be run manually from the GUI or via a command line program (shell.exe).

 

Using the command line option, you  may automate the your Sync runs via the use of any task scheduling program. The most commonly used is Windows Task Scheduler.  Simply create a simple script, using the below described syntax. Run the script manually to confirm good results.  Then set up a scheduled task to execute your Sync script as desired.



Script file requirements:

Example Script #1 – One command per connection

Here is an example of a script to kick off SimpleSync v4.0 connections. Remember, one command line per connection:



C:
cd \SimpleSync-v4\Programs
shell.exe "in-Paris-to-Master"
shell.exe "in-Denver-to-Master"
shell.exe "in-NY-to-Master"
shell.exe "out-Master-to-Paris"
shell.exe "out-Master-to-Denver"
shell.exe "out-Master-to-NY"

 

Here is an example of the same connections if they are in two folders (In/Out) instead of using naming conventions

C:
cd \SimpleSync-v4\Programs
shell.exe "IN\Paris-to-Master"
shell.exe "IN\Denver-to-Master"
shell.exe "IN\NY-to-Master"
shell.exe "OUT\Master-to-Paris"
shell.exe "OUT\Master-to-Denver"
shell.exe "OUT\Master-to-NY"

 

Advanced - Example Script #2 – Multiple connections per command

 

Here is an example of a batch script to kick off a subset of SimpleSync v4.0 connections with a single command.  This is useful as it allows the creation of new connections to be inserted into the automation automatically, simply by use of proper naming conventions. (No need to edit your script to insert the shell.exe command for each individual connection.)

 

C:
cd \SimpleSync-v4\Programs
for /D %%D in (..\connections\in*.) DO ..\Programs\shell.exe "%%D"
for /D %%D in (..\connections\out*.) DO ..\Programs\shell.exe "%%D"



In the above example, naming conventions are used to group connections…all connections that load the master are prefixed with "in". All connections that push from the master, out to other directories, are prefixed with "out".  Using this two line batch script, any connection created with a prefix of "in" or "out" are automatically included in the execution of the scheduled batch.

 

Below is an example of the same connections if they are in folders, instead of using naming conventions:

 

C:
cd \SimpleSync-v4\Programs
for /D %%D in (..\connections\IN\*.) DO ..\Programs\shell.exe "%%D"
for /D %%D in (..\connections\OUT\*.) DO ..\Programs\shell.exe "%%D"

 

Scheduling Batch Execution using Scheduled Task

Create a Scheduled Task, Programs > Control Panel > Scheduled Task > Add a Scheduled Task.
Select the script and configure run time and Run As properties. Be sure the Run As account has sufficient access/permissions to perform the operation.

Note: Executing via Scheuled Task will pop up a CMD window. If you wish to run the Scheduled Task in the background, be sure to set the 'Run As' to an account other than the logged in account.

 

Scheduling Batch Execution using the AT command

Start the Scheduler Service -Start/Settings/Control Panel/Services. Or, configure Startup to make the service start at boot up.

Lets say that your batch file is called \SimpleSync-v4\runsync.bat and you would like to have it run every day at 9:00 am. . For syntax on the at command type 'at /?' from the CMD prompt.

at \\MyServer 9:00 /EVERY:SU,M,T,W,TH,F,S "C:\SimpleSync-v4\runsync.bat"

To view the scheduled events type "at". Remember, a log file is generated with each run. Review these logs regularly to ensure your connection is running properly.

*SimpleSync is single thread so more than one occurrence of a program can run at a time. Take your bandwidth into consideration when attempting to run more than one sync.


Scheduling Log File Management
See
Scheduling Log File Management for information on automating your Log File Management.