Xshell Forum

Run a script which will execute the commands in a file and save seperate log for each command

Last post: Thursday, September 27, 2018 3:17 PM by Support, 1 reply

 
Monday, September 17, 2018 7:21 AM - Mahesh Gaali

Run a script which will execute the commands in a file and save seperate log for each command

 
Hi,

I am working on the telecom server with SSH login. I need to take the log for 100s of commands and save the result of each command in separate log file.


Can you suggest how i can do this task executing the commands from a file and saving the log for each command separately using Xshell. Thank you.

Program Ver. : Xshell 6
Thursday, September 27, 2018 3:17 PM - Support

Re: Run a script which will execute the commands in a file and save seperate log for each command

 
You can use some APIs related to logging. Here is a sample VBscript related to logging.

Sub Main
xsh.Screen.Synchronous = true

'*** StartLog, StopLog ***
xsh.Session.LogFilePath = "your_path\a.log"
xsh.Session.StartLog()
xsh.screen.send("echo a.log"&vbcr)
xsh.screen.send("ls"&vbcr)
xsh.Session.Sleep(1000)
xsh.Session.StopLog()
xsh.Session.LogFilePath = "your_path\b.log"
xsh.Session.Sleep(1000)
xsh.Session.StartLog()
xsh.screen.send("echo b.log"&vbcr)
xsh.screen.send("ls"&vbcr)
xsh.Session.Sleep(1000)
xsh.Session.StopLog()
End Sub

Technical Support

Like us on Facebook
Follow us on Twitter
Visit our blog Blog