LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 03-02-2013, 07:42 PM   #1
vikky
LQ Newbie
 
Registered: Apr 2012
Posts: 26
Blog Entries: 1

Rep: Reputation: Disabled
Red face perl script for upgrade rhel 6.1 to 6.4


Hello All,

I want to write a perl script for upgrading the rhel 6.1 to 6.4 but as i'm newer to perl not getting much idea:

idea that i'm getting....

create a repo provide a path for rhel 6.4

if already repo is there that can be remove by new one


Please help me more on this by providing the ideas:
so that i can upgrade multiple VM's at a time by running perl script...


Thanks In Advance
 
Old 03-02-2013, 08:09 PM   #2
shivaa
Senior Member
 
Registered: Jul 2012
Location: Grenoble, Fr.
Distribution: Sun Solaris, RHEL, Ubuntu, Debian 6.0
Posts: 1,800
Blog Entries: 4

Rep: Reputation: 286Reputation: 286Reputation: 286
Did you wrtie some script so far.. please share it. Also check RHEL documentations.

As far as I know, following could help (but ensure before you invoke):
Code:
~$ yum check-update
~$ yum upgrade
 
Old 03-03-2013, 08:02 PM   #3
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Rocky 9.2
Posts: 18,360

Rep: Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751
For updating between minor versions like this, just 'yum update' is enough. Absolutely no need to write a program.
 
Old 03-04-2013, 06:18 AM   #4
vikky
LQ Newbie
 
Registered: Apr 2012
Posts: 26

Original Poster
Blog Entries: 1

Rep: Reputation: Disabled
@GURU

this is not about one or two hosts i wanted to upgrade more than 50 hosts at a time..

So it will save a time as we can run the script on screen.

It is time consuming to ssh each host and upgrade it...
 
Old 03-04-2013, 06:58 AM   #5
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Rocky 9.2
Posts: 18,360

Rep: Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751
You should have said...
Anyway, you need a loop eg in bash, that works its way through a list of hostnames, ssh's into each one and runs 'nohup yum -y update >yum.log 2>&1 &'
Main problem is if any errors occur; its a bit risky to automate this. Note also that it may involve a kernel update, in which case a reboot is required, as (in fact ) new kernels are added instead of updating old ones.
 
Old 03-04-2013, 07:31 AM   #6
shivaa
Senior Member
 
Registered: Jul 2012
Location: Grenoble, Fr.
Distribution: Sun Solaris, RHEL, Ubuntu, Debian 6.0
Posts: 1,800
Blog Entries: 4

Rep: Reputation: 286Reputation: 286Reputation: 286
Quote:
Originally Posted by chrism01 View Post
You should have said...
Anyway, you need a loop eg in bash, that works its way through a list of hostnames, ssh's into each one and runs 'nohup yum -y update >yum.log 2>&1 &'
Main problem is if any errors occur; its a bit risky to automate this. Note also that it may involve a kernel update, in which case a reboot is required, as (in fact ) new kernels are added instead of updating old ones.
@Chris:
Using a simple loop will also take a lot of time, as it will update systems one by one. Instead OP can do it in bash with password-less login, as follow:
Code:
#!/bin/bash
LIST=/tmp/serverlist.txt
while read -r server
do
ssh user@$server "nohup yum -y update >yum.log 2>&1 &"
done < $LIST
@OP:
Also consider this link once.

Last edited by shivaa; 03-04-2013 at 07:33 AM. Reason: Formatting
 
Old 03-04-2013, 11:50 AM   #7
Habitual
LQ Veteran
 
Registered: Jan 2011
Location: Abingdon, VA
Distribution: Catalina
Posts: 9,374
Blog Entries: 37

Rep: Reputation: Disabled
You may want to read this...
How to create a yum repository on RHEL/CentOS 5.x with CD/DVD or ISO images
 
Old 03-04-2013, 02:22 PM   #8
John VV
LQ Muse
 
Registered: Aug 2005
Location: A2 area Mi.
Posts: 17,627

Rep: Reputation: 2651Reputation: 2651Reputation: 2651Reputation: 2651Reputation: 2651Reputation: 2651Reputation: 2651Reputation: 2651Reputation: 2651Reputation: 2651Reputation: 2651
well if you want to do a lot of extra work ??
put this in a perl wrapper
Code:
yum --releaseserver=6.4 upgrade
but why one would need to do that ?
 
Old 03-04-2013, 06:59 PM   #9
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Rocky 9.2
Posts: 18,360

Rep: Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751
@shivaa; that's why I specified '&' at the end of the cmd, so it wouldn't wait (and nohup so it won't crash on exit).
I assumed ssh-keys.
 
Old 03-12-2014, 07:50 PM   #10
vikky
LQ Newbie
 
Registered: Apr 2012
Posts: 26

Original Poster
Blog Entries: 1

Rep: Reputation: Disabled
Wink getting kicked out from the console

getting kicked out from the console.Getting below error:

Write failed: Broken pipe

[root@home ~]# cat /etc/ssh/sshd_config |grep ClientAlive*
#ClientAliveInterval 0
#ClientAliveCountMax 3
ClientAliveInterval 60
ClientAliveInterval 60

[root@home ~]# tail -f /var/log/messages
Mar 12 17:18:30 home rpc.statd[18915]: Version 1.2.3 starting
Mar 12 17:18:30 home rpc.statd[18915]: Flags: TI-RPC

Any immediate help would be appreciated....!!!
 
Old 03-13-2014, 05:06 AM   #11
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Rocky 9.2
Posts: 18,360

Rep: Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751
Please start your own new thread a full description of the problem.
Do not hijack an old thread that finished a year ago.
 
  


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
Perl 5.10 on RHEL 6.2: The "for" loop code is not executing within my Perl Script hcbj44 Linux - Newbie 5 01-24-2013 11:26 PM
Upgrade to RHEL 5.3 from RHEL 4.4 only using the kernel rpm of RHEL 5.3 rhystech Red Hat 4 05-28-2012 10:01 PM
[SOLVED] How to run properly perl script on RHEL with non root user kviliev Linux - Software 1 02-01-2012 07:16 PM
upgrade RHEL 4.3 to RHEL 4.8 to fix CIFS bug - best practice? jaredk51 Linux - Enterprise 6 04-19-2010 05:35 AM
Converting a Windows Perl script to a Linux Perl script. rubbercash Programming 2 07-19-2004 10:22 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 06:25 PM.

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