How to Run CopyStorm in Batch Mode
CopyStorm can be configured to provide a headless Salesforce backup by running in batch/background mode and leveraging the built-in scheduler on your computer. This article will show you how.
Step 1: Create a Script That Runs CopyStorm
The base script used to launch the CopyStorm UI can also be used to start CopyStorm as a headless Salesforce backup application (required for a batch job). To configure the CopyStorm command line:
- Save your CopyStorm configuration file using the “Encrypted” and “Save Passwords” options on the CopyStorm “Save As” dialog.
- This will create a file named “MySettings.copyStorm” (using the name you choose for the file).
- On Windows run the command:
- CopyStorm.bat -run MySettings.copyStorm
- On Linux or Mac run the command:
- sh CopyStorm.sh -run MySettings.copyStorm
If the notification feature built into CopyStorm is used then this is likely the only command you will need.
There are a number of optional command line switches (documentation available here), but you do not need this information to go through the process in this article.
If you do not want to use CopyStorm’s built-in email notification or you want to be notified even when the CopyStorm program fails to start then you may want to use the CopyStorm Batch tab to build a starting script.
In practice, a script that does a bit more than run CopyStorm is often used for a batch job. In a typical batch job an organization wants to be notified if a CopyStorm job fails and many organizations also want to be notified any time CopyStorm runs. Though an organization is always free to write their own script for launching CopyStorm, the CopyStorm GUI has a built-in tool for creating a launch script. The generated launch script is often very close to what is desired:
- The CopyStorm tool can create a launch script in a variety of scripting languages.
- The generated launch script is readily customizable.
- The script is easy to run as as a scheduled job under CRON or Windows Scheduler.
The Batch File tab on the CopyStorm GUI is used to create a script for launching a headless Salesforce backup, running CopyStorm as a batch job. Once the required parameters have been specified, press the “Generate Script” button to create a launch script and then press the “Save Script” button to save the script to disk.
|Script Format||Yes||Indicates the scripting language to be used for the generated script. Options include:
Step 2: Schedule the CopyStorm Job
Schedule on Linux/Mac
Most Linux or Mac computers manage scheduled jobs using the built-in cron tool. If the script that runs CopyStorm is called RunProductionCopyStorm.sh:
- Run the command “crontab -e”
- Add the following line to the crontab to run CopyStorm once a day at 17:00
- 0 17 * * * sh ~/RunProductionCopyStorm.sh
For additional information on the format of a crontab entry see the Wikipedia article on cron.
Here is an example crontab from one of Capstorm’s servers:
Schedule on Windows
Scheduled jobs on Windows are usually manged using the Windows Scheduler. The following procedure will add a CopyStorm job using a script named RunProductionCopyStorm.vbs to the Windows Scheduler: