Upload new .jpg file to server (remote directory up to date)

Advertisement

smittylube
Joined:
Posts:
11
Location:
US

Upload new .jpg file to server (remote directory up to date)

Hi everyone, I know this has been covered, but I would like a little bit of help so I understand the proper way of doing it.

I installed winSCP and it does what I need it to do flawlessly- however I must start the program, log in, select folders on remote and local then choose keep updated to start the process. Then it works fantastic!

What I am doing is my 'garage cam' for my auto repair shop- It refreshes the .jpg image about every minute. This worked fine without winscp for 10 years, but my web host suggests a SFTP as they are eliminating the older servers. SO this is how I found winscp.

What I would like to do is have it start and run/ logon/ and upload when starting windows. I am using a dinosoar win 98 machine and am trying to not use a monitor, so if it hangs I can just reset my machine and it comes back up after restart.

As I was writing this I also found it hung or errored with 'file not found', but retry got the wheels going again.

I dont know all the proper terminology, but do know a bit- just enough to get me in trouble ;-)

Thanks for the help, and the great program whoever made it.

Steve

Reply with quote

Advertisement

martin
Site Admin
martin avatar
Joined:
Posts:
27,426
Location:
Prague, Czechia

Re: Upload new .jpg file to server (remote directory up to date)

I'm not sure I understand what exactly you want to know/learn. Can you be more specific?

Reply with quote

Guest

I would like to make it happen just turning on the computer. It is a box I only use for this purpose & do not have a monitor hooked up all the time- if I see it not working (via web page) I restart it. I need to upload the new jpg file about every minute.

Reply with quote

smittylube
Joined:
Posts:
11
Location:
US

so I could easily drop winscp into my startup folder.

I figured out how to save my session-with login.. But it only logs me into the proper locations on the local and server, but I would like it to keep up to date from here automatically.
Since I do not care if the console is up or down, can I now create a 'keep remote directory up to date' command somewhere and have it run when winscp starts? or into the 'saved session' I created?

or will I need to do a script sort of like this,,

start winscp,
login www.myserver.com username steve, password ######,
sftp
synchronize remote [ 'f:/cam images/' [ '/home/sslube2/public_html/cam images/' ] ]

and one last question- do I write command scripts on notepad or do I need to start the cmd console then save as ? then put it in my startup folder?

I really appreciate your time,
Thanks,
Steve

Reply with quote

smittylube
Joined:
Posts:
11
Location:
US

This is what I've come up with so far.
I think I understand how to create a batch file, and to make it run on startup,
so now I just need some hand holding on what to put in the .bat file.

basically this is the folder where the file is on my local server
'f:/cam images/'

and it contains one file that is changed constantly.
it needs to upload to this folder on the web server
'/home/sslube2/public_html/cam images/'

I am currently using the 'keep up to date' command from the console and these paths are from the console windows if this helps.

I believe it is a simple task- however I am a mechanic, not a software engineer ;-)

Reply with quote

smittylube
Joined:
Posts:
11
Location:
US

So I'm trying all I know-
I can log in with winscp.com my session etc.

I get 'too many parameters' error when I try

keepuptodate D:\cam images /home/sslube2/public_html/cam images

I am not sure where my error is..
when I typoed keepuptodate D:\cam images it started to watch 1655 directories, but I cancelled it before it uploaded anything. so it appears I am close.

Steve

Reply with quote

martin
Site Admin
martin avatar
Joined:
Posts:
27,426
Location:
Prague, Czechia

smittylube wrote:

got it working
Cool. I would still suggest using scheduler with small intervals and using "put" command. This would be more robust as with your approach it stops working once the connection is lost for whatever reason.
_________________
Martin Prikryl

Reply with quote

smittylube
Joined:
Posts:
11
Location:
US

martin wrote:

smittylube wrote:

got it working
Cool. I would still suggest using scheduler with small intervals and using "put" command. This would be more robust as with your approach it stops working once the connection is lost for whatever reason.

Ok I see what you mean lost the connection overnight already.
I'll give it a try thanks,
Steve

Reply with quote

smittylube
Joined:
Posts:
11
Location:
US

since it seems to work fine currently (untill it lost the connection last night at 3:42 am) - would it make sense to try and just restart it or rerun the script/batch file using scheduler say 2 or 3 times a day? how would I get it to stop the current session if it is still running? or would it conflict with a session in progress?

Reply with quote

martin
Site Admin
martin avatar
Joined:
Posts:
27,426
Location:
Prague, Czechia

It would conflict. I believe scheduler has an option not to start new instance if the previous one is still running.
_________________
Martin Prikryl

Reply with quote

smittylube
Joined:
Posts:
11
Location:
US

Thanks Martin for your help..

ok so then I should write it something like this-

open session ####

put image.jpg

exit

wait 60 sec


open session ####

put image.jpg

exit

would something like this work? is there an option to wait and then relogon or reopen session? if so how would that be written?

Reply with quote

martin
Site Admin
martin avatar
Joined:
Posts:
27,426
Location:
Prague, Czechia

I was wrong in the last post, the actual option the scheduler have is "If the task is still running, stop it at this time".

Anyway, there's no wait command. But you can run WinSCP from batch file in a loop and implement the wait in the batch file.
_________________
Martin Prikryl

Reply with quote

Advertisement

You can post new topics in this forum