Skip to content

Running atomic-server as a service (auto-restart, start on boot) using systemd #271

@joepio

Description

@joepio

Since I wanted to start atomic-server whenever it crashes because of my memory issue #270, I created a systemd setup. Might be useful to others.

Also, I'm considering to add similar functionality to the server itself. Maybe add a setup-service or daemon subcommand that installs something like this.

How to make atomic-server a service

Create a service:

vim /etc/systemd/system/atomic.service

Paste this:

[Unit]
Description=Atomic-Server
#After=network.targetdd
StartLimitIntervalSec=0[Service]

[Service]
Type=simple
Restart=always
RestartSec=1
User=root
ExecStart=/root/atomic-server
WorkingDirectory=/root/
EnvironmentFil=/root/.env

[Install]
WantedBy=multi-user.target
# start service
systemctl run atomic
# check status
systemctl status atomic
# restart
systemctl restart atomic
# logs
journalctl -u atomic.service
# logs, since one hour, follow
journalctl -u atomic.service --since "1 hour ago" -f

TODO

  • Allow users to create a service description like above using a command like atomic-server service start. This could then setup the atomic.service file. We could also implement a restart and stop. We could use the systemd crate

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions