Startup

Environment Variable Check

When X-PUSH is run, set_xpush.bat is called from the startup.bat for Windows, and set_xpush.sh is called from startup.sh for Unix/Linux. set_xpush is a script that sets the environment variables JAVA_HOME and XPUSH_HOME before running X-PUSH. It applies changes to the environment variables (e.g. path) by modifying the script without having to change the system settings.

Windows: set_xpush.bat

The below image is an example of modifying the set_xpush.bat file in Windows.

"rem JAVA_HOME" was changed to "set JAVA_HOME," and the JDK installation path was set as JAVA_HOME. The XPUSH_HOME settings are the same, and the current path for X-PUSH is set. When using the Windows service, set the JSEXE environment variables depending on 32bit/64bit JDK.

@echo off

set JAVA_HOME=C:\Program Files\Java\jdk1.8.0_131
set XPUSH_HOME=D:\xpush\xpush-3.0.0

rem JAVA_OPTS_JMX_SSL=
rem JAVA_OPTS_JMX=%JAVA_OPTS_JMX_SSL% 

if not "%JAVA_HOME%" == "" goto java_home_checked
	echo environment variable JAVA_HOME is not defined.
	goto end

:java_home_checked

if not "%XPUSH_HOME%" == "" goto xpush_home_checked
	set XPUSH_HOME=%cd%\..
	echo WARNING! environment variable XPUSH_HOME is not defined. %XPUSH_HOME% will be used for XPUSH_HOME

:xpush_home_checked

rem JSEXE=%XPUSH_HOME%\bin\javaservice\32\JavaService.exe
set JSEXE=%XPUSH_HOME%\bin\javaservice\64\JavaService.exe

:end

Be sure to exclude the final backslash "\" when setting "C:\xpush-2.8.0" as the XPUSH_HOME environment variable value.

Unix/Linux: set_xpush.sh

The below image is an example of modifying the set_xpush.sh file in Unix/Linux.

"#JAVA_HOME" was changed to "export JAVA_HOME," and the JDK installation path was set as JAVA_HOME. The XPUSH_HOME settings are the same, and the current path for X-PUSH is set.

#!/bin/sh
JAVA_HOME=/home/xpush/jdk8u252-b09
XPUSH_HOME=/home/xpush/xpush/xpush-3.0.0
#JAVA_OPTS=
#CLASSPATH=

#JAVA_OPTS_JMX_SSL=
#JAVA_OPTS_JMX="$JAVA_OPTS_JMX_SSL"

if [ -z "$JAVA_HOME" ] ; then
    echo environment variable JAVA_HOME is not defined.
    exit;
fi

if [ -z "$XPUSH_HOME" ] ; then
    XPUSH_HOME=`cd .. ; pwd`
    echo WARNING! environment variable XPUSH_HOME is not defined. $XPUSH_HOME will be used for XPUSH_HOME
fi

Service Registration/Termination

To register as a service in Windows operating systems, go to "XPUSH_HOME/bin" and run the "install_as_service.bat" file as shown in the figure below.

Be sure to run as an administrator.

D:\xpush-3.0.0\bin>install_as_service.bat
The X-PUSH automatic service was successfully installed
Press any key to continue ...

The following image shows the confirmed service registration.

To terminate a registered service, go to "XPUSH_HOME/bin" and run the "uninstall_from_service.bat" file as shown in the figure below.

D:\xpush-3.0.0\bin>uninstall_from_service.bat
X-PUSH not running.
Press any key to continue ...
Successfully uninstalled service X-PUSH
Press any key to continue ...
D:\xpush-3.0.0\bin>

Startup

To start X-PUSH, execute the "startup.bat" or "startup.sh" script from "$XPUSH_HOME/bin"

Windows: startup.bat

D:\xpush-3.0.0\bin>startup.bat

Unix/Linux: startup.sh

/homexpush/xpush-3.0.0/bin$ ./startup.sh

DB/SSL Encryption startup

A command with the additional key value is run to operate X-PUSH with encrypted DB/SSL information.

D:\xpush-3.0.0\bin>startup.bat encrypt

The key value must be set to 7 characters or less.

If both DB and SSL certificate are encrypted, the key value must be set the same.

shutdown

To shut down X-PUSH, execute the "shutdown.bat" or "shutdown.sh" script from "$XPUSH_HOME/bin"

Windows: shutdown.bat

The "shutdown.bat" script is run with the following parameters:

Parameter

Description

host

X-PUSH server IP address

port

X-PUSH admin port. (Default value: 10083)

id

Admin ID

password

Admin password

shutdown.bat localhost 10083 tobesoft xpush

Unix/Linux: shutdown.sh

Log in with the account used to install the X-PUSH Server, and then go to the "$XPUSH_HOME/bin" directory.

The "shutdown.sh" script is run with the following parameters:

Parameter

Description

host

X-PUSH server IP address

port

X-PUSH admin port. (Default value: 10083)

id

Admin ID

password

Admin password

./shutdown.sh localhost 10083 tobesoft xpush

Post-Installation Operational Check

You can check the installation and normal operation of an X-PUSH Server using the sample included with the deployment copy.

X-PUSH Server Run

Start X-PUSH by executing "startup.bat" in Windows or "startup.sh" in Unix/Linux.

D:\xpush-3.0.0\bin>startup.bat
/homexpush/xpush-3.0.0/bin$ ./startup.sh

Port Check

Use the "netstat" command to verify ports used by X-PUSH.

Port

Service

Remarks

10080

WebPublisher Service

Required

10081

Publisher Service

Required

10082

Provider Service

Required

10083

Monitor Service

Required

10085

JMX Service

Elective

10086

JMX Service

Elective

10087

Node Service

Required

10089

Ssh Service

Elective

D:\xpush-3.0.0\bin>netstat -an | find "1008"
  TCP    0.0.0.0:10080          0.0.0.0:0              LISTENING
  TCP    0.0.0.0:10081          0.0.0.0:0              LISTENING
  TCP    0.0.0.0:10082          0.0.0.0:0              LISTENING
  TCP    0.0.0.0:10083          0.0.0.0:0              LISTENING
  TCP    0.0.0.0:10087          0.0.0.0:0              LISTENING
  TCP    0.0.0.0:10089          0.0.0.0:0              LISTENING
  TCP    [::]:10080             [::]:0                 LISTENING
  TCP    [::]:10081             [::]:0                 LISTENING
  TCP    [::]:10082             [::]:0                 LISTENING
  TCP    [::]:10083             [::]:0                 LISTENING
  TCP    [::]:10087             [::]:0                 LISTENING
  TCP    [::]:10089             [::]:0                 LISTENING

Running Message Client Script

Move to $XPUSH_HOME\bin and run it.

D:xpush-3.0.0\bin> run_client_demo_version_3_push.bat localhost 10081 red tobesoft xpush

/home/xpush/xpush-3.0.0/bin$ run_client_demo_version_3_push.sh localhost 10081 red tobesoft xpush

Message Type

Script Name

Generic/reliable client

run_client_demo_version_3_push.bat/sh

D:\xpush\xpush-3.0.0\bin>run_client_demo_version_3_push.bat localhost 10081 red tobesoft xpush
host=localhost, port=10081, projectid=red, id=tobesoft, password=xpush

are to receive messages by running the script.

Running Message Supply Script

Move to $XPUSH_HOME\bin and run it.

Message Type

Script Name

Generic message

run_provider_demo_2_Push.bat/sh

Reliable message

run_provider_demo_2_Reli.bat/sh

Move to $XPUSH_HOME\bin and run the generic message provider.

C:\xpush-3.0.0\bin>run_provider_demo_2_Push.bat localhost 10082 red tobesoft xpush

/home/xpush/xpush-3.0.0/bin$ ./run_provider_demo_2_Push.sh localhost 10082 red tobesoft xpush
D:\xpush\xpush-3.0.0\bin>run_provider_demo_2_Push.bat localhost 10082 red tobesoft xpush
host=localhost, port=10082, projectid=red, id=tobesoft, password=xpush, version=2
push message sent. 'pushed current time  : 16:48:57'
push message sent. stock code=1001, price=10000
push message sent. 'pushed current time  : 16:48:59'
push message sent. stock code=1002, price=10000
push message sent. 'pushed current time  : 16:49:01'
push message sent. stock code=1003, price=10000
push message sent. 'pushed current time  : 16:49:03'
push message sent. stock code=1004, price=10000

Receiving Message

When the message is provided, the message is pushed to the client by the X-PUSH server. You can see that the message has been received as shown in the following figure.

D:\xpush\xpush-3.0.0\bin>run_client_demo_version_3_push.bat localhost 10081 red tobesoft xpush
host=localhost, port=10081, projectid=red, id=tobesoft, password=xpush
action = 'PUSH'
topic = 'CPDT', '1001'
message = '10000'
action = 'PUSH'
topic = 'OPDT', 'ALL'
message = 'pushed current time  : 16:48:57'
action = 'PUSH'
topic = 'CPDT', '1002'
message = '10000'
action = 'PUSH'
topic = 'OPDT', 'ALL'
message = 'pushed current time  : 16:48:59'
action = 'PUSH'
topic = 'CPDT', '1003'
message = '10000'
action = 'PUSH'
topic = 'OPDT', 'ALL'
message = 'pushed current time  : 16:49:01'
action = 'PUSH'
topic = 'CPDT', '1004'
message = '10000'
action = 'PUSH'
topic = 'OPDT', 'ALL'
message = 'pushed current time  : 16:49:03'