Sponsored Content
Top Forums Shell Programming and Scripting to check the Linux upgrade in the host Post 302400278 by drl on Tuesday 2nd of March 2010 09:06:18 PM
Old 03-02-2010
Hi.

I use CentOS 5.4, the free version of RedHat. I looked in /var/log, and found some logs for "yum". Here is a script that shows a sample of when some updates were made:
Code:
#!/usr/bin/env bash

# @(#) s1	Demonstrate time of update.

echo
echo "(Versions displayed with local utility \"version\")"
version >/dev/null 2>&1 && version =o $(_eat $0 $1) 
set -o nounset
echo


ls -l /var/log/yum*

echo
head -3 /var/log/yum.log

exit 0

producing:
Code:
$ ./s1

(Versions displayed with local utility "version")
OS, ker|rel, machine: Linux, 2.6.18-164.11.1.el5, i686
Distribution        : CentOS release 5.4 (Final)
GNU bash 3.2.25

-rw-r--r-- 1 root root  3308 Feb  5 12:00 /var/log/yum.log
-rw-r--r-- 1 root root 43464 Dec 23 18:33 /var/log/yum.log.1
-rw-r--r-- 1 root root 38360 Jan  2  2009 /var/log/yum.log.2

Feb 05 11:50:24 Updated: selinux-policy-2.4.6-255.el5_4.4.noarch
Feb 05 11:50:31 Updated: kernel-headers-2.6.18-164.11.1.el5.i386
Feb 05 11:50:50 Updated: tzdata-2009u-1.el5.noarch

I have no idea if this is always the case for an update. The files may contain more than one set of updates, so you may need to process to collect the unique dates.

Best wishes ... cheers, drl
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Check host file for duplicate entries

I need a KSH script that will check a host file for duplicate IP's and/or host names and report out the errors. Anyone out there have one they would like to share? Something like: Hostname blahblah appears X times IP Address xxx.xxx.xxx.xxx appears X times TIA (4 Replies)
Discussion started by: ThreeDot
4 Replies

2. UNIX for Dummies Questions & Answers

Bash Script to check Remote Host Connection

Hi all, Can anyone tell/guide me how to check remote host is up/running using bash script? Thanks. Zulfiqar (5 Replies)
Discussion started by: zulfikarmd
5 Replies

3. Shell Programming and Scripting

check ssh connection to remote host

I am using KSH and I need to check whether the remote host has been configured with ssh public key. Is there any way we can check inside a script? (6 Replies)
Discussion started by: praveenbvarrier
6 Replies

4. Shell Programming and Scripting

command to check whether the remote host is up or not

Hi, My script needs to check whether the remote host is up or not. If it is up i need to start few servers in that host or else just a notification should be sent that the remote host is down? Could someone help me out in this? Regards Arun (4 Replies)
Discussion started by: arunkumarmc
4 Replies

5. Red Hat

Linux - update/upgrade

Hi, I'm interesting do you have a some solution/good practice how upgrade/update OS with possibility to back previously release (something like Live upgrade in Solaris) ? thanks. (2 Replies)
Discussion started by: deivo
2 Replies

6. Shell Programming and Scripting

Script to check if host key authentication is setup

Hey all, I have a script that I use for some automated installs. Unfortunately for the script to work the server that it's running from needs to have host-key authentication setup to the target server. If it isn't setup beforehand and the script is executed the install partially completes and... (1 Reply)
Discussion started by: Rike255
1 Replies

7. UNIX for Dummies Questions & Answers

Check port 2222 is open on a remote host

I am able to connect to a remote host using the legacy IP and port 2222. Today the remote has a new IP I am unable to connect. How to check if the remote host is blocking or if its my server is unable to connect. Err Msg : telnet: Unable to connect to remote host: Connection refused Err... (5 Replies)
Discussion started by: ITDev01
5 Replies

8. SCO

Upgrade SCO 5.0.2 Host to Enterprise with license

Hello, I have an old system SCO 5.0.2 HOST (without network) and some applications on this machine. Theses applications are not installable again on other system because i have not the routines. And it's now necessary to connect this old system on local network for a "new" application. I have SCO... (13 Replies)
Discussion started by: Lm76
13 Replies

9. Solaris

Solaris live upgrade - how to check if a fs is shared or not

Hi all, 1) how do i check which FS(filesystems) in the current active PBE are shared and not shared with the ABE (alternate boot env) ? is doing lufslist and comparing between the 2 BEs the only option ? 2) when doing a luactivate -s (synchronize), does the synchronization go both way... (0 Replies)
Discussion started by: javanoob
0 Replies

10. UNIX for Beginners Questions & Answers

SFTP file check through a remote host

Hi all, posting my first time, hope not breaking posting rules with it, if yes, let me know. I'm trying to build a script to check a file in an sftp server through a remote server. The intention is to check the file in a sftp host, and if the file is found or not, it should send an email.... (4 Replies)
Discussion started by: MrShinyPants
4 Replies
REDHAT-UPGRADE-TOOL(8)					  redhat-upgrade-tool User Manual				    REDHAT-UPGRADE-TOOL(8)

NAME
redhat-upgrade-tool - Red Hat Upgrade tool SYNOPSIS
redhat-upgrade-tool [OPTIONS] SOURCE DESCRIPTION
redhat-upgrade-tool is the Red Hat Upgrade tool. The redhat-upgrade-tool client runs on the system to be upgraded. It determines what packages are needed for upgrade and gathers them from the source(s) given. It also fetches and sets up the boot images needed to run the upgrade and sets up the system to perform the upgrade at next boot. The actual upgrade takes place when the system is rebooted, using the boot images set up by redhat-upgrade-tool. The upgrade initrd starts the existing system (mostly) as normal, lets it mount all the local filesystems, then starts the upgrade. When the upgrade finishes, it reboots the system into the newly-upgraded OS. OPTIONS
Optional arguments -h, --help Show a help message and exit. -v, --verbose Print more info. -d, --debug Print lots of debugging info. --debuglog DEBUGLOG Write debugging output to the given file. Defaults to /var/log/redhat-upgrade-tool.log. --reboot Automatically reboot to start the upgrade when ready. SOURCE These options tell redhat-upgrade-tool where to look for the packages and boot images needed to run the upgrade. At least one of these options is required. --device [DEV] Device or mountpoint of mounted install media. If DEV is omitted, redhat-upgrade-tool will scan all currently-mounted removable devices (USB disks, optical media, etc.) --iso ISO Installation image file. --network VERSION Online repos matching VERSION (a number or "rawhide") Multiple sources may be used, if desired. Additional options for --network --enablerepo REPOID Enable one or more repos (wildcards allowed). --disablerepo REPOID Disable one or more repos (wildcards allowed). --addrepo REPOID=[@]URL Add the repo at URL. Prefix URL with @ to indicate that the URL is a mirrorlist. --instrepo REPOID Get upgrader boot images from the repo named REPOID. The repo must contain a valid .treeinfo file which points to the location of usable kernel and upgrade images. Cleanup commands --resetbootloader Remove any modifications made to bootloader configuration. --clean Clean up everything written by redhat-upgrade-tool. EXAMPLES
redhat-upgrade-tool --network 7.0 --instrepo <repo URL> Upgrade to RHEL 7.0 by downloading all needed packages and data from the specified repository. redhat-upgrade-tool --device --network 7.0 Upgrade to RHEL 7.0 using install media mounted somewhere on the system, fetching updates from the network if needed. EXIT STATUS
0 Success. 1 Cancelled by user, failure writing files to disk, or other unknown error 2 Failed to download/copy files from the given SOURCE 3 RPM upgrade transaction test failed BUGS
The --iso image must be on a filesystem listed in /etc/fstab. AUTHORS
Will Woods <wwoods@redhat.com> redhat-upgrade-tool 11/08/2013 REDHAT-UPGRADE-TOOL(8)
All times are GMT -4. The time now is 01:55 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy