sadm_push_sadmin.sh

4 minute read

$SADMIN/bin/sadm_push_sadmin.sh - v2.2
Posted 2021-05-22 - Updated 2021-05-22
Supported on Linux, Aix, MacOS

NAME

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

SYNOPSIS

sadm_push_sadmin.sh [-d 0-9] [-h] [-n hostname ] [-s] [-u] [-v]
Can only be run on SADMIN Server.

DESCRIPTION

This script copy the SADMIN version of the master to one or all actives clients. If you want to update only one client, use the command line option ‘-n’ and specify the hostname to update. Let’s say you have just updated your SADMIN master server and you want to update all your clients, this is the script to run. By default, this script is not part of any crontab job, so you need to execute it manually or place it in the server crontab (/etc/cron.d/sadm_server). Non-active clients (status set to inactive in CRUD) are ignored. Directories others than the one specified below are left untouched on the client. So don’t worry, it will update only SADMIN files and scripts, your SADMIN configuration files, scripts (in $SADMIN/usr/bin) are left untouched by this push.

  • Use the ‘-s’ to push the startup & shutdown script to all your clients. This option is useful if you are using the same startup and shutdown scripts for all your clients.
  • The ‘-u’ option allow you to also push the “$SADMIN/usr” directories to the clients.

Operations done for each active clients :

  • Verify if SSH connection to client is working.
  • Get the directory where SADMIN is install on client via ‘/etc/environment’.
  • Copy scripts directory ($SADMIN/bin) to corresponding client directory.
  • Copy packages directory ($SADMIN/pkg) to client directory.
  • Copy libraries directory ($SADMIN/lib) to client directory.
  • Copy the alert group and Slack configuration files to client directory.
  • If user directory option is used (‘-u’).
    • Copy user directories ($SADMIN/usr/bin,$SADMIN/usr/lib,$SADMIN/usr/cfg) to client.
  • Copy dot configuration template files from ($SADMIN/cfg) to client directory.
  • Copy dot configuration template files from ($SADMIN/sys) to client directory.
  • If system startup/shutdown directory option is used (‘-s’).
    • Copy customized scripts of Startup/Shutdown ($SADMIN/sys) to client.
    • See how to use the startup/shutdown script with sadm_service.sh
  • System Monitor scripts and templates
    • Copy ‘nmon’ watcher scripts ($SADMIN/usr/mon/swatch_nmon.sh) to client.
    • Copy ‘nmon’ error text file ($SADMIN/usr/mon/swatch_nmon.txt) to client.
    • Copy Monitor template script ($SADMIN/usr/mon/stemplate.sh) to client.
    • Copy Monitor Service Restart script ($SADMIN/usr/mon/srestart.sh) to client.

Back to the top

EXAMPLE

root@holmes:~ # sadm_push_sadmin.sh 
================================================================================
Sat May 22 11:37:05 EDT 2021 - sadm_push_sadmin.sh V2.30 - 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
==================================================
 
----------
Processing (1) borg.maison.ca 
[ OK ] SSH to borg.maison.ca
[ OK ] SADMIN is install in /opt/sadmin.
[ OK ] rsync -ar --delete /sadmin/bin/ borg.maison.ca:/opt/sadmin/bin/
[ OK ] rsync -ar --delete /sadmin/pkg/ borg.maison.ca:/opt/sadmin/pkg/
[ OK ] rsync -ar --delete /sadmin/lib/ borg.maison.ca:/opt/sadmin/lib/
[ OK ] rsync -a /sadmin/cfg/alert_group.cfg borg.maison.ca:/opt/sadmin/cfg/alert_group.cfg
[ OK ] rsync -a /sadmin/cfg/alert_slack.cfg borg.maison.ca:/opt/sadmin/cfg/alert_slack.cfg
[ OK ] rsync -ar --delete /sadmin/cfg/.??* borg.maison.ca:/opt/sadmin/cfg/
[ OK ] rsync -ar --delete /sadmin/sys/.??* borg.maison.ca:/opt/sadmin/sys/
[ OK ] rsync -ar --delete /sadmin/usr/mon/swatch_nmon.sh borg.maison.ca:/opt/sadmin/usr/mon/swatch_nmon.sh
[ OK ] rsync -ar --delete /sadmin/usr/mon/swatch_nmon.txt borg.maison.ca:/opt/sadmin/usr/mon/swatch_nmon.txt
[ OK ] rsync -ar --delete /sadmin/usr/mon/stemplate.sh borg.maison.ca:/opt/sadmin/usr/mon/stemplate.sh
[ OK ] rsync -ar --delete /sadmin/usr/mon/srestart.sh borg.maison.ca:/opt/sadmin/usr/mon/srestart.sh

----------
Processing (2) centos6.maison.ca 
[ WARNING ] Can't SSH to sporadic server centos6.maison.ca
...
...

Example using command line option :
-u Also sync $SADMIN/usr/bin, $SADMIN/usr/lib and $SADMIN/usr/cfg to all active clients
-n Push SADMIN version only to system specified
-s Also sync $SADMIN/sys to all active clients

sadm_pusg_sadmin_us.png

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.
-n hostname Push SADMIN version only to system specified
-s Also sync $SADMIN/sys to all active clients
-u Also sync $SADMIN/usr/bin to all active clients

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_service_ctrl.sh - Enable, Disable and get status of system startup and shutdown script
SADMIN installation - SADMIN installation page
How-to Add a client - How-to add a client to SADMIN inventory
How-to Remove a client - How-to remove a client from SADMIN inventory
How-to update SADMIN - How-to update to latest version of SADMIN