WAIT or Delay?

Discuss new features and functions
Posts: 15
Joined: 6 Jun 2019

chuckv

Hello,

Is there a way to place a WAIT or Delay (3 sec) in-between tasks in the batch mode?

For instance, I run a batch file upon pass/fail and it creates a data file with system variables in it... then, as a new task, I will upload it to my FTP site... it will take a few seconds for this file to be created, so a WAIT would be perfect to assure it is there before the upload.

Thank you,
Chuck
Posts: 15
Joined: 6 Jun 2019

chuckv

Any solution to this? I need a solution to "wait" 5-10 seconds between tasks in batch mode...
Thanks
User avatar
Posts: 2451
Joined: 22 Aug 2012

Plerry

Your description is not very clear.
Do you want to launch multiple successive tasks after completion of an FFS sync?
If so, you can simply have FFS launch a script, e.g. a *.bat/*.cmd script, that in turn will launch the successive follow-up task to be performed.
If necessary, you can then introduce a wait-function in that script in between the successive tasks.
In a *.bat/*.cmd script, the most commonly used approach is to use a command like
PING localhost -n 11 >NUL
for a delay of just over 10 seconds (you should always enter the desired delay +1).
Other methods may also be used. See e.g. here.

But such a wait-statement may not even be necessary if you call the successive tasks using the START /wait command.
This will make the script wait for the command following "START /wait" to end before continuing execution of further commands in the script.
Posts: 15
Joined: 6 Jun 2019

chuckv

Hello, thank you for your reply.

A Commandline.bat calls a FileSync batch that has 2 tasks, a download and an upload. The upload needs to be delayed 5-10 seconds while a file is being created from .bat that kicks off the process. Ideally, the wait should be in-between the FileSync Batch tasks. Would be great if I could add a 3rd task in-between the download and upload task (in the FileSync batch) that would call some sort of wait/delay.

Hope this helps, thank you.
Chuck
Posts: 15
Joined: 6 Jun 2019

chuckv

Using the PING you suggest in-between the tasks sounds like it would work... how do I enter this command line in the FFS UI... a simple copy/paste errors looking for a folder, so assuming it needs to know it is code to execute.
User avatar
Posts: 2451
Joined: 22 Aug 2012

Plerry

... how do I enter this command line in the FFS UI... chuckv, 01 Aug 2019, 14:08
You don't define the PING based wait time in FFS, you add it to your *.bat/*.cmd file that calls the successive FFS tasks.
Posts: 15
Joined: 6 Jun 2019

chuckv

Yeah, that doesn't fit my explanation of need. I'm aware I can do this. Doesn't solve the problem. Is there no way to put a wait in-between the tasks in a FFS batch?
User avatar
Posts: 2451
Joined: 22 Aug 2012

Plerry

Then your "explanation of need" still has not made clear (at least to me) what you mean exactly by "in-between the tasks in a FFS batch".
A Commandline.bat calls a FileSync batch that has 2 tasks, a download and an upload. The upload needs to be delayed 5-10 seconds while a file is being created from .bat that kicks off the process. Ideally, the wait should be in-between the FileSync Batch tasks.
This suggests you have a *.bat file that launches FFS to run a *.ffs_batch file (or possibly two *.ffs_batch files in one and the same sync).
The trick seems to be to assure you have a download.ffs_batch file for your download task and a separate upload.ffs_batch file for your upload task.

If you let your *.bat file first launch an FFS sync running your download.ffs_batch sync, have the bat-script wait until that FFS task has ended (e.g. via START /wait), have the bat-script then wait via the PING instruction, and then have the bat-script launch an FFS sync running your upload.ffs_batch sync, you should be there.

Alternatively, you have a first bat-script that launches an FFS sync running your download.ffs_batch sync.
That download.ffs_batch may then define that upon completion of the download.ffs_batch task a second bat-script is called.
In that second bat-script, you can first introduce the PING wait statement, and then have it launch an FFS sync running your upload.ffs_batch sync.

Instead of using a PING wait statement, you may also use your (full or second) bat-script to check if the file that needs to be created has actually been created.

If you run a single FFS job, a Compare is run on all sync locations involved and the actions to be performed are decided upon before performing the sync. If in between the Compare and executing the planned actions (=running the sync) a file is added or modified, this will not change the planned actions, so that added or modified file is or may not be part of the sync. That is why you have to split it into two separate Compares and Sync, to be executed sequentially.