How can I gracefully shutdown robocopy /mot

Discussion in 'Windows Server' started by roga, Jul 30, 2005.

  1. roga

    roga Guest

    How does one gracefully shut down a robocopy /mot job (i.e one that runs
    continuously) started by "at" or "soon" ? (i.e. running not interactively
    from a scheduled job using the system account)

    regards

    Roger
     
    roga, Jul 30, 2005
    #1
    1. Advertisements

  2. roga

    Todd J Heron Guest

    Don't think there's a way except to kill the job via Task Manager.
     
    Todd J Heron, Jul 30, 2005
    #2
    1. Advertisements

  3. The scheduler lets you set a time to end a running process. So if it's
    always the same time, such as for backup, that's that. Scheduler will end
    the running batch file at that time. For this, in the scheduled tasks
    Properties dialog, you can set "Stop task if it runs for [] hours []
    minutes" on the Settings tabbed page.

    If not, you can use tasklist and / or taskkill. You can script tasklist,
    pipe that thru find /i "robocopy" or findstr /i robocopy, then test IF NOT
    ERRORLEVEL 1 TASKKILL etc.

    Greg Stigers
     
    Greg Stigers, MCSA, Jul 30, 2005
    #3
  4. roga

    Todd J Heron Guest

    Those are good answers Greg but remember the OP said "running not
    interactively from a scheduled job" which rules out the Scheduler
    altogether.
     
    Todd J Heron, Jul 30, 2005
    #4
  5. roga

    roga Guest

    Thanks both of you for the replies, however I was aware of the methods you
    refer to, I might also add that sysinternals have some very good tools here:
    http://www.sysinternals.com/Utilities/PsTools.html

    which includes "PsSuspend" which has some features that windows tools do not
    have.

    OK I'll clarify my question:

    by "gracefully" I mean: allow the application to finish the current
    operation cleanly and then exit.

    As I understand it if I was to "kill" robobcopy in the middle of a
    large/slow copy operation there is no guarantee that the copy will end
    cleanly. (Or have I misunderstood how robocopy works?)

    The way I am currnetly doing it is to view the log file and try and guess
    when robocopy is "resting", then kill it.

    Perhaps someone could come up with a robocopysvc to get round these
    problems?

    regards

    Roger
     
    roga, Jul 31, 2005
    #5
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.