-- Leo's gemini proxy

-- Connecting to republic.circumlunar.space:1965...

-- Connected

-- Sending request

-- Meta line: 20 text/gemini

Example of a systemd service file


Here is an almost-minimal example of a systemd service file, that I use to run the Mastodon bot of my generative art playground Graft.


I made a dedicated user just to run this service, and installed Graft into /home/graft/apps/graft under that username. Now, as root, I edited a file called /etc/systemd/system/graft.service and made it look like this:


Mastodon

Graft


[Service]
ExecStart=/home/graft/apps/graft/bot-mastodon
User=graft
Group=graft
WorkingDirectory=/home/graft/apps/graft/
[Install]
WantedBy=multi-user.target


Now I can start the graft service like any other service like this:


sudo systemctl start graft

and find out its status with:


sudo systemctl status graft

If I want it to run on startup I can do:


sudo systemctl enable graft

and it will. Easy!


If I want to look at its output, it's:


sudo journalctl -u graft

As a reward for reading this far, here's a little animation you can make with Graft : [‡ tiddlers]


Graft

[‡ tiddlers]


If you want the service to be restarted whenever it fails, under [Service] add something like this:


Restart=always
RestartSec=3

More info at: Jon Archer's blog post.


Originally posted at 2018-08-23 12:21:14+00:00. Automatically generated from the original post : apologies for the errors introduced.


Jon Archer's blog post

original post

-- Response ended

-- Page fetched on Sun May 19 06:31:58 2024