Linux - Create a Service
Follow these steps to create a service to run the SuperSTAR server applications on Linux.
These steps describe the process for cases where SuperADMIN Server and SuperSERVER are both installed on the same machine. If you are installing them separately on different instances then simply repeat the steps on both machines. When you get to step 2, you only need to create the superadmin.service file on the SuperADMIN machine and the superserver.service file on the SuperSERVER machine, and enable only the relevant service on each machine in step 3.
In addition, when installing the components on separate machines, omit the Requires=superadmin.service
line from the superserver.service file.
Step 1 - Prepare the Environment and Extract the Installation Files
Create a dedicated system user for running the service:
CODEuseradd -r -s /bin/false superstar
Install Java 11 if it is not already present. For example, if you are using an AWS Linux instance you can use a command similar to the following:
CODEsudo amazon-linux-extras install java-openjdk11
If you are not using the AWS Linux Extras version of Java, create a symbolic link between the actual location where Java is installed and
/usr/lib/jvm/jre
if one does not already exist. For example:CODEln -s /usr/lib/jvm/jdk_openjdk-11 /usr/lib/jvm/jre
This is required in order for the services to start Java. Note that if you update the Java version in future you may need to update the symlink accordingly.
- Unzip and untar the SuperSERVER_SA package to /opt/STR
Use the
chown
command to change ownership of the entire /opt/STR folder to your dedicated SuperSTAR system user. For example:CODEsudo chown -R superstar:superstar /opt/STR
Step 2 - Create the Service
To create the services, create the following text files and save them both to /etc/systemd/system (replace <SA_Hostname>
with the hostname of the SuperADMIN Server instance).
superadmin.service
[Unit]
Description=SuperADMIN server daemon
After=network.target remote-fs.target nss-lookup.target
[Service]
Environment=SA_HOME=/opt/STR/SuperADMIN/server
Environment=JASDB_HOME=/opt/STR/SuperADMIN/server/jasdb
Environment=JAVA_HOME=/usr/lib/jvm/jre
User=superstar
WorkingDirectory=/opt/STR/SuperADMIN/server
LimitCORE=infinity
LimitNOFILE=4096
ExecStart=/usr/bin/java \
-Djava.net.preferIPv4Stack=true \
-Djava.rmi.server.hostname=<SA_Hostname> \
-classpath "lib/*" \
@java-options.txt $*
ExecStop=/bin/kill -15 $MAINPID
SuccessExitStatus=143 SIGTERM
Type=simple
Restart=always
RestartSec=15s
TimeoutStopSec=30s
superserver.service
[Unit]
Description=SuperSERVER daemon
After=network.target remote-fs.target nss-lookup.target superadmin.service
Requires=superadmin.service
[Service]
Environment=LD_LIBRARY_PATH=/opt/STR/SuperSERVER_SA:/opt/STR/SuperSERVER_SA/third-party/lib
User=superstar
WorkingDirectory=/opt/STR/SuperSERVER_SA
LimitCORE=infinity
LimitNOFILE=4096
ExecStart=/opt/STR/SuperSERVER_SA/scsa
Type=simple
Restart=always
RestartSec=10s
TimeoutStopSec=30s
[Install]
WantedBy=multi-user.target
Step 3 - Enable the Services
Reload the services daemon to pull in the new services:
CODEsudo systemctl daemon-reload
If you make any changes to the service files in future, you will need to run this command again to update the service with your changes.
Enable the services:
CODEsudo systemctl enable superadmin && sudo systemctl enable superserver
Start the services:
CODEsudo systemctl start superadmin && sudo systemctl start superserver
Once the services have started, you should check the SuperSERVER and SuperADMIN log files to confirm they have started correctly and verify that you can connect to the SuperADMIN console. You can also use the
status
option with thesystemctl
command to check the service status. For example:CODEsudo systemctl status superadmin sudo systemctl status superserver