Sorry for my bad English.
I use ScriptFTP in console mode and run every 1 minute.
But if a lot of files that the script runs more than a minute. Tell me how to avoid running two scripts simultaneously?
I use ScriptFTP in console mode and run every 1 minute.
But if a lot of files that the script runs more than a minute. Tell me how to avoid running two scripts simultaneously?
Hi Padovan,
Don't worry. My English could be far better as I'm not a native English speaker. I hope we manage to understand each other
If you use the Windows task scheduler to launch ScripFTP_console.exe there is a check box to prevent the task to be launched again if it is still running. Let me know which version of Windows do you use to tell you exactly where this check box is.
If you use a bat file or another method to launch ScriptFTP the workaround is shown in the following example
Don't worry. My English could be far better as I'm not a native English speaker. I hope we manage to understand each other
If you use the Windows task scheduler to launch ScripFTP_console.exe there is a check box to prevent the task to be launched again if it is still running. Let me know which version of Windows do you use to tell you exactly where this check box is.
If you use a bat file or another method to launch ScriptFTP the workaround is shown in the following example
Code: Select all
# This example shows how to create a script
# that checks if another instance of ScriptFTP
# is running the same script at the same time.
# The check is done creating a text file called
# flag.txt when the script starts and deleting
# it once the script finishes. Before anything else
# the script checks if the file already exits (this means
# that another instance of ScriptFTP is running
# the same script), in this case the script
# closes ScriptFTP before any file transfer is done.
# Get the file list of the current local directory
GETLIST($filelist,LOCAL_FILES)
# Check if the file flag.txt exists
$found="FALSE"
FOREACH $file IN $filelist
IF($file=="flag.txt")
$found="TRUE"
END IF
END FOREACH
# If it exists close ScriptFTP
IF($found)
EXIT
END IF
# If the script has reached this point means that
# the file that is used as flag does not exists
# Let's create it to prevent the another instance
# of ScriptFTP run the same script at the same time
# This command creates the text file flag.txt with the
# contents "fdsa"
EXEC ("echo fdsa > flag.txt")
#
#
#
# Do your stuff here.
#
#
#
# Script finished delete the local file flag.txt
EXEC("del /f flag.txt")
liked Script FTP? Try our other product Email Parser
Thanks!
In my case the second option is acceptable.
In my case the second option is acceptable.
It is a lot of code, it is possible more shortly
Code: Select all
GETLIST($filelist,LOCAL_FILES,"flag.txt")
IF(TEXTLENGTH($filelist) != 0)
EXIT
END IF
EXEC ("echo fdsa > flag.txt")
# Do your stuff here.
EXEC("del /f flag.txt")
awesome! thanks
liked Script FTP? Try our other product Email Parser
The life has shown that it is better to check on file recording possibility as at emergency end of process the file-semaphore remains. I have made so
Code: Select all
IF(LOGTO($aLogFile) != "OK")
EXIT
END IF
Thank you Wandrey
liked Script FTP? Try our other product Email Parser
- All times are UTC -