Post a reply

Before posting, please read how to report bug or request support effectively.

Bug reports without an attached log file are usually useless.

Options
Add an Attachment

If you do not want to add an Attachment to your Post, please leave the Fields blank.

(maximum 10 MB; please compress large files; only common media, archive, text and programming file formats are allowed)

Options

Topic review

aaronthompson@...

Re: better late, then never

kka wrote:

cmd /c start cmd /c c:\tools\putty\PLINK.EXE -load "WinSCP temporary session" -pw yourpass tail -f "!/!" :mrgreen:


I didn't get this to work, but this works for me:
cmd /C ""c:\Program Files\putty\PLINK.EXE" -load "savedsession" -l myusername -pw mypassword tail -f myRemoteLogFile"
Pathduck

Thanks for confirming, Martin :)

Yeah, that's right - I always assume putty/plink works the same as OpenSSH, but it appears to just ignore :portnumber so -P is needed.

Oh and to be picky - the -P !# should be before the user@host according to the doc (but after still works though):
https://the.earth.li/~sgtatham/putty/latest/htmldoc/Chapter7.html#plink-usage
martin

Pathduck wrote:

Update: So I did a little test and changed the tail command to "hostname; sleep 10" to find what host the temporary session pointed to. It output the host name of the last host I used ctrl+P on.

I think (only a theory) that the session entry will always be pointing to the last host you used Ctrl+P on, as that's when it gets changed. So when plink load the session it only loads the last host you opened putty on?

Might be something weird here at work, Windows Server 2008R2, and I don't have access to regedit so can't verify what happens in there. Also using WinSCP dev build 5.10 7416 so that might be a thing.

Sorry, of course! I've forgot that this is about custom command and not PuTTY command.

I've updated the documentation to use the patterns.
https://winscp.net/eng/docs/custom_commands#tail

Though note that the :!# is wrong. It does not do, what you think. You have to use -P !#.
Pathduck

Update: So I did a little test and changed the tail command to "hostname; sleep 10" to find what host the temporary session pointed to. It output the host name of the last host I used ctrl+P on.

I think (only a theory) that the session entry will always be pointing to the last host you used Ctrl+P on, as that's when it gets changed. So when plink load the session it only loads the last host you opened putty on?

Might be something weird here at work, Windows Server 2008R2, and I don't have access to regedit so can't verify what happens in there. Also using WinSCP dev build 5.10 7416 so that might be a thing.
Pathduck

martin wrote:

Pathduck wrote:

I've changed mine a bit since I often have several connections open and loading the temporary sessions does not work then.

Why wouldn't it work?


Actually, I'm not sure :)
I mean, I tested and it failed on that it couldn't find the temporary session. I think I'll need to test it some more, as it seems to work fine now on the home system, so not sure what happened.

Isn't the "Winscp temporary session" overwritten in registry on each new connection? Or maybe it gets overwritten on changing connected tabs?
martin

Pathduck wrote:

I've changed mine a bit since I often have several connections open and loading the temporary sessions does not work then.

Why wouldn't it work?
Pathduck

That's really awesome - I've been wondering if such a thing was possible, just shows how much versatility WinSCP has :D

I've changed mine a bit since I often have several connections open and loading the temporary sessions does not work then.

cmd /c start "!/!" "%userprofile%\bin\putty\plink.exe" !U@!@:!# tail -f "!/!"


Port (!#) is good to have since it's not always 22 ;)
Also I use key-autentication a lot so I don't need to save the password in the session file.
kka

martin
btw can you include this custom file command into distributive?
kka

thanks for your reply martin, but I don't understand how connection timeout correspond with ability to one button tail log file.
I find it very usefull, when I have to dig log files on an SSH connected hardware for errors

Tail File custom command button v.2.0, now with file name title :)


cmd /c start "!/!" cmd /c c:\tools\putty\PLINK.EXE -load "WinSCP temporary session" -pw Qwerty123 tail -f "!/!" 
kka

better late, then never

cmd /c start cmd /c c:\tools\putty\PLINK.EXE -load "WinSCP temporary session" -pw yourpass tail -f "!/!" :mrgreen:
martin

Re: Feature request?

Danny D wrote:

1. Pipe the output of "tail -f" into the terminal window

This is impossible for technical reasons.

2. Add a "follow" feature to the internal editor of WinSCP
3. Allow the user to set up an external tail program (e.g. http://www.baremetalsoft.com/baretail/index.php), just like an external editor

This request has been added to tracker.

Hm, thinking about it: a "add Putty session here" in the context menu of folders would also be a nice addition (just like "Command Prompt Here" on Windows).

There's no way to tell PuTTY (or SSH terminal in general) in which directory it should start.
Danny D

Feature request?

While trying to do the same (tail -f "!") I came across the same problem and found this thread.

What I'd like to to is to monitor log files with one click. Right now the only solution is to open a Putty session, browse to the path of the file in question and then tail -f.

I could imagine tree solutions:
1. Pipe the output of "tail -f" into the terminal window
2. Add a "follow" feature to the internal editor of WinSCP
3. Allow the user to set up an external tail program (e.g. http://www.baremetalsoft.com/baretail/index.php), just like an external editor

Would there be any chance to have one of the solutions above added to the wish list? I have no particular preference regarding the solution.

Hm, thinking about it: a "add Putty session here" in the context menu of folders would also be a nice addition (just like "Command Prompt Here" on Windows).

Thanks
Danny
martin

Re: Continuous 'tail' command

No, it is not possible.
lhannay

Continuous 'tail' command

Hi,

I have set up 'tail --lines 50 myfilename' as a custom command and it works great. However, when I try to make it continuous, i.e. by adding the '-f' or '--follow' option it doesn't work; instead it aborts with a timeout error.

Is there any way to get the tail command to be more than a one-shot deal?

Thanks,
Larry