Back to Article List

Run Hermes Agent 24/7 with systemd

Run Hermes Agent 24/7 with systemd

If you've installed Hermes Agent and you're running it inside a tmux session "for now", this is the article that retires that habit. A real systemd unit takes about ten minutes to write, gives you automatic restart on crash, survives reboots without you logging in and routes its logs to journald where they're searchable. Compared to "screen + nohup + I'll remember", it's the upgrade that lets you stop thinking about the agent.

The setup below assumes you've followed the Ubuntu install guide and have hermes on your PATH at ~/.local/bin/hermes. If you came in via a LumaDock VPS with the Hermes template, the VPS setup guide ships a unit out of the box, so you can skim this article for the tuning bits and ignore the install-from-scratch steps. If you're on a different install layout, adjust the ExecStart path accordingly.

What needs to run as a service

Hermes has two long-running processes worth thinking about, plus a third that's optional.

The gateway (hermes gateway start) is the thing that talks to messaging platforms. It polls Telegram, holds a Discord WebSocket open, listens on whatever ports your other channels need. This is the one you want as a real systemd service because if it dies, your bot stops responding.

The interactive CLI (hermes) is the terminal you use when you SSH in and want to talk to the agent directly. You don't run this as a service. You start it ad-hoc when you need it. The interactive session and the gateway can both run at the same time against the same data dir.

The optional third is anything you've configured to run on cron-style schedules. Hermes manages cron jobs internally via the /cron command, so they fire from inside the running gateway process. You don't need a separate cron service if your gateway is up.

The unit below covers the gateway. That's the one you need.

The unit file

Create /etc/systemd/system/hermes.service with the following content. Substitute youruser for whatever Linux user you installed Hermes as.

[Unit]
Description=Hermes Agent gateway
Documentation=https://hermes-agent.nousresearch.com/docs
After=network-online.target
Wants=network-online.target

[Service]
Type=simple
User=youruser
Group=youruser
WorkingDirectory=/home/youruser
Environment="HOME=/home/youruser"
Environment="PATH=/home/youruser/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
ExecStart=/home/youruser/.local/bin/hermes gateway start
Restart=on-failure
RestartSec=10
StandardOutput=journal
StandardError=journal
SyslogIdentifier=hermes

# Resource caps to keep one bad turn from eating the box
MemoryMax=2G
CPUQuota=200%

# Light hardening
NoNewPrivileges=true
PrivateTmp=true
ProtectSystem=strict
ProtectHome=read-only
ReadWritePaths=/home/youruser/.hermes

[Install]
WantedBy=multi-user.target

A few of those lines deserve explanation.

After=network-online.target with Wants=network-online.target tells systemd to start Hermes only after the network is fully up. Without it, the gateway tries to connect to Telegram during boot, fails because DNS isn't ready, restarts, fails again. With it, the gateway waits for real connectivity and starts cleanly.

Type=simple works because hermes gateway start is a long-running foreground process. It doesn't fork. If you ever switch to a setup where you wrap Hermes in a manager like tini or run it under a process supervisor, change this to Type=exec or Type=notify, but for vanilla Hermes, simple is right.

Restart=on-failure with RestartSec=10 means systemd will restart the service if it exits non-zero, but waits 10 seconds first. The wait matters because Hermes restart loops can hammer your LLM provider during the brief window where a bad config is causing an immediate crash on every startup. The 10-second backoff gives you time to systemctl stop hermes if you see it crash-looping in the logs.

The resource caps (MemoryMax=2G, CPUQuota=200%) are sized for a small VPS. MemoryMax is a hard limit. If Hermes tries to allocate beyond it (say, a runaway browser-automation task with too much state), the kernel kills it and systemd restarts it. CPUQuota=200% means up to two CPU cores' worth of time, which is plenty for normal agentic work. Adjust both up if you have headroom.

The hardening lines (NoNewPrivileges, PrivateTmp, ProtectSystem=strict, ProtectHome=read-only with explicit ReadWritePaths) are belt-and-braces stuff. They mean that if your Hermes process gets compromised (a malicious skill, a remote-execution bug), it can't write to most of the filesystem and can't escalate privileges. The cost is that you have to remember to add directories to ReadWritePaths if Hermes ever needs to write outside ~/.hermes.

Enable and start the service

sudo systemctl daemon-reload
sudo systemctl enable hermes
sudo systemctl start hermes
sudo systemctl status hermes

The status output should show active (running), with the most recent log lines from Hermes appearing at the bottom of the systemctl status panel. If you see activating (auto-restart) or failed, jump to the troubleshooting section.

To watch logs live:

journalctl -u hermes -f

To search logs (say, for errors in the last hour):

journalctl -u hermes --since "1 hour ago" -p err

The -p err filter restricts to error-level messages and above; useful when you're trying to find the proverbial needle.

Log rotation

journald handles log rotation by default, but the default ceiling is generous. If you're on a VPS with a small disk, journald can use up to 10% of your filesystem before rotating, which is more space than a small box has to spare. Cap it explicitly.

Edit /etc/systemd/journald.conf and uncomment or add:

SystemMaxUse=200M
SystemKeepFree=500M
RuntimeMaxUse=100M

Then sudo systemctl restart systemd-journald to apply. journald will keep up to 200 MB of persistent logs and 100 MB of runtime (volatile) logs, freeing space when it gets close to either ceiling.

For most personal Hermes installs, 200 MB of logs holds about three to six weeks of normal traffic. If you need longer retention, bump the cap or pipe logs to a remote log host with rsyslog or Vector.

Loading environment variables from .env

The unit above relies on Hermes reading its config from ~/.hermes/config.yaml and ~/.hermes/.env, which it does by default. If you have additional environment variables that aren't in .env (a custom HERMES_HOME, third-party MCP server credentials, etc.), the cleanest pattern is to put them in a separate file and reference it from the unit:

EnvironmentFile=-/etc/default/hermes

The leading - tells systemd not to fail if the file doesn't exist. Then /etc/default/hermes is a normal shell-style env file:

HERMES_LOG_LEVEL=info
HERMES_DEFAULT_PROVIDER=nous-portal

Make sure /etc/default/hermes is owned by root and readable by your service user. chmod 640 with the service user in the group is reasonable.

Updates without dropping conversations

When you run hermes update, the binary itself updates but your data stays put. The systemd service won't pick up the new binary until you restart it. The pattern that works:

sudo systemctl stop hermes
hermes update
sudo systemctl start hermes

If you want to make this automatic on a schedule, drop a small unit pair: a timer that fires nightly and a oneshot service that runs the update sequence. The oneshot looks like:

[Unit]
Description=Hermes Agent auto-update
After=network-online.target

[Service]
Type=oneshot
User=youruser
ExecStart=/usr/bin/systemctl stop hermes
ExecStart=/home/youruser/.local/bin/hermes update --non-interactive
ExecStart=/usr/bin/systemctl start hermes

Pair it with a timer that fires at 04:00 daily. If this is a good idea, that depends on your tolerance for the agent restarting at 4 AM. For some people, automatic updates are fine. For others (especially anyone running a production agent with users who message at all hours), manual updates after testing are the right policy.

Troubleshooting failed starts

The three most common ways the unit fails on first start:

"Failed to start: Permission denied" usually means the user can't read its own home directory. Check with sudo -u youruser ls -la ~/.hermes. If that fails, your user's home permissions are off; fix with chmod 700 /home/youruser and re-check.

"Failed to start: Unit not found" after editing the unit file means you forgot to systemctl daemon-reload. Run it; try again.

"Active: failed (Result: exit-code)" with the gateway exiting immediately is almost always a config problem. Run sudo -u youruser /home/youruser/.local/bin/hermes gateway start directly from the shell as the service user. The error that comes out tells you what's wrong; common ones are missing API keys, an invalid bot token or a port that's already taken by something else.

If hermes runs fine when invoked directly but fails under systemd, the difference is almost always the environment. The interactive shell sources ~/.bashrc which adds variables and PATH entries that systemd's stripped-down environment doesn't have. Add the relevant variables to your unit's Environment= lines.

Multiple instances on the same machine

If you're running Hermes alongside OpenClaw or running two Hermes installs (one for personal use, one for work), you can templatise the unit using systemd's @ instance feature. Save the unit as /etc/systemd/system/[email protected] and replace the user references with %i:

[Service]
User=%i
ExecStart=/home/%i/.local/bin/hermes gateway start
ReadWritePaths=/home/%i/.hermes

Then enable per-user instances:

sudo systemctl enable --now hermes@alice
sudo systemctl enable --now hermes@bob

Each instance runs as its own user, with its own data dir and its own logs. journalctl -u hermes@alice -f tails one of them. The side-by-side article covers the broader pattern of running multiple agents on one VPS.

If you're starting from scratch on a fresh box

The LumaDock Hermes Agent VPS template ships with the systemd unit pre-installed and enabled, so the gateway starts on first boot and survives reboots without you doing any of the above. Useful when you want the boring infrastructure to be done on someone else's time so you can focus on configuring the agent.

Your idea deserves better hosting

24/7 support 30-day money-back guarantee Cancel anytime
Számlázási ciklus

1 GB RAM VPS

$3.99 Save  25 %
$2.99 havonta
  • 1 vCPU AMD EPYC
  • 30 GB NVMe tárhely
  • Korlátlan sávszélesség
  • IPv4 és IPv6 benne van Az IPv6 támogatás jelenleg nem érhető el Franciaországban, Finnországban és Hollandiában.
  • 1 Gbps hálózat
  • Tűzfal kezelése
  • Szerver megfigyelés

2 GB RAM VPS

$5.99 Save  17 %
$4.99 havonta
  • 2 vCPU AMD EPYC
  • 30 GB NVMe tárhely
  • Korlátlan sávszélesség
  • IPv4 és IPv6 benne van Az IPv6 támogatás jelenleg nem érhető el Franciaországban, Finnországban és Hollandiában.
  • 1 Gbps hálózat
  • Tűzfal kezelése
  • Szerver megfigyelés

6 GB RAM VPS

$14.99 Save  33 %
$9.99 havonta
  • 6 vCPU AMD EPYC
  • 70 GB NVMe tárhely
  • Korlátlan sávszélesség
  • IPv4 és IPv6 benne van Az IPv6 támogatás jelenleg nem érhető el Franciaországban, Finnországban és Hollandiában.
  • 1 Gbps hálózat
  • Tűzfal kezelése
  • Szerver megfigyelés

AMD EPYC VPS.P1

$7.99 Save  25 %
$5.99 havonta
  • 2 vCPU AMD EPYC
  • 4 GB RAM memória
  • 40 GB NVMe tárhely
  • Korlátlan sávszélesség
  • IPv4 és IPv6 benne van Az IPv6 támogatás jelenleg nem érhető el Franciaországban, Finnországban és Hollandiában.
  • 1 Gbps hálózat
  • Automatikus mentés benne
  • Tűzfal kezelése
  • Szerver megfigyelés

AMD EPYC VPS.P2

$14.99 Save  27 %
$10.99 havonta
  • 2 vCPU AMD EPYC
  • 8 GB RAM memória
  • 80 GB NVMe tárhely
  • Korlátlan sávszélesség
  • IPv4 és IPv6 benne van Az IPv6 támogatás jelenleg nem érhető el Franciaországban, Finnországban és Hollandiában.
  • 1 Gbps hálózat
  • Automatikus mentés benne
  • Tűzfal kezelése
  • Szerver megfigyelés

AMD EPYC VPS.P4

$29.99 Save  20 %
$23.99 havonta
  • 4 vCPU AMD EPYC
  • 16 GB RAM memória
  • 160 GB NVMe tárhely
  • Korlátlan sávszélesség
  • IPv4 és IPv6 benne van Az IPv6 támogatás jelenleg nem érhető el Franciaországban, Finnországban és Hollandiában.
  • 1 Gbps hálózat
  • Automatikus mentés benne
  • Tűzfal kezelése
  • Szerver megfigyelés

AMD EPYC VPS.P5

$36.49 Save  21 %
$28.99 havonta
  • 8 vCPU AMD EPYC
  • 16 GB RAM memória
  • 180 GB NVMe tárhely
  • Korlátlan sávszélesség
  • IPv4 és IPv6 benne van Az IPv6 támogatás jelenleg nem érhető el Franciaországban, Finnországban és Hollandiában.
  • 1 Gbps hálózat
  • Automatikus mentés benne
  • Tűzfal kezelése
  • Szerver megfigyelés

AMD EPYC VPS.P6

$56.99 Save  21 %
$44.99 havonta
  • 8 vCPU AMD EPYC
  • 32 GB RAM memória
  • 200 GB NVMe tárhely
  • Korlátlan sávszélesség
  • IPv4 és IPv6 benne van Az IPv6 támogatás jelenleg nem érhető el Franciaországban, Finnországban és Hollandiában.
  • 1 Gbps hálózat
  • Automatikus mentés benne
  • Tűzfal kezelése
  • Szerver megfigyelés

AMD EPYC VPS.P7

$69.99 Save  20 %
$55.99 havonta
  • 16 vCPU AMD EPYC
  • 32 GB RAM memória
  • 240 GB NVMe tárhely
  • Korlátlan sávszélesség
  • IPv4 és IPv6 benne van Az IPv6 támogatás jelenleg nem érhető el Franciaországban, Finnországban és Hollandiában.
  • 1 Gbps hálózat
  • Automatikus mentés benne
  • Tűzfal kezelése
  • Szerver megfigyelés

EPYC Genoa VPS.G1

$4.99 Save  20 %
$3.99 havonta
  • 1 vCPU AMD EPYC Gen4 AMD EPYC Genoa 4. generációs 9xx4 processzor 3.25 GHz-en vagy hasonló, Zen 4 architektúrával.
  • 1 GB DDR5 RAM memória
  • 25 GB NVMe tárhely
  • Korlátlan sávszélesség
  • IPv4 és IPv6 benne van Az IPv6 támogatás jelenleg nem érhető el Franciaországban, Finnországban és Hollandiában.
  • 1 Gbps hálózat
  • Automatikus mentés benne
  • Tűzfal kezelése
  • Szerver megfigyelés

EPYC Genoa VPS.G2

$12.99 Save  23 %
$9.99 havonta
  • 2 vCPU AMD EPYC Gen4 AMD EPYC Genoa 4. generációs 9xx4 processzor 3.25 GHz-en vagy hasonló, Zen 4 architektúrával.
  • 4 GB DDR5 RAM memória
  • 50 GB NVMe tárhely
  • Korlátlan sávszélesség
  • IPv4 és IPv6 benne van Az IPv6 támogatás jelenleg nem érhető el Franciaországban, Finnországban és Hollandiában.
  • 1 Gbps hálózat
  • Automatikus mentés benne
  • Tűzfal kezelése
  • Szerver megfigyelés

EPYC Genoa VPS.G4

$25.99 Save  27 %
$18.99 havonta
  • 4 vCPU AMD EPYC Gen4 AMD EPYC Genoa 4. generációs 9xx4 processzor 3.25 GHz-en vagy hasonló, Zen 4 architektúrával.
  • 8 GB DDR5 RAM memória
  • 100 GB NVMe tárhely
  • Korlátlan sávszélesség
  • IPv4 és IPv6 benne van Az IPv6 támogatás jelenleg nem érhető el Franciaországban, Finnországban és Hollandiában.
  • 1 Gbps hálózat
  • Automatikus mentés benne
  • Tűzfal kezelése
  • Szerver megfigyelés

EPYC Genoa VPS.G6

$48.99 Save  31 %
$33.99 havonta
  • 8 vCPU AMD EPYC Gen4 AMD EPYC Genoa 4. generációs 9xx4 processzor 3.25 GHz-en vagy hasonló, Zen 4 architektúrával.
  • 16 GB DDR5 RAM memória
  • 200 GB NVMe tárhely
  • Korlátlan sávszélesség
  • IPv4 és IPv6 benne van Az IPv6 támogatás jelenleg nem érhető el Franciaországban, Finnországban és Hollandiában.
  • 1 Gbps hálózat
  • Automatikus mentés benne
  • Tűzfal kezelése
  • Szerver megfigyelés

EPYC Genoa VPS.G7

$74.99 Save  27 %
$54.99 havonta
  • 8 vCPU AMD EPYC Gen4 AMD EPYC Genoa 4. generációs 9xx4 processzor 3.25 GHz-en vagy hasonló, Zen 4 architektúrával.
  • 32 GB DDR5 RAM memória
  • 250 GB NVMe tárhely
  • Korlátlan sávszélesség
  • IPv4 és IPv6 benne van Az IPv6 támogatás jelenleg nem érhető el Franciaországban, Finnországban és Hollandiában.
  • 1 Gbps hálózat
  • Automatikus mentés benne
  • Tűzfal kezelése
  • Szerver megfigyelés

1 vCPU AMD Ryzen 9

$13.99 Save  29 %
$9.99 havonta
  • Dedikált CPU 4.5GHz AMD Ryzen 9 7950X 4.5 GHz natív CPU órajellel.
  • 4 GB DDR5 RAM memória
  • 50 GB NVMe tárhely
  • Korlátlan sávszélesség
  • IPv4 és IPv6 benne van Az IPv6 támogatás jelenleg nem érhető el Franciaországban, Finnországban és Hollandiában.
  • 1 Gbps hálózat
  • Automatikus mentés benne
  • Tűzfal kezelése
  • Szerver megfigyelés

2 vCPU AMD Ryzen 9

$25.99 Save  19 %
$20.99 havonta
  • Dedikált CPU 4.5GHz AMD Ryzen 9 7950X 4.5 GHz natív CPU órajellel.
  • 8 GB DDR5 RAM memória
  • 100 GB NVMe tárhely
  • Korlátlan sávszélesség
  • IPv4 és IPv6 benne van Az IPv6 támogatás jelenleg nem érhető el Franciaországban, Finnországban és Hollandiában.
  • 1 Gbps hálózat
  • Automatikus mentés benne
  • Tűzfal kezelése
  • Szerver megfigyelés

8 vCPU AMD Ryzen 9

$92.99 Save  30 %
$64.99 havonta
  • Dedikált CPU 4.5GHz AMD Ryzen 9 7950X 4.5 GHz natív CPU órajellel.
  • 32 GB DDR5 RAM memória
  • 400 GB NVMe tárhely
  • Korlátlan sávszélesség
  • IPv4 és IPv6 benne van Az IPv6 támogatás jelenleg nem érhető el Franciaországban, Finnországban és Hollandiában.
  • 1 Gbps hálózat
  • Automatikus mentés benne
  • Tűzfal kezelése
  • Szerver megfigyelés

FAQ

How do I run multiple gateways for different platforms in separate units?

Hermes's gateway process handles all configured channels in one binary, so the standard pattern is one unit per Hermes install, not one unit per channel. If you genuinely need separate processes (say you want Telegram on a tighter resource cap than Discord), you'd need two Hermes installs in separate data directories, each running with a config that enables only one channel, each with its own systemd unit. This is rare in practice; most people just run one gateway and accept that all channels share resources.

Your agent runs wild. Your bill doesn't.

Easily deploy Hermes in one click on Ubuntu 24.04 with AMD EPYC, NVMe storage and unmetered bandwidth. The price stays the same whatever the agent does, no setup fees, no overage charges and no tier traps.

GPU products are in high demand at the moment. Fill the form to get notified as soon as your preferred GPU server is back in stock.