LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices


Reply
  Search this Thread
Old 06-25-2013, 01:29 PM   #1
random0munky
LQ Newbie
 
Registered: Jul 2011
Location: Washington, USA
Distribution: Ubuntu, CentOS, FreeBSD
Posts: 22

Rep: Reputation: Disabled
Automate 'Remove all Repositories' through SSH


Hey Everyone,

On SLEDs here and need some quick troubleshooting with my script. Wanting to SSH into a large number of desktops, get their repos they currently have and remove them all.

Here's what I have so far:
Code:
#!/bin/bash
hosts='donkey'

for host in $hosts; do
  echo "Connecting to host $host"
  sudo ssh $host "$(zypper repos | grep Yes | cut -f3 -d '|' | sed -e 's/ //') | awk '{ print "zypper rr " $1 }'";
done
I get the output:
Code:
Connecting to host donkey
bash: line 1: Repo1 command not found
bash: line 2: Repo2 command not found
bash: line 3: Repo3 command not found
bash: line 4: Repo4 command not found
(I renamed the repo names for confidentiality purposes)

Thanks
 
Old 06-25-2013, 02:00 PM   #2
random0munky
LQ Newbie
 
Registered: Jul 2011
Location: Washington, USA
Distribution: Ubuntu, CentOS, FreeBSD
Posts: 22

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by random0munky View Post
Hey Everyone,

On SLEDs here and need some quick troubleshooting with my script. Wanting to SSH into a large number of desktops, get their repos they currently have and remove them all.

Here's what I have so far:
Code:
#!/bin/bash
hosts='donkey'

for host in $hosts; do
  echo "Connecting to host $host"
  sudo ssh $host "$(zypper repos | grep Yes | cut -f3 -d '|' | sed -e 's/ //') | awk '{ print "zypper rr " $1 }'";
done
I get the output:
Code:
Connecting to host donkey
bash: line 1: Repo1 command not found
bash: line 2: Repo2 command not found
bash: line 3: Repo3 command not found
bash: line 4: Repo4 command not found
(I renamed the repo names for confidentiality purposes)

Thanks
Nevermind. I just realized I can go by ID number. =)
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
"Have to automate the SSH login procedure through shell scripting" sorav Programming 2 11-21-2007 04:53 AM
How to remove slow repositories? Yast /10.2 lancest SUSE / openSUSE 2 01-17-2007 07:56 PM
LXer: Speaking Unix, Part 6: Automate, automate, automate! LXer Syndicated Linux News 0 01-04-2007 09:54 AM
Automate SSH Script Gentoo20 Linux - General 11 03-22-2006 06:21 PM
how to automate ssh login? Lotharster Linux - Networking 2 12-05-2005 12:54 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Server

All times are GMT -5. The time now is 12:15 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration