Topic "Simple download from linux webserver to windows client"

Author Message
adrian_vg
[View user's profile]

Joined: 2006-08-21
Posts: 20
Location: Uppsala, Sweden
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.
Advertisements
martin
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 25034
Location: Prague, Czechia
WinSCP does not support this natively. You may use remote-side scripting, as shown in examples.
adrian_vg
[View user's profile]

Joined: 2006-08-21
Posts: 20
Location: Uppsala, Sweden
prikryl wrote:
WinSCP does not support this natively. You may use remote-side scripting, as shown in examples.


Ok, thx. Will look into that.
adrian_vg
[View user's profile]

Joined: 2006-08-21
Posts: 20
Location: Uppsala, Sweden
adrian_vg wrote:
prikryl 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!
nightguy

Guest


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.
martin
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 25034
Location: Prague, Czechia
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
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