sadm_osupdate_farm.sh

Updated: 2018/10/23
O/S : Linux

 
NAME

sadm_osupdate_farm.sh   -   Apply O/S update to all active or selected selected servers

 
SYNOPSIS

sadm_osupdate_farm.sh     [ -v -h  ]    [ -d   0-9  ]    [ -s ]   [ServerName]

 
DESCRIPTION
  • Script is use to apply Operating System update on all servers that have an active status and reachable.
  • If you want to update only one server, use the '-s' option to specify the server name you want to update.
  • This script can be executed only by the 'root' user (or with sudo).
  • No question will be asked when running this script.
  • It support Redhat, CentOS, Fedora, Ubuntu, Debian (family) and Raspbian.
  • To prevent a SADMIN server outage, no automatic reboot will be performed on the SADMIN server.
  • Remember that every SADMIN script produce a 'log' and an 'rch' file, that you can consult afterward.
    • The name of these files are shown at the screen output (See examples below).
    • The content of these files can be viewed from the command line or from the web interface.
  • After performing O/S update of a server, date & ending status are updated in the Database.

  • Example of running the sadm_osupdate_farm.sh script.

        # $SADMIN/bin/sadm_osupdate_farm.sh 
        ===========================================================================
        Starting sadm_osupdate_farm.sh V3.10 - SADM Lib. V2.47
        Server Name: holmes.maison.ca - Type: LINUX
        CENTOS 7.5.1804 Kernel 3.10.0-862.14.4.el7.x86_64
        ==================================================
            
        ***************************************************************************
        Processing (1) centos6.maison.ca - os:linux
        Ping host centos6.maison.ca
        [OK] Ping worked
        Starting sadm_osupdate.sh on centos6.maison.ca
        /bin/ssh -qnp32 centos6.maison.ca /sadmin/bin/sadm_osupdate.sh  -r
        
        ===========================================================================
        Starting sadm_osupdate.sh V3.9 - SADM Lib. V2.47
        Server Name: centos6.maison.ca - Type: LINUX
        CENTOS 6.10 Kernel 2.6.32-754.6.3.el6.i686
        ==================================================
        Reboot requested after successfull update
        Verifying Update Availibility for CENTOS 6
        Running "yum check-update"
        Return Code is 0
        No Update available
        No reboot since no update was applied
        ==================================================
        Script return code is 0
        Script execution time is 00:00:05
        Trim History /sadmin/dat/rch/centos6_sadm_osupdate.rch to 125 lines
        Requested alert only if script fail (Won't send alert)
        Trim log /sadmin/log/centos6_sadm_osupdate.log to 1000 lines
        Wed Oct 24 11:01:56 EDT 2018 - End of sadm_osupdate.sh
        ===========================================================================
        
        Script was submitted with no error.
        Record O/S Update Status & Date for centos6 in DataBase
        Database Update Succeeded
        Total Error is 0 and Warning at 0
            
        ...
        ...
        
        ***************************************************************************
        Processing (19) rhel3.maison.ca - os:linux
        Ping host rhel3.maison.ca
        Error trying to ping host rhel3.maison.ca
        [WARNING] This host is sporadically online
        Will continue with next server
        Error at 0, Warning at 1
        
        ***************************************************************************
        Processing (20) rhel4.maison.ca - os:linux
        Ping host rhel4.maison.ca
        Error trying to ping host rhel4.maison.ca
        [WARNING] This host is sporadically online
        Will continue with next server
        Error at 0, Warning at 2
    
        ***************************************************************************
        Processing (21) ubuntu1404.maison.ca - os:linux
        Ping host ubuntu1404.maison.ca
        Error trying to ping host ubuntu1404.maison.ca
        [WARNING] This host is sporadically online
        Will continue with next server
        Error at 0, Warning at 3
    
        ***************************************************************************
        Processing (23) yoda.maison.ca - os:linux
        Ping host yoda.maison.ca
        [OK] Ping worked
        Starting sadm_osupdate.sh on yoda.maison.ca
        /bin/ssh -qnp32 yoda.maison.ca /sadmin/bin/sadm_osupdate.sh  -r
        
        ===========================================================================
        Starting sadm_osupdate.sh V3.9 - SADM Lib. V2.47
        Server Name: yoda.maison.ca - Type: LINUX
        UBUNTU 16.04 Kernel 4.4.0-138-generic
        ==================================================
        Reboot requested after successfull update
        Verifying Update Availibility for UBUNTU 16
        Resynchronize index files with Internet Sources
        Running "apt-get update"
        Return Code of apt-get update is 0
        Querying list of package that will be updated
        firefox
        1 Updates are available
        ----------
        Starting UBUNTU update process ...
        ----------
        Running : apt-get -y -o Dpkg::Options::='--force-confdef' -o Dpkg::Options::='--force-confold' upgrade
        ----------
        Running : apt-get -y -o Dpkg::Options::='--force-confdef' -o Dpkg::Options::='--force-confold' dist-upgrade
        ----------
        Success execution of apt-get upgrade & apt-get dist-upgrade
        Update successfull, server will reboot in 1 Minute
        Running "/sbin/shutdown -r now" in 1 Minute
        warning: commands will be executed using /bin/sh
        job 20 at Wed Oct 24 11:19:00 2018
        ===========================================================================
        
        ==================================================
        Script return code is 0
        Script execution time is 00:00:44
        Trim History /sadmin/dat/rch/yoda_sadm_osupdate.rch to 125 lines
        Requested alert only if script fail (Won't send alert)
        Trim log /sadmin/log/yoda_sadm_osupdate.log to 1000 lines
        Wed Oct 24 11:18:15 EDT 2018 - End of sadm_osupdate.sh
        ===========================================================================
        
        Script was submitted with no error.
        Record O/S Update Status & Date for yoda in DataBase
        Database Update Succeeded
        
        ----------
        Total Error is 0 and Warning at 3
        
        ==================================================
        Script return code is 0
        Script execution time is 00:16:30
        Trim History /sadmin/dat/rch/holmes_sadm_osupdate_farm.rch to 125 lines
        Requested alert only if script fail (Won't send alert)
        Trim log /sadmin/log/holmes_sadm_osupdate_farm.log to 2000 lines
        Wed Oct 24 11:18:15 EDT 2018 - End of sadm_osupdate_farm.sh
        ===========================================================================
        #
        


    Example of starting a O/S Update of a server ('centos7') from the SADMIN server.


 
OPTIONS

-d
Specify debug level (0-9).
Value of 0 indicate that no debug information is to be displayed.
-s      [ServerName]
Run the O/S update on the specified server.
Server will reboot only if these two conditions are met.
   - If some update were applied.
   - If 'Reboot after O/S Update' field is set to "Yes" for the server in Database.
-h
Display this help and exit.
-v
Output version information and exit.



REQUIREMENTS
 
EXIT STATUS
[0]    An exit status of zero indicates success
[1]    Failure is indicated by a nonzero value, typically ‘1’.

 
AUTHOR
Jacques Duplessis (jacques.duplessis@sadmin.ca.).
Any suggestions or bug report can be sent at http://www.sadmin.ca/support.php

 
COPYRIGHT
Copyright © 2018 Free Software Foundation, Inc. License GPLv3+:
    - GNU GPL version 3 or later http://gnu.org/licenses/gpl.html.
This is free software, you are free to change and redistribute it.
There is NO WARRANTY to the extent permitted by law.

 
SEE ALSO

 
INDEX
NAME
SYNOPSIS
DESCRIPTION
OPTIONS
REQUIREMENTS
EXIT STATUS
AUTHOR
COPYRIGHT
SEE ALSO

Copyright © 2015-2019 - www.sadmin.ca - Suggestions, Questions or Report a problem at support@sadmin.ca