Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Start scheduled task in batch file

35 views
Skip to first unread message

Robert Prins

unread,
Oct 19, 2016, 4:30:36 PM10/19/16
to
This is probably not very difficult, but...

The batch file starts a process, X, waits 10 seconds and starts a second
process, Y, and another 10 seconds later a third one, Z. I would like to add a
fourth one, the above scheduled task, to make a hobocopy'ed backup, about once
per 30 minutes, of a directory updated by process X, but that task should
somehow stop automatically the moment that process X is stopped.

Is there a way to do this?

Thanks
--
Robert AH Prins
robert(a)prino(d)org
No programming (yet) @ http://prino.neocities.org/

JJ

unread,
Oct 20, 2016, 12:14:28 PM10/20/16
to
On Wed, 19 Oct 2016 23:29:34 +0000, Robert Prins wrote:
> This is probably not very difficult, but...
>
> The batch file starts a process, X, waits 10 seconds and starts a second
> process, Y, and another 10 seconds later a third one, Z. I would like to add a
> fourth one, the above scheduled task, to make a hobocopy'ed backup, about once
> per 30 minutes, of a directory updated by process X, but that task should
> somehow stop automatically the moment that process X is stopped.
>
> Is there a way to do this?
>
> Thanks

Two problems which you should reconsider and probably replan the whole task.

- Robocopy can not use other process (e.g. process X) as a trigger or event
to be monitored. So the process must be monitored from outside of Robocopy
process itself. e.g. a batch file.

- There's no reliable way to determine whether Robocopy is in the middle of
backing up files or not. So, it may cause incomplete/broken backup.

Zaidy036

unread,
Oct 20, 2016, 3:19:22 PM10/20/16
to
On 10/19/2016 7:29 PM, Robert Prins wrote:
> This is probably not very difficult, but...
>
> The batch file starts a process, X, waits 10 seconds and starts a second
> process, Y, and another 10 seconds later a third one, Z. I would like to
> add a fourth one, the above scheduled task, to make a hobocopy'ed
> backup, about once per 30 minutes, of a directory updated by process X,
> but that task should somehow stop automatically the moment that process
> X is stopped.
>
> Is there a way to do this?
>
> Thanks

START "" "X"
TIMEOUT 10 & START "" "Y"
TIMEOUT 10 & START "" "Z"

- following checks if X is running and does not proceed until X stops
:_CheckX
TASKLIST /FI "IMAGENAME eq "X" 2> NUL|FINDSTR /I "X" > NUL
IF NOT ERRORLEVEL 1 GOTO CheckX

START "" /WAIT "Robocopy"
-continues here AFTER Robocopy completes

Could add initial SET "_Stime=%time%"
and then after Robocopy completes
check that 30 min elapsed and GOTO beginning of batch

foxidrive

unread,
Oct 20, 2016, 7:44:44 PM10/20/16
to
On 20/10/2016 10:29, Robert Prins wrote:
> This is probably not very difficult, but...
>
> The batch file starts a process, X, waits 10 seconds and starts a second
> process, Y, and another 10 seconds later a third one, Z. I would like to add a
> fourth one, the above scheduled task, to make a hobocopy'ed backup, about once
> per 30 minutes, of a directory updated by process X, but that task should
> somehow stop automatically the moment that process X is stopped.
>
> Is there a way to do this?
>
> Thanks
>

How do you stop a backup happening immediately as another process starts,
if it's half way through copying a 5GB file?

I think your task should be spelled out a lot clearer than you have done
unless my comment answers your question.




0 new messages