开发者

What's an easy way to automate logging into a server and tailing a log?

开发者 https://www.devze.com 2023-01-18 23:47 出处:网络
I would like to save the keystrokes I make to ssh into a server (with a开发者_运维问答 ssh public key) and tail a log file. What\'s the easiest way to do this. Is there a shell script that can do this

I would like to save the keystrokes I make to ssh into a server (with a开发者_运维问答 ssh public key) and tail a log file. What's the easiest way to do this. Is there a shell script that can do this, or if not, a short Ruby script?


Any reason not to use ssh itself ? ssh server "tail logfile" ?

Or if it's more complicated 'expect' is good for scripting interactive commands.


You can pass a command to the ssh command, instead of starting a shell. (Just add the command after the hostname)

Then it's easy to setup an alias for that ssh command.

0

精彩评论

暂无评论...
验证码 换一张
取 消