sadm_osupdate_starter.sh

3 minute read

NAME

sadm_osupdate_starter.sh
Run the O/S update to selected remote system

SYNOPSIS

sadm_osupdate_starter.sh [-d 0-9] [-h] [-v] [hostname]
$SADMIN/bin/sadm_osupdate_starter.sh - v4.5
Posted 2021-06-06 - Updated 2021-06-06
Supported on Linux
Can only be run on SADMIN Server.

DESCRIPTION

The function of this script is to start the O/S update on the remote system it receive as a parameter. The script read the system information from the database and if a reboot is allowed after the update of the system, the option “-r” is passed to the sadm_osupdate.sh script.

Since we know that the update will be running on the remote system, we don’t want to be alerted that the system doesn’t respond (may be the system is rebooting after the update), a lock file ($SADMIN/tmp/hostname.lock) is created before launching the update on the remote system. When the O/S update is finished this lock file is removed. All SADMIN scripts check this lock file before issuing an alert, if it exist then no alert is issued.

Back to the top

EXAMPLE

# sadm_osupdate_starter.sh fedora33
================================================================================
Mon Jun  7 12:44:52 EDT 2021 - sadm_osupdate_starter.sh V4.5 - SADM Lib. V3.70
Server Name: holmes.maison.ca - Type: LINUX
CENTOS 7.9.2009 Kernel 3.10.0-1160.25.1.el7.x86_64
==================================================
 
[ OK ] Ping host fedora33.maison.ca.
[ OK ] '/opt/sadmin/bin/sadm_osupdate.sh' exist & executable on fedora33.maison.ca.
[ OK ] Lock File (/sadmin/tmp/fedora33.lock) created, monitoring suspended.
 
Starting the O/S update on 'fedora33'.
/bin/ssh -qnp32 fedora33.maison.ca '/opt/sadmin/bin/sadm_osupdate.sh -r'

================================================================================
Mon 07 Jun 2021 12:45:11 PM EDT - sadm_osupdate.sh V3.26 - SADM Lib. V3.70
Server Name: fedora33.maison.ca - Type: LINUX
FEDORA 33 Kernel 5.12.8-200.fc33.x86_64
==================================================
 
Verifying update availability for FEDORA v33
Checking for new update, with 'dnf check-update'
[ OK ] Update available.
----------
Starting FEDORA update process ...
Running : dnf -y update
Return Code after dnf program update is 0.
----------

==================================================
Script exit code is 0 (Success) and execution time is 00:01:09
History (/opt/sadmin/dat/rch/fedora33_sadm_osupdate.rch) trim to 35 lines.
Script will send an alert only when it terminate with error ($SADM_ALERT_TYPE=1).
Script succeeded, no alert will be send to 'default' alert group.
New log (/opt/sadmin/log/fedora33_sadm_osupdate.log) created ($SADM_LOG_APPEND='N').
End of sadm_osupdate.sh - Mon 07 Jun 2021 12:46:03 PM EDT
================================================================================


O/S Update completed on 'fedora33'.
[ OK ] Lock File (/sadmin/tmp/fedora33.lock) removed.

==================================================
Script exit code is 0 (Success) and execution time is 00:01:16
History (/sadmin/dat/rch/holmes_sadm_osupdate_starter.rch) trim to 60 lines.
Script will send an alert only when it terminate with error ($SADM_ALERT_TYPE=1).
Script succeeded, no alert will be send to 'default' alert group.
Log /sadmin/log/holmes_sadm_osupdate_starter.log trim to 5000 lines ($SADM_MAX_LOGLINE=5000).
End of sadm_osupdate_starter.sh - Mon Jun  7 12:46:04 EDT 2021
================================================================================

Back to the top

OPTIONS

Options Description
[ -d 0-9 ] Set debug level from 0 to 9 (Default is 0)
[ -h ] Display this help and exit.
[ -v ] Output version information and exit.

ENVIRONMENT

  • The “$SADMIN” environment variable must be defined and contains the root directory of the SADMIN tools (normally /opt/sadmin). It should be already done, the setup script have updated the ‘/etc/profile.d/sadmin.sh’ and the ‘/etc/environment’ files.
  • The SADMIN configuration file, is needed and loaded in memory at the beginning of every scripts. This file should already exist and contains your SADMIN configuration and preference setting.
  • For Shell script the Shell Library is used and for Python script the Python Library is used.

EXIT STATUS

Exit Code Description
0 An exit status of zero indicates success.
1 Failure is indicated by a nonzero value, typically ‘1’.

AUTHOR

Jacques Duplessis
Any suggestions or bug report can be submitted at the support page

Copyright © 2022 Free Software Foundation, Inc. License GPLv3+: GNU GPL version 3 or later
This is free software, you are free to change and redistribute it.
There is NO WARRANTY to the extent permitted by law.

SEE ALSO

sadm_fetch_clients.sh - rsync all .rch/.log/.rpt from actives clients to the SADMIN server.
sadm_osupdate.sh - Perform Operating System update on the current server
sadm_osupdate_starter.sh - Run the O/S update to selected remote system