Fairly long time reader, first time poster. I am not a scripter (yet) but I understand/know some basics. Not all the basics, but some.

I've been doing lots of searching but have not found my particular case just yet.

What I'm doing is writing up a script to send multiple rpm files to multiple systems, then remotely executing the rpm installation command and repeat on to the next system.

I have a plain text file that contains a list of the systems (sites.txt). The list of systems are laid out like this in the file:

0123 aa0123

4567 aa4567

8910 aa8910


I want to use this list to pass to the SCP/SSH commands to send the RPM files, then to execute the rpm installation. But I'm not exactly sure how to go about getting the same command to repeat until the list of systems (sites.txt) has run through.

To give more of an idea of what I'm trying to do, here is what I have in the script so far:

for i in cat /tmp/sites.txt | awk '{print $2}' do REG='expr substr $i'

(Is this needed?)

scp /remote/install/* $i:/remote/install; ssh $i "rpm -U /remote/install/*'

Thats what I've got so far.

Any help/advise would be greatly appreciated as I'm not very strong with scripting.


  • 2
    You should drop what you're doing (for ten minutes) and go learn the basics of Ansible. This would be pretty easy to set up in an Ansible playbook. – Michael Hampton May 28 '19 at 20:08
  • Which operating system: Linux, AIX? – John Mahowald May 28 '19 at 20:25
  • As @MichaelHampton already said this is a perfect fit for Ansible – Salsa May 28 '19 at 21:14

Create a yum repo out of that package directory. Share it with http or ftp.

On the hosts, install this yum repo, perhaps call it local. Install and update only these packages: yum --disablerepo='*' --enablerepo=local update '*'

For doing it on many hosts, use automation software. Ansible is very good at just ssh into a box and doing things, in parallel, with decent error handling. This would be a two task Ansible play.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.