LinuxQuestions.org
Register a domain and help support LQ
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, 08: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, 09: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, 09:02 PM   #3
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Centos 6.8, Centos 5.10
Posts: 17,260

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

Original Poster
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, 07:58 AM   #5
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Centos 6.8, Centos 5.10
Posts: 17,260

Rep: Reputation: 2328Reputation: 2328Reputation: 2328Reputation: 2328Reputation: 2328Reputation: 2328Reputation: 2328Reputation: 2328Reputation: 2328Reputation: 2328Reputation: 2328
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, 08: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 08:33 AM. Reason: Formatting
 
Old 03-04-2013, 12:50 PM   #7
Habitual
LQ Addict
 
Registered: Jan 2011
Posts: 7,680
Blog Entries: 10

Rep: Reputation: 2080Reputation: 2080Reputation: 2080Reputation: 2080Reputation: 2080Reputation: 2080Reputation: 2080Reputation: 2080Reputation: 2080Reputation: 2080Reputation: 2080
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, 03:22 PM   #8
John VV
LQ Muse
 
Registered: Aug 2005
Location: A2 area Mi.
Posts: 16,990

Rep: Reputation: 2448Reputation: 2448Reputation: 2448Reputation: 2448Reputation: 2448Reputation: 2448Reputation: 2448Reputation: 2448Reputation: 2448Reputation: 2448Reputation: 2448
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, 07:59 PM   #9
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Centos 6.8, Centos 5.10
Posts: 17,260

Rep: Reputation: 2328Reputation: 2328Reputation: 2328Reputation: 2328Reputation: 2328Reputation: 2328Reputation: 2328Reputation: 2328Reputation: 2328Reputation: 2328Reputation: 2328
@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, 08:50 PM   #10
vikky
LQ Newbie
 
Registered: Apr 2012
Posts: 26
Blog Entries: 1

Original Poster
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, 06:06 AM   #11
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Centos 6.8, Centos 5.10
Posts: 17,260

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


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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-25-2013 12:26 AM
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 11:01 PM
[SOLVED] How to run properly perl script on RHEL with non root user kviliev Linux - Software 1 02-01-2012 08:16 PM
upgrade RHEL 4.3 to RHEL 4.8 to fix CIFS bug - best practice? jaredk51 Linux - Enterprise 6 04-19-2010 06:35 AM
Converting a Windows Perl script to a Linux Perl script. rubbercash Programming 2 07-19-2004 11:22 AM


All times are GMT -5. The time now is 08:26 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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration