From a9544ca8904dfa6d0474117b09e7a47f3f5b0a72 Mon Sep 17 00:00:00 2001 From: Jakob Borg Date: Mon, 24 Nov 2014 13:48:42 +0100 Subject: [PATCH] Add example for runit service --- etc/README.md | 1 + etc/linux-runit/README.md | 15 +++++++++++++++ etc/linux-runit/run | 8 ++++++++ 3 files changed, 24 insertions(+) create mode 100644 etc/README.md create mode 100644 etc/linux-runit/README.md create mode 100644 etc/linux-runit/run diff --git a/etc/README.md b/etc/README.md new file mode 100644 index 000000000..248ecd565 --- /dev/null +++ b/etc/README.md @@ -0,0 +1 @@ +This directory contains contributed setup examples. diff --git a/etc/linux-runit/README.md b/etc/linux-runit/README.md new file mode 100644 index 000000000..2586f569a --- /dev/null +++ b/etc/linux-runit/README.md @@ -0,0 +1,15 @@ +This directory contains a configuration for running syncthing under the +"runit" service manager on Linux. It probably works perfectly fine on +other platforms also using runit. + + 1. Install runit. + + 2. Edit the `run` file to set the username to run as, the user's home + directory and the place where the syncthing binary lives. It is + recommended to place it in a directory writeable by the running user + so that automatic upgrades work. + + 3. Copy the edited `run` file to `/etc/service/syncthing/run`. + +Log output is sent to syslogd. + diff --git a/etc/linux-runit/run b/etc/linux-runit/run new file mode 100644 index 000000000..7832d4bb4 --- /dev/null +++ b/etc/linux-runit/run @@ -0,0 +1,8 @@ +#!/bin/sh + +export USERNAME=jb +export HOME="/home/$USERNAME" +export SYNCTHING="$HOME/bin/syncthing" + +setuidgid "$USERNAME" "$SYNCTHING" -logflags 0 2>&1 | logger -t syncthing +