我有一个简单的脚本,它接受用户输入a remote host address然后根据他们为他们想要拖尾的日志做出的选择,脚本将开始拖尾该日志.
例:
printf "\nEnter the customers Cloud URL:\n"
read -r customerURL
printf "\nWhich log do you want to tail?\n1. JLOG\n2. CLOG\n3. HLOG\n"
read -r whichlog
ssh "$customerURL"
tail -f /path/to/log
Run Code Online (Sandbox Code Playgroud)
执行此操作时,脚本会运行,但一旦完成SSH进入主机,它就会结束.我正在尝试做什么?有没有更好的方法来处理这个?
结合ssh和尾部使尾部在远程主机而不是本地主机上运行.
ssh "$customerURL" tail -f /path/to/log
Run Code Online (Sandbox Code Playgroud)