sadm_wrapper.sh - Wrapper to run your existing scripts and benefit of SADMIN tools.
sadm_wrapper.sh [-d 0-9] [-h] [-v]
The SADMIN script wrapper is used to run your existing script and see the benefits of it. After you used it once, take a look at the log (in $SADMIN/log) and .rch ($SADMIN/dat/rch) files from the command line or from the web interface. Let’s see it in action, first let’s create a test script, with the editor of your choice, create the file $SADMIN/usr/bin/show_date.sh
/sadmin/usr/bin$ vi show_date.sh #! /usr/bin/env sh echo "Today is `date`"
Run it using the SADMIN wrapper
/sadmin/usr/bin$ cat $SADMIN/log/holmes_show_date.log 2018.11.03 13:47:37 ================================================================================ 2018.11.03 13:47:37 Starting show_date.sh V1.6 - SADM Lib. V2.50 2018.11.03 13:47:37 Server Name: holmes.maison.ca - Type: LINUX 2018.11.03 13:47:37 CENTOS 7.5.1804 Kernel 3.10.0-862.14.4.el7.x86_64 2018.11.03 13:47:37 ================================================== 2018.11.03 13:47:37 2018.11.03 13:47:37 2018.11.03 13:47:37 Executing /sadmin/usr/bin/show_date.sh 2018.11.03 13:47:37 Today is Sat Nov 3 13:47:37 EDT 2018 2018.11.03 13:47:37 2018.11.03 13:47:37 ================================================== 2018.11.03 13:47:37 Script return code is 0 2018.11.03 13:47:37 Script execution time is 00:00:00 2018.11.03 13:47:37 Trim History /sadmin/dat/rch/holmes_show_date.rch to 125 lines 2018.11.03 13:47:37 Requested alert only if script fail (Won't send alert) 2018.11.03 13:47:37 Trim log /sadmin/log/holmes_show_date.log to 2000 lines 2018.11.03 13:47:37 Sat Nov 3 13:47:37 EDT 2018 - End of show_date.sh 2018.11.03 13:47:37 ================================================================================ 2018.11.03 13:47:37 /sadmin/usr/bin$
View the generated Result Code History (*.rch) file
|-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.|
- 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.
|0||An exit status of zero indicates success.|
|1||Failure is indicated by a nonzero value, typically ‘1’.|
Copyright © 2021 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.