sadm_push_sadmin.sh

Updated: 2020/03/05
O/S : Linux

 
NAME

sadm_push_sadmin.sh   -   Push SADMIN server version to one or all actives clients.

 
SYNOPSIS

sadm_push_sadmin.sh     [ -v -h -u -s  ]    [ -d   0-9  ]    [ -c   client hostname  ]   

 
DESCRIPTION
  • This script copy the SADMIN version on the master to one or all actives (System Status set to active in CRUD) clients.
  • If you want to update only one client, use the command line option '-c' and specify the hostname to update.
  • Let's say you have updated your SADMIN master server and you want to update all your clients with this version, this is the script to run
  • By default, this script is not not part of any crontab job, so you need to execute it manually.
  • Non-active clients (System Status is set to inactive in CRUD) are ignored, nothing is update on them.
  • Directories other than the one specified below are left untouched on the client.


  • Operations done for each active clients :
    1. Verify if SSH connection to client working.
    2. Get the directory where SADMIN is install on client via '/etc/environment'.
    3. Copy SADMIN standard directories to clients.
      • Copy standard SADMIN scripts directory ($SADMIN/bin) to corresponding client directory.
      • Copy standard SADMIN StartUp/Shutdown scripts directory ($SADMIN/sys) to corresponding client directory.
      • Copy standard SADMIN packages directory ($SADMIN/pkg) to corresponding client directory.
      • Copy standard SADMIN libraries directory ($SADMIN/lib) to corresponding client directory.
      • Copy standard SADMIN dot configuration files from ($SADMIN/cfg) to corresponding client directory.
      • Copy standard SADMIN dot configuration files from ($SADMIN/sys) to corresponding client directory.
    4. Copy System Monitor Basic files to client.
      • Copy 'nmon' watcher scripts ($SADMIN/usr/mon/swatch_nmon.sh) to corresponding client directory.
      • Copy 'nmon' error text file ($SADMIN/usr/mon/swatch_nmon.txt) to corresponding client directory.
      • Copy System Monitor template (example) script ($SADMIN/usr/mon/stemplate.sh) to corresponding client directory.
      • Copy System Monitor Service Restart script ($SADMIN/usr/mon/srestart.sh) to corresponding client directory.
    5. If copy User directory option is used ('-u').
      • Copy the User script directory ($SADMIN/usr/bin) to corresponding client directory.
    6. If copy SADMIN system directory option is used ('-s').
      • Copy not only the dot files but customized scripts from the system StartUp/Shutdown script directory ($SADMIN/sys) to corresponding client directory.

  • Screen capture when running this script (Witch option -s and -u).
  • 
    ----------
    Processing (3) centos7.maison.ca
    [ OK ] SSH to centos7.maison.ca
    SADMIN is install in /sadmin on centos7.
    [ OK ] rsync -ar --delete /sadmin/bin/ centos7.maison.ca:/sadmin/bin/
    [ OK ] rsync -ar --delete /sadmin/sys/ centos7.maison.ca:/sadmin/sys/
    [ OK ] rsync -ar --delete /sadmin/pkg/ centos7.maison.ca:/sadmin/pkg/
    [ OK ] rsync -ar --delete /sadmin/lib/ centos7.maison.ca:/sadmin/lib/
    [ OK ] rsync -ar --delete /sadmin/usr/bin/ centos7.maison.ca:/sadmin/usr/bin/  (Only when -u specified)
    [ OK ] rsync -ar --delete /sadmin/cfg/.??* centos7.maison.ca:/sadmin/cfg/
    [ OK ] rsync -ar --delete /sadmin/sys/ centos7.maison.ca:/sadmin/sys/          (Only when -s specified)
    ---
    Syncing System Monitor Basic files.
    [ OK ] rsync -ar --delete /sadmin/usr/mon/swatch_nmon.sh centos7.maison.ca:/sadmin/usr/mon/swatch_nmon.sh
    [ OK ] rsync -ar --delete /sadmin/usr/mon/swatch_nmon.txt centos7.maison.ca:/sadmin/usr/mon/swatch_nmon.txt
    [ OK ] rsync -ar --delete /sadmin/usr/mon/stemplate.sh centos7.maison.ca:/sadmin/usr/mon/stemplate.sh
    [ OK ] rsync -ar --delete /sadmin/usr/mon/srestart.sh centos7.maison.ca:/sadmin/usr/mon/srestart.sh
    
    

  • Screen capture when running this script for one server (fedora30).
  • # ${SADMIN}/bin/sadm_push_sadmin.sh -c fedora30
    ================================================================================
    Thu Feb 27 14:08:02 EST 2020 - sadm_push_sadmin.sh V2.16 - SADM Lib. V3.28
    Server Name: holmes.maison.ca - Type: LINUX
    CENTOS 7.7.1908 Kernel 3.10.0-1062.12.1.el7.x86_64
    ==================================================
    
    ==================================================
    Processing all active server(s)
    
    ----------
    Processing (1) fedora30.maison.ca
    [ OK ] SSH to fedora30.maison.ca
    SADMIN is install in /opt/sadmin on fedora30.
    [ OK ] rsync -ar --delete /sadmin/bin/ fedora30.maison.ca:/opt/sadmin/bin/
    [ OK ] rsync -ar --delete /sadmin/sys/ fedora30.maison.ca:/opt/sadmin/sys/
    [ OK ] rsync -ar --delete /sadmin/pkg/ fedora30.maison.ca:/opt/sadmin/pkg/
    [ OK ] rsync -ar --delete /sadmin/lib/ fedora30.maison.ca:/opt/sadmin/lib/
    [ OK ] rsync -ar --delete /sadmin/cfg/.??* fedora30.maison.ca:/opt/sadmin/cfg/
    [ OK ] rsync -ar --delete /sadmin/sys/.??* fedora30.maison.ca:/opt/sadmin/sys/
    ---
    Syncing System Monitor Basic files.
    [ OK ] rsync -ar --delete /sadmin/usr/mon/swatch_nmon.sh fedora30.maison.ca:/opt/sadmin/usr/mon/swatch_nmon.sh
    [ OK ] rsync -ar --delete /sadmin/usr/mon/swatch_nmon.txt fedora30.maison.ca:/opt/sadmin/usr/mon/swatch_nmon.txt
    [ OK ] rsync -ar --delete /sadmin/usr/mon/stemplate.sh fedora30.maison.ca:/opt/sadmin/usr/mon/stemplate.sh
    [ OK ] rsync -ar --delete /sadmin/usr/mon/srestart.sh fedora30.maison.ca:/opt/sadmin/usr/mon/srestart.sh
    
    ----------
    
    ==================================================
    Script return code is 0
    Script execution time is 00:00:09
    Trim History /sadmin/dat/rch/holmes_sadm_push_sadmin.rch to 35 lines
    Requested alert only if script fail (Won't send alert)
    Trim log /sadmin/log/holmes_sadm_push_sadmin.log to 500 lines
    Thu Feb 27 14:08:09 EST 2020 - End of sadm_push_sadmin.sh
    ================================================================================
    

 
OPTIONS

-d
Specify debug level (0-9).
Value of 0 indicate that no debug information is to be displayed.
-h
Display this help and exit.
-v
Output version information and exit.
-u
Copy the User Scripts ($SADMIN/usr/bin) directory content to remote SADMIN client.
-s
Copy the System Startup/Shutdown Script ($SADMIN/sys) directory content to remote SADMIN client.
-c
Push the all non-intrusive directory directories, only the client hostname specified.



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 © 2020 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
sadm_housekeeping_server.sh   (Make $SADMIN server files and directories have proper owner, group and permission)
sadm_client_sunset.sh   (Daily end of the day script)


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

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