This page was last edited on July 17, 2020, at 16:05.
Comments or questions about this documentation? Contact us for support!
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:
Start
[+] 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
[+] 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
End