Sign in to follow this  
Followers 0
asalex

The script is executed only two hours

5 posts in this topic

There is a script that will automatically pour the files on the FTP-server.

Confronted with the problem: when processing a large file (> 50 MB) - the script is executed only two hours, then was suspended.

Part of the file is not filled - have to fill it manually.

I hope for your help. Thank you.

Share this post


Link to post
Share on other sites



Share this post


Link to post
Share on other sites

Could you please post your code? Make sure you remove any credentials...

What exactly happens? When using FTP upload, then script hangs?

This is part of the code :

$FileList=_FileListToArray($localpath & $dir[$x],"*",1)
        If UBound($filelist)<=1 Then ;====== if files not exist ====
        Else            ;============== if files exist,  for folder =====
                SoundSetWaveVolume(60)
                _RunDOS("D:\SERVICE\GOVORILKA\post_out.BAT")
                _RunDOS($Sendto & " File exist. " & $dir[$x] & ". Begining sending file...")
                ;============== connecting to ftp-server =============================================
                Dim $Conn = _FTPConnect($Open, $server, $username, $pass, $port)
                    If @error Then
                    _RunDOS($Sendto & "error connecting to ftp-server !")
                    Exit
                    EndIf
                ;=============== for each record in array .... ======================
                For $z=1 To $filelist[0]
                ;For $z=1 To UBound($filelist)
                ;===================== sending file to FTP ===================================
                If $dir[$x]="Alternative_place" Then
                _FTPPutFile($Conn,$localpath & $dir[$x] & "\" & $filelist[$z], $dir[$x] & "\out\" & $filelist[$z])
                Else
                _FTPPutFile($Conn,$localpath & $dir[$x] & "\" & $filelist[$z], $dir[$x] & "\in\" & $filelist[$z])
                EndIf

No, the script simply stops. Come morning - sent only part of the file. That is, the code will only work a certain amount of time - two hours. It seems so.

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

I'd be suspecting either some garbage in your FileList array, or that your server has some limit on connection time, or that about 2 hours into your script you hit a huge or corrupted file that's causing some sort of server error/timeout. I'd be looking at your FTP settings, or for problems external to your a script.

Displaying/Logging the filenames processed during a run would tip you off to which file is causing the failure. You could then see how it differs from the other files, whether it's corrupted, or larger. You could test sending that file first, monitor it, and see what result you get from the FTP transfer.

Your (partial) script looks good to me.

Edited by Spiff59

Share this post


Link to post
Share on other sites

1. In this case, the array is nothing but one big archive.

2. Restrictions on the time of connection to the server side does not, as such files are sent by hand is fine: put in the night - by morning, all covered on the server.

3. The file is definitely not corrupted as the rest of the morning, pour on to the server manually fine.

Thank you for your reply. I'll try another set binary transfer mode (suggested in another forum) and do so:

$sResultFtpPutFile = _FTPPutFile($Conn, $localpath & $dir[$x] & "\" & $filelist[$z], $dir[$x] & "\in_mail\" & $filelist[$z]) 
If @error Then MsgBox(32, 'error !' & @CRLF & _ 
                                        @TAB & '@error=' & @error & @CRLF & _ 
                                        @TAB & '$sResultFtpPutFile=' & @error)

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0