Keep the Agent Running


To make sure your application is able to dispatch tasks and workflows at any time, you need to make sure the Agent is always running and listening using your application credentials.

To enforce this, you will need to use a software capable of monitoring the execution of a process and make sure it's always running. You can use systemd, supervisord, or any similar software to achieve this. Let's see how we can do that using systemd. You will need to run the following commands as user root.

First, create a systemd unit file:

touch /etc/systemd/system/zenaton-agent.service

Make sure the file permissions are correct:

chmod 664 /etc/systemd/system/zenaton-agent.service

Open the file we just created with your favorite text editor and add the following content:

[Unit]
Description=Zenaton Agent Daemon service
After=network-online.target

[Service]
Type=forking

# User and group that will be used to run your Zenaton Agent. User must have a Zenaton Agent installation
# in its home directory and have correct permissions to execute your sources.
User=...
Group=...

# Path to sources of your workflows & tasks.
WorkingDirectory=...

# Add your exact listen command
ExecStartPost=/usr/local/bin/zenaton listen --boot=...

ExecStart=/usr/local/bin/zenaton start
ExecStop=/usr/local/bin/zenaton stop
Restart=always

[Install]
WantedBy=multi-user.target

Make sure to replace ... with correct values.