How to automatically wake a device for Spectrum Protect scheduled backups

As well as automatically waking the device, you can also set it to return to sleep or shut down when the backup completes.

Windows

Expand All

  1. Check the HFS Backup Services Portal for when your backup is scheduled.
  2. Select the Windows Start menu  , type Task Scheduler, then launch Task Scheduler  .
  3. From right hand column, select Create Task...
  4. In General tab, provide an appropriate Name for the task.
  5. Enable General tabRun with highest privileges.
  6. Select Triggers tab > New... > Weekly, provide the scheduled backup day and time to wake, then OK.
  7. Select Actions tabNew..., then in Program/script provide cmd /c exit.
  8. Enable Conditions tabWake the computer to run this task.
  9. Select OK and close the Task Scheduler. 

For Step 6, the time to wake should be a couple of minutes before your scheduled backup time.

For Step 7, any command can be given as this is just to wake the device.

If your device sleeps after a period of inactivity then no changes are required.

If you need to tell your device to sleep:

  1. Edit the C:\Program Files\Tivoli\TSM\baclient\dsm.opt file with Notepad.  If cannot edit the file, either run Notepad as an administrator or move dsm.opt to the desktop before editing it.
  2. Add the following line:
    PostNScheduleCmd 'rundll32.exe powrprof.dll,SetSuspendState 0,1,0'
  3. Save dsm.opt, if you moved it to the desktop then move it back to its original location.
  4. Restart the device or restart the Spectrum Protect scheduler.
  1. Launch Notepad
  2. Add the following line:
    shutdown.exe -s -f -t 120 -c "Post Spectrum Protect Backup Shutdown"
  3. Save the file to your desktop as myshutdown.bat
  4. Move myshutdown.bat to C:\Program Files\Tivoli\TSM\baclient
  5. Edit the C:\Program Files\Tivoli\TSM\baclient\dsm.opt file with Notepad.  If cannot edit the file, either run Notepad as an administrator or move dsm.opt to the desktop before editing it.
  6. Add the line:
    PostNScheduleCmd '"C:\Program Files\Tivoli\TSM\baclient\myshutdown.bat"'
  7. Save dsm.opt, if you moved it to the desktop then move it back to its original location.

  8. Restart the device or restart the Spectrum Protect scheduler. 

The shut down will start 120 seconds after the scheduled backup completes, allowing the Spectrum Protect scheduler to finish its session and sign off of the backup server with a success or failure code.  Shortening the delay is not recommended.

Ensure that the device is not set to sleep before the shutdown request occurs.

In step 2, the shutdown command provided will:

  • -t 120 wait 120 seconds
  • -f force applications to close
  • -c write a message to screen and the Event Log
  • -s shutdown the device

The -f shutdown option will result in a loss of all unsaved data, so avoid leaving files and applications open overnight.

To disable the shutdown, edit C:\Program Files\Tivoli\TSM\baclient\dsm.opt and remove the PostNScheduleCmd line.

macOS

Expand All

Devices running macOS should wake automatically for backup and return to sleep afterwards.

Devices running macOS should wake automatically for backup and return to sleep afterwards.

To set your Mac to switch off immediately after a backup has completed:

 

  1. Copy the following script to a file 'myshutdown.sh' in the IBM Spectrum Protect or 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. Edit the file /Library/Preferences/Tivoli Storage Manager/dsm.sys and add one of the following lines depending on where you have written the previous script:
     
    PostNScheduleCmd '"/Applications/Tivoli Storage Manager/myshutdown.sh"'

    or

    PostNScheduleCmd '"/Applications/IBM Spectrum Protect/myshutdown.sh"'

    The argument to the PostNScheduleCmd option is the full pathname to the file you have just created.
    Ensure you include both sets of quotes.
    The text inside the quotes will vary according to the device's Spectrum Protect version and hence the name of the folder.

  3. Check the Power Management settings on your device via System Preferences to ensure the sleep mode delay is set to at least three minutes, to ensure it is still active when the shutdown request takes place.

The shut down will start 180 seconds after the scheduled backup completes, allowing the Spectrum Protect scheduler to finish its session and sign off of the backup server with a success or failure code.  Shortening the delay is not recommended.

To disable the shutdown, edit /Library/Preferences/Tivoli Storage Manager/dsm.sys and remove the PostNScheduleCmd line.

Linux

Expand All

You may be able to use the rtcwake command (see man rtcwake).  To automate this process:

  1. Check the HFS Backup Services Portal to find when your backup is scheduled.
  2. Schedule cron to run at a time when the machine won't be asleep, providing the rtcwake command

The following rtcwake command would wake the device the following day at 01:30:

rtcwake -m no -u -t $(date +%s -d 'tomorrow 01:30') 
  • -m no means don't put the machine to sleep now
  • -u means the real time clock is using UTC

Device's set to sleep after a period of inactivity will sleep automatically, but if you need to tell the device to sleep:

Edit /opt/tivoli/tsm/client/ba/bin/dsm.sys to add

PostNScheduleCmd "rtcwake -m mem -s 864000"

 

The rtctime command requires a wake time, which in the example above is 10 days.

Alternatively, systemctl suspend may work better as the command on systems with systemd.

Edit /opt/tivoli/tsm/client/ba/bin/dsm.sys to add

PostNScheduleCmd "shutdown -P +3"                        

 

The shut down will start 3 minutes after the scheduled backup completes, allowing the Spectrum Protect scheduler to finish its session and sign off of the backup server with a success or failure code.  Shortening the delay is not recommended.

Ensure that the device's sleep delay is set to longer than three minutes so the device will be active for the shutdown request.

To disable the shutdown, edit /opt/tivoli/tsm/client/ba/bin/dsm.sys and remove the PostNScheduleCmd line.

Get support


If you cannot find the solution you need here then we have other ways to get IT support

Get IT support