Automate Execution of Commands on Remote Linux Server/s using Linux-Automator tool
Linux-Automator is a terminal based tool which uses SSH to connect remote Linux server. You can pass the list of commands from text file and all commands will be executed on remote Linux server in a sequential manner. This will display the execution on terminal.
You can download the tool using this link.
How to call
Linux-Automator Server UserID Password Command_file Pause_time
UserID - Login user name
Password - Password for UserID
Command_file - Command file name with complete path
Pause_time - Time in seconds during which it checks if anything gets printed on the screen, if nothing then it sends the next command. This is optional. Default value is 2 seconds.
Example
Linux-Automator LinuxServer1 test password@123 "E:\Command\commands.txt" 5
Sequential Run on same Terminal
You can call the Linux-Automator from Batch file. You can use below script for your reference to execute the commands on servers in a sequential manner. The execution details will be printed on same terminal for all the servers.
Linux-Automator server2 UserID Password "E:\Command\commands.txt" 4
Linux-Automator server3 UserID Password "E:\Command\command1.txt" 3
Linux-Automator server4 UserID Password "E:\Command\command1.txt" 4
Parallel Run on multiple Terminals
If you want to execute commands in parallel on each server then you can use below script for your reference. This will open one terminal for each server and will start the execution simultaneously.
start Linux-Automator server2 UserID Password "E:\Command\commands.txt" 4
start Linux-Automator server3 UserID Password "E:\Command\command1.txt" 3
start Linux-Automator server4 UserID Password "E:\Command\command1.txt" 4
NOTE: You need to pass the Pause_time carefully. If your command is executing and nothing gets printed on terminal within Pause_time then it will send next command for execution.
This comment has been removed by a blog administrator.
ReplyDeleteThis comment has been removed by a blog administrator.
ReplyDelete