Simple download from linux webserver to windows client

Advertisement

adrian_vg
Joined:
Posts:
20
Location:
Uppsala, Sweden

Simple download from linux webserver to windows client

Just want to do a simple log-download from a linux webserver to a windows client and rename the local file to include a YYYY-MM-DD date.

So far I have a script file containing (script.txt):

rem get /var/log/httpd/webserver_access_log C:\logs\*_%date%.log
rem get /var/log/httpd/webserver_access_log C:\logs\*_'date +%F%'.log
get /var/log/httpd/webserver_access_log C:\logs\*+%F.log
exit

and a scheduled task in windows, running the cmd-file containing the below line:

winscp3.exe user@webserver.domain.local /console /script=C:\logs\script.txt

The file downloads properly, but the rename fails on the windowss side, it just adds some weird looking thing, something like "webserver_access_log_%25date%25.log.

I don't have php or any scripting languange installed in windows, and would prefer leaving it that way. A simple download and rename is all I want - When the log is there in windows, I'm passing it to Analog to create some nice stats, again in windows.

It's rather obvious I'm missing something somewhere, so pls, if anybody could hint me or so, I'd be very grateful!

TIA.

Reply with quote

Advertisement

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

Re: Simple download from linux webserver to windows client

WinSCP does not support this natively. You may use remote-side scripting, as shown in examples.

Reply with quote

adrian_vg
Joined:
Posts:
20
Location:
Uppsala, Sweden

Re: Simple download from linux webserver to windows client

martin wrote:

WinSCP does not support this natively. You may use remote-side scripting, as shown in examples.

Ok, thx. Will look into that.

Reply with quote

adrian_vg
Joined:
Posts:
20
Location:
Uppsala, Sweden

Re: Simple download from linux webserver to windows client

adrian_vg wrote:

martin wrote:

WinSCP does not support this natively. You may use remote-side scripting, as shown in examples.

Ok, thx. Will look into that.

Worked like a charm! Turns out it was simpler than anticipated... 8-]

I used the below for script.txt:

call cp /var/log/httpd/webserver_access_log /tmp/webserver_access_log.`date +%F`.unique
get /tmp/*.unique *.log
exit

In windows it produces a file "webserver_access_log.2006-08-22.log". Paired with a proper association for the .log-extension eg Notepad will be used to open it.

Thx for a great piece of software!

Reply with quote

nightguy
Guest

My scheduled task in windows for WinSCP is not running

My scheduled task in windows is not able to run and giving me the Last Result is 0x1
RUN: "C:\Program Files (x86)\WinSCP3\WinSCP3.exe" /console /script=MoveBackup.txt
Start in: "C:\Program Files (x86)\WinSCP3"

However, I successfullu ran this command on Command Prompt but not Window Schedule Task.

Please advice.

Reply with quote

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

Re: My scheduled task in windows for WinSCP is not running

nightguy wrote:

My scheduled task in windows is not able to run and giving me the Last Result is 0x1
RUN: "C:\Program Files (x86)\WinSCP3\WinSCP3.exe" /console /script=MoveBackup.txt
Start in: "C:\Program Files (x86)\WinSCP3"

However, I successfullu ran this command on Command Prompt but not Window Schedule Task.
Have you read FAQ?
_________________
Martin Prikryl

Reply with quote

Advertisement

You can post new topics in this forum