Method to Restrict Process From Running More Than Once Every 15 Minutes Despite Trigger
Hey Guys -
What would be the best method so that a process (triggered via file rename) will only execute once every 15 minutes despite any triggers firing in the meantime and/or prevent process queuing? Below's the scenario...
I made a new, simple 2 step process this morning which...
1. Waits 5 minutes
2. Executes a batch file (via Run Command String - the batch file executes a PSEXEC command to trigger a scan of the share where the file was renamed)
The trigger I have set for it is a File Monitor that fires whenever a specific file type in a folder + sub-folders is renamed. The thing is, these files are usually renamed in batches of 1-20 at a time which occurs on a dynamic schedule.
The reason for my question is that I am wanting to prevent the below scenarios:
- Prevent the batch file being triggered multiple times simultaneously (therefore starting multiple simultaneous scans) in a short window
- Prevent queued starting of the process. Since the process takes 5 minutes to execute, I don't want it to run back to back 5 times if 5 triggers fire due to 5 files being renamed
Unfortunately, there doesn't seem to be a process action which detects the run state of WA processes which I could then easily use in a If/Then statement within the process. Therefore, below are the ideas I've considered so far:
- Finding out there's a built-in action in WA to check if process has run in past 15 minutes or is currently running :)
- Getting the current date/time during process, save to sortable text, then use if/then stating that actions will only run if 15 minutes have elapsed. Biggest issue here is that seemingly variables clear after process ends
- Writing PowerShell script that runs on remote system and simply writes the last time the scan process (exe) executed which would then be read and used as variable in WA process
- Writing PowerShell script on the local system that monitors file renaming (same as WA trigger currently does) and writes timestamp of action to a text file which is then read by WA and used as the trigger
I'm hoping to find a solution that doesn't involve more scripting as that's the reason I'm using WA in the first place. Any suggestions you have would be appreciated.
P.S. - I'm using I'm using WinAutomation 8 on Windows 10. The remote system is Windows Server 2016.
If you right click the process in the winautomation console and select edit, properties, concurrency Tab and check on Limit Concurrent processes to 1 process concurrency, then should process be triggered again to start, by file trigger and the process is currently running, then the additional triggered request to start process again will be discarded.
Will this work for you?