LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   perl script for upgrade rhel 6.1 to 6.4 (https://www.linuxquestions.org/questions/linux-newbie-8/perl-script-for-upgrade-rhel-6-1-to-6-4-a-4175452446/)

vikky 03-02-2013 07:42 PM

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

shivaa 03-02-2013 08:09 PM

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


chrism01 03-03-2013 08:02 PM

For updating between minor versions like this, just 'yum update' is enough. Absolutely no need to write a program.

vikky 03-04-2013 06:18 AM

@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...

chrism01 03-04-2013 06:58 AM

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.

shivaa 03-04-2013 07:31 AM

Quote:

Originally Posted by chrism01 (Post 4904289)
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.

Habitual 03-04-2013 11:50 AM

You may want to read this...
How to create a yum repository on RHEL/CentOS 5.x with CD/DVD or ISO images

John VV 03-04-2013 02:22 PM

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 ?

chrism01 03-04-2013 06:59 PM

@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.

vikky 03-12-2014 07:50 PM

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....!!!

chrism01 03-13-2014 05:06 AM

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


All times are GMT -5. The time now is 01:58 PM.