sadm_service_ctrl.sh

2 minute read

$SADMIN/bin/sadm_service_ctrl.sh - v2.1
Posted 2021-05-23 - Updated 2021-05-23
Supported on Linux

NAME

sadm_service_ctrl.sh - Enable, disable & get status of system startup and shutdown script

SYNOPSIS

sadm_service_ctrl.sh [-d 0-9] [-h] [-l] [-s] [-u] [-v] 
Can be executed on a client and on the SADMIN Server.

DESCRIPTION

Script is use to set (enable), unset (disable) and list the status of SADMIN Service. When SADMIN service is enable, the following scripts are executed at system startup and shutdown.

At system startup  : $SADMIN/sys/sadm_startup.sh
At system shutdown : $SADMIN/sys/sadm_shutdown.sh

When the SADMIN service is unset (disable), these scripts are not executed. You can get the status of SADMIN service, by using the ‘-l’ command line option. This service support ‘Systemd’ and System V Init (SysV) scheme. As usual these scripts produce log and they can be looked at in “$SADMIN/log”, if there is a need to.

Scripts use for the SADMIN service itself are:

  • For System V Init SADMIN use the template file ‘$SADMIN/cfg/.sadmin.rc’
  • For Systemd SADMIN use the template file ‘$SADMIN/cfg/.sadmin.service’

These files are use by this script to construct the SADMIN service. You don’t need to modify these files, they could modified by future update.

Back to the top

EXAMPLE

Set/Enable the SADMIN service

# sadm_service_ctrl.sh -s
cp /sadmin/cfg/.sadmin.service /etc/systemd/system/sadmin.service ... [OK]
systemctl enable sadmin.service ... [OK]
systemctl stop sadmin.service ... [OK]
systemctl start sadmin.service ... [OK]
systemctl status sadmin.service ... [ OK ]
sadmin.service                                enabled 

Consequence of enabling SADMIN service :
/sadmin/sys/sadm_startup.sh, will be executed at system startup.
/sadmin/sys/sadm_shutdown.sh will be executed on system shutdown.
We encourage you to customize these two scripts to your need.
#

Unset/Disable the SADMIN service

# sadm_service_ctrl.sh -u
systemctl stop sadmin.service ... [OK]
systemctl disable sadmin.service...[OK]
rm -f /etc/systemd/system/sadmin.service ...[OK]

Consequence of disabling SADMIN service :
/sadmin/sys/sadm_startup.sh, will not be executed at system startup.
/sadmin/sys/sadm_shutdown.sh will not be executed on system shutdown.
# 

List the status of the SADMIN service

You can also use the command ‘systemctl status sadmin’ on System system.

# sadm_service_ctrl.sh -l
systemctl status sadmin.service ... [ OK ]
sadmin.service                                enabled 
# 

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.
-l List/Display the status of the SADMIN service
-s Set/Enable execution of startup & shutdown script
-u Unset/Disable execution of startup & shutdown script

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_push_sadmin.sh - Push SADMIN version to one or all actives clients.