Link with Systemd

If you would like to run the Link Agent as a systemd service, you can use the following template and customize it to your environment:

[Unit]
Description=mabl Link Agent
After=network.target
StartLimitIntervalSec=0

[Service]
Type=simple
Restart=always
RestartSec=1
User=mabl
ExecStart=/opt/mabl/link-agent/bin/link-agent -a <your-api-key> -n <your-agent-name>

[Install]
WantedBy=multi-user.target

🚧

This service file needs to be customized before it can be used

At a minimum you will need to update the the ExecStart parameter with your actual API key, Link Agent name, and the path where you have installed the Link Agent.

We recommend creating a separate user and group called mabl (or similar) and using chown to ensure that only this user/group can read/write the directory where the Link Agent is installed. If you would like to use a user other than mabl, please update the User parameter in the service file.

📘

Specifying JAVA_HOME

If the path to Java is not picked up automatically, or you need to specify a different version of Java than your system default, insert the following line under the [Service] section of the service file:

Environment="JAVA_HOME=/path/to/java/base/directory"

For example, if the version of Java that you would like to use is installed at /usr/lib/jvm/openjdk-bin-17, the line would be:

Environment="JAVA_HOME=/usr/lib/jvm/openjdk-bin-17"

Once you have finished customizing the above template to your system and environment, save the file as link-agent.service in the location on your system where service files are defined, such as /etc/systemd/system, then execute the following commands:

systemctl enable link-agent
systemctl start link-agent

To verify that the agent has started up properly, use journalctl

journalctl -u link-agent -r

You can also look at the logs/agent.log file in the directory where the agent is installed.