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

Author Message
smittylube
[View user's profile]

Joined: 2010-10-14
Posts: 11
Location: US
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 Wink

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

Steve
Advertisements
martin
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 25015
Location: Prague, Czechia
I'm not sure I understand what exactly you want to know/learn. Can you be more specific?
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.
martin
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 25015
Location: Prague, Czechia
So you can schedule the task:
https://winscp.net/eng/docs/guide_schedule
_________________
Martin Prikryl
smittylube
[View user's profile]

Joined: 2010-10-14
Posts: 11
Location: US
Thank you- I'll see if I can get it to function properly & let you know.

Steve
smittylube
[View user's profile]

Joined: 2010-10-14
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
smittylube
[View user's profile]

Joined: 2010-10-14
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 Wink
smittylube
[View user's profile]

Joined: 2010-10-14
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
smittylube
[View user's profile]

Joined: 2010-10-14
Posts: 11
Location: US
got it working
martin
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 25015
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
smittylube
[View user's profile]

Joined: 2010-10-14
Posts: 11
Location: US
prikryl 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
smittylube
[View user's profile]

Joined: 2010-10-14
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?
martin
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 25015
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
smittylube
[View user's profile]

Joined: 2010-10-14
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?
martin
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 25015
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
smittylube
[View user's profile]

Joined: 2010-10-14
Posts: 11
Location: US
Thank you- I'll see if I can figure it out.
Steve
Advertisements

You can post new topics in this forum






Search Site

What is WinSCP?

It is award-winning SFTP client, SCP client, FTPS client and FTP client integrated into one software program for file transfer to FTP server or secure SFTP server. [More]

And it's free!

Donate

About donations

$9   $19   $49   $99

About donations

Recommend

WinSCP Privacy Policy

WinSCP License