Creating Application control scripts (Linux)
This script provides an example of switching a VM server from backup to primary mode. A similar script should be created for all servers running SCS.
The MLCMD utility that is installed with SCS can be used to switch any application.
The following arguments are mandatory for the MLCMD command:
- For SCS release 8.1.0 and lower
- DBID of the application
- SCS host IP and SCS T-Lib port
- For SCS release 8.1.1 and higher
- Application name
- Configuration Server IP, Port, Application Name, Username & Password
- SCS host IP and SCS T-Lib port (Optional)
Creating Application control scripts (Linux)
Start
- For SCS release 8.1.0 and lower, on all servers running SCS, create a shell file that is named SC_APPLICATION_SWITCHOVER.SH, and enter the following commands into the file:
[+] Commands for SC_APPLICATION_SWITCHOVER.SH
#!/bin/sh
# Set application and SCS server details
# Application Details
dbid=<dbid of the Application>
application=<Name of the Application>
# Solution Control Server details
host=<IP address of the SCS server>
port=<Port of the SCS server>
# Set the path in which log files will be stored
Logpath= <Specify the path to log files>
# for example Logpath=/home/Logs
# Set the mlcmd utility path
mlcmdpath= <Specify the mlcmd path >
# For example mlcmdpath = /opt/genesys/scs
echo -e "Checking mode for switchover - $application \n" >> $Logpath/Switchover.log
date >> $Logpath/Switchover.log
# checking application mode - switchover if backup
init_status=$ ($mlcmdpath/mlcmd_64 -getappstatus-runmode $dbid -scshost $host -scsport $port 2>&1 | grep -w "BACKUP")
if [ "$init_status" ]
then
echo $init_status >> $Logpath/Switchover.log
$mlcmdpath/mlcmd_64 -switchapp $dbid -scshost $host -scsport $port
else
echo "$application Application is already in primary mode or not started" >> $Logpath/Switchover.log
exit
fi
sleep 3
# checking whether Application switchover occurred correctly
switch_status=$($mlcmdpath/mlcmd_64 -getappstatus-runmode $dbid -scshost $host -scsport $port 2>&1 | grep -w "PRIMARY")
if [ "$switch_status" ]
then
echo "Switchover of $application Success" >> $Logpath/Switchover.log
else
echo "Switchover of $application failed" >> $Logpath/Switchover.log
fi
echo -e "\n# $application Switchover End #" >> $Logpath/Switchover.log
echo -e "------------------------------------------\n\n" >> $Logpath/Switchover.log
- In the shell file, replace the variables indicated by angle brackets with appropriate values.
- For SCS release 8.1.1 and higher, on all servers running SCS, create a shell file that is named SC_APPLICATION_SWITCHOVER.SH, and enter the following commands into the file:
[+] Commands for SC_APPLICATION_SWITCHOVER.SH
#!/bin/sh
# Set Application SCS and Config server details
# Application Details
application=<Name of the Application>
# Config server Details
host=<IP address of the config server>
port=<Port of the config server>
appname=<App name the config server>
user=<Config server user name>
password=<Config server password>
# Solution Control Server details
host=<IP address of the SCS server>
port=<Port of the SCS server>
# Set the path in which log files will be stored
Logpath= <Specify the path to log files>
# for example Logpath=/home/Logs
# Set the mlcmd utility path
mlcmdpath= <Specify the mlcmd path >
# For example mlcmdpath = /opt/genesys/scs
echo -e "Checking mode for switchover - $application \n" >> $Logpath/Switchover.log
date >> $Logpath/Switchover.log
# checking application mode - switchover if backup
init_status=$($mlcmdpath/mlcmd_64 -getappstatus-runmode $application -cshost $host -csport $port -csappname $appname -csuser $user -cspassword $password -scshost $scs_host -scsport $scs_port 2>&1 | grep -w "BACKUP")
if [ "$init_status" ]
then
echo $init_status >> $Logpath/Switchover.log
$mlcmdpath/mlcmd_64 -switchapp $application -cshost $host -csport $port -csappname $appname -csuser $user -cspassword $password -scshost $scs_host -scsport $scs_port
else
echo "$application Application is already in primary mode or not started" >> $Logpath/Switchover.log
exit
fi
sleep 3
# checking whether Application switchover occurred correctly
switch_status=$($mlcmdpath/mlcmd_64 -getappstatus-runmode $application -cshost $host -csport $port -csappname $appname -csuser $user -cspassword $password -scshost $scs_host -scsport $scs_port 2>&1 | grep -w "PRIMARY")
if [ "$switch_status" ]
then
echo "Switchover of $application Success" >> $Logpath/Switchover.log
else
echo "Switchover of $application failed" >> $Logpath/Switchover.log
fi
echo -e "\n# $application Switchover End #" >> $Logpath/Switchover.log
echo -e "------------------------------------------\n\n\n" >> $Logpath/Switchover.log
- In the shell file, replace the variables indicated by angle brackets with appropriate values.
End
Next Steps
Genesys Applications
OR
Back to Task Table