Creating Application control scripts (Windows)
This script provides an example of switching a VM server from backup to primary mode. The script should be created for the server 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 (Windows)
Start
- On the server running SCS, create a batch file that is named SC_APPLICATION_SWITCHOVER.BAT, and enter the following commands into the file, depending the SCS release version you are using:
-
For SCS release 8.1.0 and lower:
[+] Commands for SC_APPLICATION_SWITCHOVER.BAT
@echo off
rem set Application and SCS server details
rem Application Details
set dbid=<DBID of the application>
set application=<Name of the Application>
rem SCS server details
set scshost=<IP address of the SCS server>
set scsport=<Port of the SCS server>
rem set the path in which log files will be stored
set Logpath= <Specify the path to log files>
rem for example Logpath= C:\Solution_HA\Logs
rem set the mlcmd utility path
set mlcmdpath= <Specify the mlcmd path >
rem for example mlcmdpath = C:\Program Files (x86)\GCTI\SCServer\Solution_Control_Server
echo ************* %application% Switchover Start ************** >> %Logpath%\Switchover.log
echo %date% >> %Logpath%\Switchover.log
echo %time% >> %Logpath%\Switchover.log
rem checking the status of application
"%mlcmdpath%\mlcmd.exe" -getappstatus-runmode %dbid% -scshost %scshost% -scsport %scsport% 1> %Logpath%\Before_Switch.txt 2>&1
FINDSTR "BACKUP" %Logpath%\Before_Switch.txt > nul
if errorlevel 1 goto end
rem switching application to primary mode
"%mlcmdpath%\mlcmd.exe" -switchapp %dbid% -scshost %scshost% -scsport %scsport%
timeout 2
rem checking the status of application after switchover
"%mlcmdpath%\mlcmd.exe" -getappstatus-runmode %dbid% -scshost %scshost% -scsport %scsport% 1> %Logpath%\After_Switch.txt 2>&1
FINDSTR "PRIMARY" %Logpath%\After_Switch.txt > nul
if not errorlevel 1 goto done
if errorlevel 1 echo %application% switchover failed and switchover ends >> %Logpath%\Switchover.log
exit
:end
echo %application% is not in Backup mode and switchover ends >> %Logpath%\Switchover.log
exit
:done
echo %application% is switched to PRIMARY mode successfully >> %Logpath%\Switchover.log
echo ************** %application% Switchover End ************** >> %Logpath%\Switchover.log
echo. >> %Logpath%\Switchover.log
-
For SCS release 8.1.1 and higher:
[+] Commands for SC_APPLICATION_SWITCHOVER.BAT
@echo off
rem set application SCS and Configuration server details
rem Application Details
set application=<Name of the Application>
rem Configuration server details
set host=<IP address of the config server>
set port=<Port of the config server>
set appname=<App name the config server>
set user=<Config server user name>
set password=<Config server password>
rem SCS server details
set scshost=<IP address of the SCS server>
set scsport=<Port of the SCS server>
rem set the path in which log files will be stored
set Logpath= <Specify the path to log files>
rem for example Logpath=C:\Solution_HA\Logs
rem set the mlcmd utility path
set mlcmdpath= <Specify the mlcmd path>
rem for example mlcmdpath = C:\Program Files (x86)\GCTI\SCServer\Solution_Control_Server
echo ************* %application% Switchover Start ************** >> %Logpath%\Switchover.log
echo %date% >> %Logpath%\Switchover.log
echo %time% >> %Logpath%\Switchover.log
rem checking the status of application
"%mlcmdpath%\mlcmd.exe" -getappstatus-runmode %application% -cshost %host% -csport %port% -csappname %appname% -csuser %user% -cspassword %password% -scshost %scshost% -scsport %scsport% 1> %Logpath%\Before_Switch.txt 2>&1
FINDSTR "BACKUP" %Logpath%\Before_Switch.txt > nul
if errorlevel 1 goto end
rem switching application to primary mode
"%mlcmdpath%\mlcmd.exe" -switchapp %application% -cshost %host% -csport %port% -csappname %appname% -csuser %user% -cspassword %password% -scshost %scshost% -scsport %scsport%
timeout 2
rem checking the status of application after switchover
"%mlcmdpath%\mlcmd.exe" -getappstatus-runmode %application% -cshost %host% -csport %port% -csappname %appname% -csuser %user% -cspassword %password% -scshost %scshost% -scsport %scsport% 1> %Logpath%\After_Switch.txt 2>&1
FINDSTR "PRIMARY" %Logpath%\After_Switch.txt > nul
if not errorlevel 1 goto done
if errorlevel 1 echo %application% switchover failed and switchover ends>> %Logpath%\Switchover.log
exit
:end
echo %application% is not in Backup mode and switchover ends >> %Logpath%\Switchover.log
exit
:done
echo %application% is switched to PRIMARY mode successfully >> %Logpath%\Switchover.log
echo ************** %application% Switchover End ************** >> %Logpath%\Switchover.log
echo. >> %Logpath%\Switchover.log
- In the batch file, replace the variables indicated by angle brackets with appropriate values.
- Repeat these steps to create control scripts for each VM SIP Server and VM Server.
End
Next Steps
Genesys Applications
OR
Back to Task Table