From dcf23cbd97acaf9fab0e382291dc525ffb0eea88 Mon Sep 17 00:00:00 2001 From: Nicole Mazzuca Date: Thu, 21 May 2020 10:08:56 -0700 Subject: [PATCH 1/2] add initial systemd service example --- molly-brown.service.example | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 molly-brown.service.example diff --git a/molly-brown.service.example b/molly-brown.service.example new file mode 100644 index 0000000..4eea977 --- /dev/null +++ b/molly-brown.service.example @@ -0,0 +1,12 @@ +[Unit] +Description=Molly Brown gemini server +After=network.target + +[Service] +Type=simple +Restart=always +User=molly +ExecStart=/usr/local/bin/molly-brown -c /etc/molly.conf + +[Install] +WantedBy=multi-user.target From 85a94a43b9dc541d243a9702ee41fbf9c4239924 Mon Sep 17 00:00:00 2001 From: Nicole Mazzuca Date: Thu, 21 May 2020 10:13:52 -0700 Subject: [PATCH 2/2] modify README --- README.md | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index dd8cfe7..9dd5f46 100644 --- a/README.md +++ b/README.md @@ -45,14 +45,22 @@ Currently Molly Brown just runs like an ordinary program, without daemonising itself. You'll need to use another program, like the one at `http://libslack.org/daemon/`, to handle daemonising. -Currently Molly Brown is not integrated with any kind of init system, -so you'll have to handle getting it to start on boot up yourself. If -you are using a sufficiently right-headed operating system, the -easiest way to do this is by putting your call to `daemon` (or -whatever else you use) in `/etc/rc.local`. +Currently Molly Brown is only integrated with systemd, so if you're +using anything else you'll have to handle getting it to start on boot up +yourself. If you are using a sufficiently right-headed operating +system, the easiest way to do this is by putting your call to +`daemon` (or whatever else you use) in `/etc/rc.local`. -If you write a working systemd unit file for Molly Brown, please feel -free to share it with me and I'll get it into the repo. +Setting up with systemd should be reasonably easy; copy +`molly-brown.service.example` from this directory to +`/etc/systemd/system/molly-brown.service`. Then, make any necessary +changes for your setup, and run the following: + +```sh +# systemctl daemon-reload +# systemctl enable molly-brown.service +# systemctl start molly-brown.service +``` Note that Golang programs are unable to reliably change their UID once run (a source of constant frustration to me!). So don't start it as