Product Documentation

Knowledgebase

Previous Topic

Next Topic

Linux systemd Scripts to Start and Stop FairCom DB

On Unix/Linux systems, a script can be used to start and stop the FairCom Server. The script can be used to integrate FairCom DB as a startup service in systems where SystemD is used to manage the startup service. Some of the most recent Linux distributions using SystemD include RedHat 7, CentOS 7, Fedora, and Raspbian.

If the script is placed in the correct directory (e.g., /lib/systemd/system on CentOS 7), the systemctl system tool can be used to manage FairCom DB as system service. For example, to enable the ctree.service at startup, use the following command:

systemctl enable ctree.service

Because the FairCom DB Unix/Linux packages are distributed as .tar.gz archives, we are not able to control where the files will be extracted, so the sample script shown below may need to be edited to match the paths used on your system. Similarly, the paths will need to be edited if you are using this on a FairCom RTG system.

The systemd tool must launch the service as root. A User= keyword may be used to start the service as the specified user. In the sample script shown below, uncomment #User=myuser line and change myuser to the desired user name if you want to start the service as a different user.

The ctstop -auto command works ONLY if the default credentials are set. If you have changed these credentials, you would need to modify the script to use an authorization file with the ctstop command. Create the authorization file with the ctcmdset utility and add ‑1 filename to the ctstop command (in the line that begins ExecStop) in the script below. Note: Avoid including a password directly in the script as this practice is against security policy in most production environments.

The sample below, called ctree.service, demonstrates how to implement such a script:

[Unit]

Description=ctree database

After=multi-user.target network.target


[Service]

#Uncomment the next line if you want to start the service as a different use than "root"

#User=myuser

Environment=LD_LIBRARY_PATH=/opt/FairCom/linux.v2.6.x86.32bit/bin/ace/sql

WorkingDirectory=/opt/FairCom/linux.v2.6.x86.32bit/bin/ace/sql

ExecStart=/opt/FairCom/linux.v2.6.x86.32bit/bin/ace/sql/ctreesql

ExecStop=/opt/FairCom/linux.v2.6.x86.32bit/tools/cmdline/admin/client/ctstop -auto

Restart=on-abort


[Install]

WantedBy=multi-user.target

TOCIndex