Setting Up Informix To Use systemd

Published on September 17, 2020 by Tom Beebe

What is systemd

Back in the older days of UNIX systems most sites used SysV to manage all the start and stop scripts from /etc/init.d. Newer versions of Linux have switched over to systemd for managing services as well as to handle logging.

The systemctl command controls the services, while journalctl gives you access to the current system journal. All of the services can be finely tuned allowing for pre and post functions, specific requirements that must be met to start as well as a host of different options to configure how services are handled.

More information can be found at the bottom of this article.

Creating A Master Profile File

Create a new file, /etc/informix.conf:

Create a new service file, on RHEL and CentOS this will be in /etc/systemd/system/

Description=Informix server

ExecStop=/opt/informix/bin/onmode -kuy


Set Up the Service to Auto-start

systemctl daemon-reload
systemctl enable informix

Starting Informix From SystemD

First make sure Informix is stopped (onmode -kuy)

systemctl start informix

Monitoring Informix Status

systemctl status informix
informix.service - Informix server
Loaded: loaded (/etc/systemd/system/informix.service; enabled; vendor preset: disabled)
Active: active (running) since Thu 2020-01-30 11:32:57 EST; 58s ago
Process: 10034 ExecStart=/opt/informix/bin/oninit (code=exited, status=0/SUCCESS)
Main PID: 10036 (oninit)
Tasks: 9 (limit: 26213)
Memory: 153.5M
CGroup: /system.slice/informix.service
├─10036 /opt/informix/bin/oninit
├─10037 /opt/informix/bin/oninit
├─10038 /opt/informix/bin/oninit
├─10039 /opt/informix/bin/oninit
├─10040 /opt/informix/bin/oninit
├─10041 /opt/informix/bin/oninit
├─10042 /opt/informix/bin/oninit
├─10043 /opt/informix/bin/oninit
└─10044 /opt/informix/bin/oninit

Jan 30 11:32:47 miketest systemd[1]: Starting Informix server...
Jan 30 11:32:57 miketest systemd[1]: Started Informix server.

Issues with SELinux

SELinux is a new security system enabled on most Linux distributions by default. If you find Informix is blocked from running look for a SELinux message in the logs file and run the following.

ausearch -c '(oninit)' --raw | audit2allow -M my-oninit
semodule -i my-oninit.pp
/sbin/restorecon -v $INFORMIXDIR/bin/oninit

RHEL 8.2 - Newer Versions of Systemd

Newer versions of Systemd throw errors if invalid lines are found in EnvironmentFile, if you have an 'export' line there to make the file universal as an include it will throw an error.

In that case instead of EnvironmentFile you can use the following Start and Stop commands:

ExecStart= /bin/bash -c '. /etc/informix.conf ; exec oninit'
ExecStop= /bin/bash -c '. /etc/informix.conf ; exec onmode -yuk'


Thanks to Doug Lawry for the tip.