automatic shutdown after backup

Discussion in 'Acronis True Image Product Line' started by epw, Nov 26, 2008.

Thread Status:
Not open for further replies.
  1. epw

    epw Registered Member

    Nov 26, 2008
    I am running TI 2009 and I am trying to shut down the PC after a scheduled job backs it up. Right now I have shutdown -s -t 10 -c "comment" as a post command.

    That's not working to shut down the pc. Is there a box I can check when setting up a scheduled task that will shut the computer down after? I see a checkbox when a task is running... but not for a scheduled task.
  2. babac

    babac Registered Member

    Sep 16, 2006
    Hi epw,
    This subject was discussed here recently between three very distinguished members.It should answer your question.
  3. Acronis Support

    Acronis Support Acronis Support Staff

    Apr 28, 2004
    Hello all,

    Thank you for your interesting in Acronis True Image

    You can use the Pre/Post commands option of Acronis True Image Home 2009 to work around the problem:

    * Run the Schedule Task wizard;
    * At the Backup Options step choose Pre/Post commands;
    * Choose the Use Custom Commands;
    * Hit the Edit button next to the After the backup process field;
    * Put in the Post command as specified below:

    Command: shutdown
    Working directory: C:\Windows\System32\
    Arguments: -s

    This command will automatically shut down the computer after the completion of backup process.

    Best regards,
    Dmitry Nikolaev
  4. CAOgdin

    CAOgdin Registered Member

    Nov 1, 2004
    Here's a two-line script that does the work. Set it as a "Post" command, so it runs AFTER the image backup has been completed. This script has been tested on Windows XP Pro SP3 with Acronis Home 2009:

    REM Shutdown in five minutes, unless overridden
    shutdown -s -t 300 -s "Open 'cmd' (Press 'Windows' key && 'R" at the same time) and type 'shutdown -a' to abort this shutdown."

    (*Note*: The line that begins "shutdown", shown here in two lines, should all appear on one line.)
  5. CAOgdin

    CAOgdin Registered Member

    Nov 1, 2004
    And, here's a better script that will allow you to specify hours during which shutdown DOES NOT happen. It also allows you to abort the shutdown, in case you're continuing to work past your bedtime. (When you copy-and-paste, make sure the long lines here are all on one file in the PowerOff.cmd file you create.)

    ::mad:Echo off
    REM Version 2.6 April 20, 2009

    REM Copyright 2007, 2009 Carol Anne Ogdin (
    REM Released under GNU General Public License v3; see COPYING.txt.

    REM ***Description***
    REM This script is invoked from Acronis Truelmage AFTER the image is
    REM made. It will
    REM shutdown the computer after five minutes wait for manual inter-
    REM vention. The process will NOT run at or after Dawn (defined
    REM below) nor before Dusk.

    REM ***Configuration section*** (Set up for your own environment)
    REM Name of Log (Or use Log provided in call to this script)
    set Log=%1
    if (%1)==() set Log="%~dpn0.log"
    echo %DATE%@%TIME%: %~nx0 Started >>%Log%

    REM Set "business hours," during which SHUTDOWN will NOT be done
    REM Dawn and Dusk are hours, in the range 0..23
    REM Set Dawn=0 and Dusk=0 to prohibit shutdown at all times
    REM Set Dawn=24 and Dusk 24 to allow shutdown at all times
    set Dawn=8
    set Dusk=20

    REM Uncomment to enable debugging (run from a CMD window to see progress)
    REM echo on & set debug=echo WILL
    REM Uncomment one of these to enable/disable echoing of Assert stmts
    REM set Assert=echo ***Assert:
    set Assert=REM Assert:

    REM ***Customizations of configuration for unique situations follow***
    REM ***End of local customizations***

    REM Set default folder where shutdown.exe should be located
    pushd %systemroot%\system32

    REM Shutdown computer at end of process
    if not exist shutdown.exe goto NoProg
    %Assert% shutdown Program exists >>%Log%
    REM During nominal business hours, don't do SHUTDOWN
    REM (This is to save time if you force a manual image)
    REM If time is after %Dawn% and before %Dusk%, don't SHUTDOWN
    REM IOW: SHUTDOWN only at hours when we're not likely to interfere
    set /a hour=%time% 2>nul
    if %Dawn% LSS 1 if %Dusk% LSS 1 goto NotTime
    if %hour% GEQ %Dawn% if %hour% LSS %Dusk% goto NotTime
    %Assert% We're outside normal business hours... >>%Log%
    REM Shutdown in five minutes, unless overridden
    start /i shutdown -s -m \\%computername% -t 300 -c "Type SHUTDOWN -A on a command line to abort the shutdown."
    goto Fini

    echo Couldn't SHUTDOWN because shutdown.exe is not on the path. >>%Log%
    goto Fini

    %Assert% Time now (%time%) is between %Dawn%:00 and %Dusk%:00; do NOT shutdown.>>%Log%

Thread Status:
Not open for further replies.