h_HIRAX.

HIRAX / FIELD GUIDE

Your app stops when SSH closes. Here’s why.

Keep an app or bot running after logout with systemd or a container restart policy.

STEP 01An SSH shell is a session, not a service manager

Starting node server.js in a terminal attaches the process to that interactive session. Closing it may terminate the process. nohup or a terminal multiplexer can be useful for temporary work, but they do not provide a complete production startup and recovery plan.

STEP 02Choose one supervisor

For Docker, use the Compose restart policy and ensure Docker itself starts on boot. For a host-installed app, use systemd. Avoid stacking supervisors on the same process. The following unit assumes /usr/bin/node exists, deploy owns /srv/my-app and the environment file is readable by the service.

EXAMPLE / ADAPT TO YOUR PROJECT
[Unit]
Description=My application
After=network-online.target
Wants=network-online.target

[Service]
User=deploy
WorkingDirectory=/srv/my-app
EnvironmentFile=/etc/my-app.env
ExecStart=/usr/bin/node /srv/my-app/server.js
Restart=on-failure
RestartSec=5
NoNewPrivileges=true
PrivateTmp=true

[Install]
WantedBy=multi-user.target

STEP 03Install only for your own application

Save the reviewed unit as /etc/systemd/system/my-app.service, without replacing an unrelated service. Store its environment file outside Git with restricted access. Enable it and inspect the status. A real application may need additional writable paths and hardening.

EXAMPLE / ADAPT TO YOUR PROJECT
sudo systemctl daemon-reload
sudo systemctl enable --now my-app
systemctl status my-app --no-pager
journalctl -u my-app -n 50 --no-pager

STEP 04A restart loop is evidence, not a solution

If the process repeatedly exits, inspect the first error. Common causes are a missing secret, incorrect working directory, unavailable database, port conflict or insufficient memory. Verify logout survival and plan a reboot check during an approved maintenance window.

COPY → YOUR AI

Take the next step to your AI.

A safe starting prompt for this guide. No secrets. Works with ChatGPT, Claude and other assistants.

Sources and technical documentation

systemd service referenceDocker documentation

This recipe is a pattern for the stated prerequisites. Verify project compatibility and your actual server configuration before applying it to a live service.

Ready for your own server?

Find a starting point for your project and compare real configurations at WVG.

Find my next step