sadm_uninstall.sh

4 minute read

$SADMIN/bin/sadm_uninstall.sh - v1.9
Posted 2021-05-21 - Updated 2021-05-21
Supported on Linux, Aix, MacOS

NAME

sadm_uninstall.sh - Uninstall the SADMIN tools.

SYNOPSIS

sadm_uninstall.sh [-d 0-9] [-h] [-v] [-y]

DESCRIPTION

This script is use to uninstall a SADMIN Client or Server tools from one system. The script detect if it is running on a client or SADMIN server (looking at $SADMIN/cfg/sadmin.cfg). For security reason, when you run the script it will run in ‘dry run’ mode. This means that it will not change or remove anything on the system. But it will show you what it would do when you really uninstall SADMIN. To really uninstall the SADMIN tools, use the ‘-y’ command line option. Be aware that the SADMIN database will be deleted (drop) when uninstalling a SADMIN server installation, this is why the database password is asked during a server uninstall. The database users ‘sadmin’ and ‘squery’ will also be deleted. Lastly, the uninstall will not remove any O/S packages, that were installed (if any) during installation, because you may use one of these packages for some others purposes.

Back to the top

EXAMPLE

Below is an example of running an uninstall dry run on a client. Nothing is change on the system except that it is showing you what it would have done, if your ran it with the option ‘-y’. If you really want to uninstall SADMIN, use the ‘y’ option (sadm_uninstall.sh -y).

Uninstalling a SADMIN client

# sadm_uninstall.sh 
================================================================================
Fri May 21 11:38:38 EDT 2021 - sadm_uninstall.sh V1.9 - SADM Lib. V3.70
Server Name: raspi4.maison.ca - Type: LINUX
UBUNTU 20.04 Kernel 5.4.0-1035-raspi
==================================================
 
Dry Run activated
Use '-y' to really remove 'SADMIN' from this system

Uninstalling a SADMIN client.
Removing client crontab file /etc/cron.d/sadm_client ...
Removing profile script /etc/profile.d/sadmin.sh ...
Removing 'sadmin' user sudo file /etc/sudoers.d/033_sadmin-nopasswd ...
Removing sadmin user 'sadmin' ...
Removing sadmin group 'sadmin' ...
Removing 'SADMIN' line in /etc/environment ...
Removing directory structure /opt/sadmin ...
Uninstall of SADMIN client completed.

==================================================
Script exit code is 0 (Success) and execution time is 00:00:44
History ($SADMIN/dat/rch/raspi4_sadm_uninstall.rch) trim to 35 lines($SADM_MAX_RCLINE=35)
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/raspi4_sadm_uninstall.log) created ($SADM_LOG_APPEND='N').
End of sadm_uninstall.sh - Fri May 21 11:38:41 EDT 2021
================================================================================

Uninstalling a SADMIN server

When uninstalling a SADMIN server, more thing need to be done, every steps that would have been done are show to the user. Again, if you really want to uninstall a SADM server then use the comme line option ‘y’ (sadm_uninstall.sh -y).
Below is an output on the screen when we really happen when we delete the SADMIN server version, using the ‘-y’ option. Be sure that when you run the uninstall script with the ‘-y’ you are outside the $SADMIN directory, so it can be removed properly.

# cd /tmp  (run the uninstall from outside $SADMIN directory)
# sadm_uninstall.sh -y
================================================================================
Sat 22 May 2021 09:56:50 AM EDT - sadm_uninstall.sh V1.9 - SADM Lib. V3.70
Server Name: ubuntu2104.maison.ca - Type: LINUX
UBUNTU 21.04 Kernel 5.11.0-17-generic
==================================================
 
This will remove 'SADMIN Server' from this system, Are you sure [y,n] ? y

Uninstalling a SADMIN server.
Enter MySQL root password (to delete sadmin database or 'q' to Quit) : 
Verifying access to Database ... 
Database access confirmed ...
Removing backup crontab file /etc/cron.d/sadm_backup ...
Removing client crontab file /etc/cron.d/sadm_client ...
Removing server crontab file /etc/cron.d/sadm_server ...
Removing osupdate crontab file /etc/cron.d/sadm_osupdate ...
Removing profile script /etc/profile.d/sadmin.sh ...
Removing 'sadmin' user sudo file /etc/sudoers.d/033_sadmin-nopasswd ...
Removing sadmin user 'sadmin' ...
Making sure database is up ...
Removing database user 'squery' ...
Removing database user 'sadmin' ...
Dropping 'sadmin' database ...
Removing 'SADMIN' line in /etc/hosts
Removing 'SADMIN' line in /etc/environment ...
Removing directory structure /opt/sadmin ...
Uninstall of SADMIN server completed.
root@ubuntu2104:/opt/sadmin# 

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.
-y Really remove SADMIN from this system

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 © 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.

SEE ALSO

sadm_requirements.sh - List/install required SADMIN tools packages
SADMIN installation - SADMIN installation page
sadm_uninstall.sh - Uninstall the SADMIN tools