You will need to send the
b.sh to the remote host and make it executable. Use
sftp for this. You could add this to your script so if you have several servers, an update to
b.sh gets copied out each time.
To get a log file back, again an
sftp get would be appropriate.
The
sftp should be quite straightforward if
ssh is already set up as a password-less connection.
You will end up with something like this logic:-
- Setup generate environment on local server
- For each server in list:-
- Send script with sftp setting the execute on
- Use ssh to run script remotely and generate log file
- Retrieve log file with sftp
- Determine if b.sh needs to flag an error and take action
- Loop with next server in list
As an alternate, you might also consider:-
- Setup generate environment on local server
- For each server in list:-
- Send script with sftp setting the execute on
- Use ssh to run script remotely and generate log file
- Retrieve log file with sftp to a file-name based on the server
- Loop with next server in list
- Process all logs to report as appropriate
Do either of these give you something to build on?
Robin