Hello.
First of all, sorry for this "newbie question", I'm starting now with scripting for remote actions.
We need to install one package on about 120 Linux CentOS machines.
It is something like this:
- Open SSH connection (with usr/pwd configured on the session)
- Execute: sudo yum install -y package-name
- Password for this "sudo" is the same that for SSH access.
- Exit
Is it possible to select 20 sessions (or 10 or 50...) and launch these commands on them?
Could we save a log to check for errors on the execution in any of the machines?
Thanks in advance.
Best Regards,
Héctor
Hello Hector,
I'm not sure if this help but we have added a new session script tool to execute an SSH command. This is in the latest version:
http://cdn.devolutions.net/download/Setup.RemoteDesktopManager.11.0.4.0.exe
David Hervieux
Ok, thank you David, I'll update RDM version and check this option.
Hello.
I was using this option last days (thanks David for the link to "extra download" :)) and it saves me too many time, because I've generated 2 scripts and I've added a macro to execute "sudo -i" with a password when open SSH connection:
- Macro to execute "sudo -i" --> Perfect, although I expect to use $PASSWORD$ variable (SSH session password) instead of $MACRO_PASSWORD$ (recognised bug :)).
- Script to execute "yum install -y package-name" --> Perfect, only one line with "yum install -i package-name{ENTER}" (without quotation marks).
These two scripts worked perfectly with about 10-15 SSH sessions at once, so I've created another two scripts to modify two config files, but the results were not the same, unfortunately.
First part of both scripts: Rename the config file to create the file with the correct parameters --> Ok, one line with the "mv" command.
Second part: Execute vi and include all parameters. Something like this:
--------
vim /etc/ocsinventory/ocsinventory-agent.cfg{ENTER}
i
#{ENTER}
# OCS Inventory "Unix Unified Agent" Configuration File{ENTER}
#{ENTER}
# options used by cron job overides this (see /etc/sysconfig/ocsinventory-agent){ENTER}
#{ENTER}
{ENTER}
# Server URL, unconmment if needed{ENTER}
# server = your.ocsserver.name{ENTER}
# local = /var/lib/ocsinventory-agent{ENTER}
server = Server_IP{ENTER}
{ENTER}
# Administrative TAG (optional, must be filed before first inventory){ENTER}
# tag = your_tag{ENTER}
{ENTER}
# How to log, can be File,Stderr,Syslog{ENTER}
logger = Stderr{ENTER}
logfile = /var/log/ocsinventory-agent/ocsinventory-agent.log{ENTER}
{ESC}
:wq{ENTER}
{DELAY}
{ENTER}
---------
Sending this script to only one session, it works fine, although sometimes it exits adding "2R" to command line (I don't know why, all VM are the same CentOS version).
But if I try to send this script to more sessions at once, it only gets executed in the first session, even sometimes it mixes code in the file of the first session.
I don't know if this behaviour is due to vi editing, which "superposes" vi window over terminal output and shows terminal output again when vi is closed, so when I send the script to more than one session at a time, when vi opens its "window", it takes control of the session even when the script is sent to another different session.
Do you understand my explanation?
Anyway, thank you for this option because it has saved me too much time; but if I could had sent these two scripts to more sessions at once, it could have been more free time for me :)
Regards,
Héctor
Hello Hector,
Do you use RDM 32 bit or 64 bit?
David Hervieux
Hello David.
I use RDM 64 bit.
Regards,
Héctor
Could you try it with RDM 32 bit. I know that in 32 bit we have a different way of sending the script.
David Hervieux
Hello David.
I've updated RDM today to version 11.0.9.0 beta and I've tried to execute that script in 3 sessions at once... Perfect!!
It is working on both versions, 32 bit and 64 bit.
Thank you very much for your help.
Regards,
Héctor