Hi,
as title I have 2 bat files for 2 different sync
is there a method to run bat2 after bat1 without overlapping?
Hi,
as title I have 2 bat files for 2 different sync
is there a method to run bat2 after bat1 without overlapping?
I’d make a 3rd .bat file and run bat1 then bat2 from that.
Thx for reply me…
As far as I know if you insert 2 exec in 1 bat the 2 exec are started consecutively without waiting the first to finish…
Don’t you use run them without exec? That should run them in sequence. (PS Not a windows expert!)
just for clarification…
I want to schedula my “Anime” job and my “Tv show” job…
what I’m searching is if there’s a method to make wait “Tv show” job if “Anime” job is running
if for example I schedule “Anime” to run this night, and “Tv show” next night and “Anime” job doesn’t finish I don’t want “Tv show” job overlap…
You have to use the call
command in your batches, so the execution only returns to the batch after the respective command is finished.
sync_files.bat
:
call rclone "for the 1st set of files"
call rclone "for the 2nd set of files"
I do this in a unique bat file…
But how to do in 2 different bat files?
Call the batches from a “main” batch, as @ncw suggested above
main_batch.bat
:
call 1st_batch.bat
call 2nd_batch.bat
1st_batch.bat
:
call rclone "for the 1st set of files"
2nd_batch.bat
:
call rclone "for the 2nd set of files"
If I may, why do you need two batches?
sorry but maybe I was not fully clear…
I want to schedule my first job every monday and my second job every tuesday…
what I want to avoid is this situation:
what I want is that the second job that start on tuesday wait the first job to finish before he start…
Ah, now I get it.
I think what you need is the tasklist
command in the second batch, something like this:
tasklist /FI "rclone.exe" 2>NUL | find /I /N "rclone.exe">NUL
if "%ERRORLEVEL%"=="0" exit /B (Rclone is running)
rclone ..... (second exec)
But with this solution above the second exec will not “wait”, but will simply exit the execution. You may have to schedule it for Wednesday, again.
The only way I visualize (at the moment) to “wait” would be a looping with the solution above (“try again every 5 minutes”, using timeout
command), but I don’t think it would be elegant / efficient.
If you already know that the execution window of the first one can overlap with the second (the ETA’s), isn’t it easier to set them up in sequence simply?
ohh thx,
I’ll give a try!
I can schedule all job every day so if one day would not run, maybe the next…
hi,
with this command I can do only one instance of my media backup
tasklist /FI "IMAGENAME eq rclone.exe" 2>NUL | find /I /N "rclone.exe">NUL if "%ERRORLEVEL%"=="0" exit
after that the sync command