How to set a machine to switch on and off for scheduled backups
1. Introduction
To reduce energy consumption you may wish to set your machine to switch on before, and off after, your scheduled backup has run. To switch it on beforehand, your department/college needs to offer Wake-on-LAN (WOL). However, any machine may be set to switch off after the backup has run, no matter where it is located. Using both these methods to switch your computer on and off automatically will mean that it will be powered on for a much shorter time. The average backup session lasts less than twenty minutes, as opposed to the fourteen hours that a computer would normally be left on for overnight.
2. Setting a machine to switch on for scheduled backups
You may be able to use Wake-on-LAN (WOL) to switch your computer on automatically just before your scheduled backup starts, instead of leaving it on during the night.
Not every college and department has signed up to offer the WOL service, so you need to ask your local IT staff if it is available. If so, then you can visit the WOL registration page, and follow the instructions there to sign up for WOL.
3. Setting a machine to switch off after scheduled backups
This section details the simple steps needed for users of desktop/laptop systems who wish to power off their machines after the HFS Scheduled backup completes.
Please ensure that your machine's 'Sleep mode' delay is set to at least three minutes so that it is still active when the shutdown request takes place. You can check the Power Management settings on your machine via Control Panel (Windows) or System Preferences (Mac).
3.1. Windows
- Open the folder
C:\Program Files\Tivoli\TSM\baclientand create a new file by choosing the File menu, then New then Text Document. Give the file a name ending in.bati.e 'myshutdown.bat'. Now right click the file, choose 'Edit', add the following line in it:shutdown.exe -s -f -t 120 -c "Post TSM Backup Shutdown"and save the file. - Edit the file
dsm.optin the same folder and add the line:PostNScheduleCmd '"C:\Program Files\Tivoli\TSM\baclient\myshutdown.bat"'The argument to thePostNScheduleCmdoption is the full pathname to the file you have just created. Ensure that you include both sets of quotes. (The inner quotes are required due to there being a space in the path name).
Now each time the TSM Scheduler subsequently completes a scheduled backup it will (-s) shutdown the local machine, (-f) forcing any open applications to close, (-t 120) waiting 120 seconds before commencing shutdown (see note below) and (-c) writing a message to both screen and Event Log. Here is one source for further information on Windows XP shutdown syntax among many others online.
Note that a delay of 120 seconds should be sufficient for the TSM scheduler to complete its session and sign off from the backup server having received a return code from it indicating success or failure of the scheduled backup. Shortening this delay by a considerable amount is not recommended.
Try not to leave files and/or applications open overnight. The -f option will not prompt for File-Save in any open applications so will result in a loss of all unsaved data. Without this option, the shutdown may not proceed if there are any open applications or files.
To disable the shutdown, just edit the dsm.opt file and remove the
PostNScheduleCmd line.
3.2. Mac OS X
- Copy the following script to a file 'myshutdown.sh' in the Tivoli Storage Manager folder
under Applications:
#!/bin/sh # # # myshutdown - shutdown using osascript to bypass the sudo requirement of # /sbin/shutdown # # Note: DELAY is in seconds. Do not set to less than 120. # ############################################################################## DELAY=180 /usr/bin/osascript <<END delay $DELAY tell app "System Events" shut down end END - Now edit the file
/Library/Preferences/Tivoli Storage Manager/dsm.sysand add the line:PostNScheduleCmd '"/Applications/Tivoli Storage Manager v5.3.2.1/myshutdown.sh"'The argument to thePostNScheduleCmdoption is the full pathname to the file you have just created. Ensure that you include both sets of quotes. Note also that the precise text inside the quotes will vary according to the version of Tivoli Storage Manager installed on your machine and hence the name of the folder.
Now each time the TSM Scheduler subsequently completes a scheduled backup it will shutdown the local machine after a delay of 180 seconds. This delay should be sufficient for the TSM scheduler to complete its session and sign off from the backup server having received a return code from it indicating success or failure of the scheduled backup. Shortening this delay by a considerable amount is not recommended.
To disable the shutdown, just edit the /Library/Preferences/Tivoli Storage Manager/dsm.sys file and remove the PostNScheduleCmd line.
3.3. Linux
- Edit the file
/opt/tivoli/tsm/client/ba/bin/dsm.sysand add the line:PostNScheduleCmd "shutdown -P +3"
Now each time the TSM Scheduler subsequently completes a scheduled backup it will shutdown the local machine after a delay of 3 minutes. This delay should be sufficient for the TSM scheduler to complete its session and sign off from the backup server having received a return code from it indicating success or failure of the scheduled backup. Shortening this delay by a considerable amount is not recommended.
To disable the shutdown, just edit the /opt/tivoli/tsm/client/ba/bin/dsm.sys file and remove the PostNScheduleCmd line.
