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 (see 2. Setting a machine to switch on for scheduled backups). However, any machine may be set to switch off after the scheduled backup has run (see 3. Setting a machine to switch off after scheduled backups), 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 to switch your computer on automatically just before your scheduled backup starts, instead of leaving it on during the night. Wake-on-LAN is offered as part of IT Services' Energy Efficiency and Monitoring Services (EEM).

Not every college and department has signed up to offer EEM, so you need to ask your local IT staff if it is available. If so, then you can go to the EEM welcome page and sign up for Wake-on-LAN. There are two options: you can register the machine that you are currently using by selecting Register a Machine, or you can register another machine by selecting manual registration. In either case, on the registration page, you need only to select your device class (e.g. netbook, laptop or desktop) and your TSM nodename, and then you can register. Your machine will thereafter be woken at the right time for your TSM backup.

Windows 8 users should note that their machines cannot be woken by Wake-on-LAN once switched off; instead, they should be suspended or hibernated. On this please see further Does EEM work with Windows 8?.

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

  1. Right-click on an empty area of your desktop and select New > Text Document.
  2. Windows will create a new file for you, probably called New Text Document.txt. Rename it and make sure to give the file a name ending in .bat, e.g. myshutdown.bat, instead of .txt. If, when you change the name, you are asked, 'If you change a file name extension, the file might become unusable. Are you sure you want to change it?', click Yes.
  3. 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.
  4. Open the folder C:\Program Files\Tivoli\TSM\baclient and drag your .bat file into it.
  5. You now need to edit the file dsm.opt, which is also to be found in C:\Program Files\Tivoli\TSM\baclient. In Windows Vista, 7, 2008 and 2008R2, permissions to edit the contents of C:\Program Files are limited. We therefore recommend that you move dsm.opt to the desktop before you open it for editing. Users of these versions of Windows should therefore drag dsm.opt to their desktop. (An alternative is to run your text editor as administrator before using it to open dsm.opt.)
  6. Now double-click on dsm.opt to edit it. You can use Notepad or Wordpad as editor, if Windows asks which program you wish to use. Add the line:
                               PostNScheduleCmd	'"C:\Program Files\Tivoli\TSM\baclient\myshutdown.bat"'
                            
    The argument to the PostNScheduleCmd option is the full pathname to the .bat that you 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).
  7. Save dsm.opt. If you moved it from C:\Program Files to your desktop in order to edit it, now move it back.
  8. The TSM scheduler now needs to be restarted in order for it to see the changes that you have made. If you will be restarting your computer before the next scheduled backup, then the scheduler restart will happen automatically; if not, you do need to do this manually, on which please see our page on restarting the TSM scheduler in Windows.

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 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

  1. 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
                               
                            
  2. Now edit the file /Library/Preferences/Tivoli Storage Manager/dsm.sys and add the line:
                               PostNScheduleCmd	'"/Applications/Tivoli Storage Manager/myshutdown.sh"'
                            
    The argument to the PostNScheduleCmd option 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

  1. Edit the file /opt/tivoli/tsm/client/ba/bin/dsm.sys and 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.