From b40bb64612fe79fa7c398882ec004314961547d0 Mon Sep 17 00:00:00 2001 From: Jake Peterson Date: Fri, 23 Oct 2015 22:37:35 -0600 Subject: [PATCH 1/3] Documentation and examples for Ubuntu-like linux systems using Upstart as the init system. --- etc/linux-upstart/README.md | 16 ++++++++++++++++ etc/linux-upstart/system/syncthing.conf | 13 +++++++++++++ etc/linux-upstart/user/syncthing.conf | 21 +++++++++++++++++++++ 3 files changed, 50 insertions(+) create mode 100644 etc/linux-upstart/README.md create mode 100644 etc/linux-upstart/system/syncthing.conf create mode 100644 etc/linux-upstart/user/syncthing.conf diff --git a/etc/linux-upstart/README.md b/etc/linux-upstart/README.md new file mode 100644 index 000000000..15fdfe5fd --- /dev/null +++ b/etc/linux-upstart/README.md @@ -0,0 +1,16 @@ +# Upstart Configuration + +This directory contains example configuration files for running Syncthing under +the "Upstart" service manager on Linux. To have syncthing start when you login +place "user/syncthing.conf" in the "/home/[username]/.config/upstart/" folder. +To have syncthing start when the system boots place "system/syncthing.conf" +in the "/etc/init/" folder. +To manualy start syncthing via Upstart when using the system configuration use: + +``` + sudo initctl start syncthing +``` + +For further documentation see [http://docs.syncthing.net/users/autostart.html][1]. + +[1]: http://docs.syncthing.net/users/autostart.html#Upstart diff --git a/etc/linux-upstart/system/syncthing.conf b/etc/linux-upstart/system/syncthing.conf new file mode 100644 index 000000000..4100385b0 --- /dev/null +++ b/etc/linux-upstart/system/syncthing.conf @@ -0,0 +1,13 @@ +description "Syncthing" + +start on (local-filesystems and net-device-up IFACE!=lo) +stop on runlevel [!2345] + +env STNORESTART=yes +env HOME=/home/jake +setuid "jake" +setgid "jake" + +exec /usr/local/bin/syncthing + +respawn diff --git a/etc/linux-upstart/user/syncthing.conf b/etc/linux-upstart/user/syncthing.conf new file mode 100644 index 000000000..0ef9efa7f --- /dev/null +++ b/etc/linux-upstart/user/syncthing.conf @@ -0,0 +1,21 @@ +# Location of the syncthing executable +env SYNCTHING_EXE="/usr/local/bin" + +# Set the name of the application +description "Syncthing" + +# Start syncthing you login to your desktop +start on desktop-start + +# Stop syncthing you logout of your desktop +stop on desktop-end + +# Set STNORESTART to yes to have Upstart monitor the process instead +# of having a separate syncthing process do the monitoring +env STNORESTART=yes + +# If Upstart detects syncthing has failed - it should restart it +respawn + +# the syncthing command Upstart is to execute when it is started up +exec $SYNCTHING_EXE -no-browser From 44790b1333897eb60ce89129c066ee8820ba3142 Mon Sep 17 00:00:00 2001 From: Jake Peterson Date: Fri, 23 Oct 2015 22:49:25 -0600 Subject: [PATCH 2/3] Added Jake Peterson to AUTHORS --- AUTHORS | 1 + 1 file changed, 1 insertion(+) diff --git a/AUTHORS b/AUTHORS index 622d38baf..94103979f 100644 --- a/AUTHORS +++ b/AUTHORS @@ -36,6 +36,7 @@ Frank Isemann Gilli Sigurdsson Jacek Szafarkiewicz Jakob Borg +Jake Peterson James Patterson Jaroslav Malec Jens Diemer From fe88781bc857dde1a1c321616e3d6eed3fa8e59d Mon Sep 17 00:00:00 2001 From: Jake Peterson Date: Sat, 24 Oct 2015 14:53:08 -0600 Subject: [PATCH 3/3] Changed system conf file to use $USER --- etc/linux-upstart/system/syncthing.conf | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/etc/linux-upstart/system/syncthing.conf b/etc/linux-upstart/system/syncthing.conf index 4100385b0..be29476a6 100644 --- a/etc/linux-upstart/system/syncthing.conf +++ b/etc/linux-upstart/system/syncthing.conf @@ -4,9 +4,9 @@ start on (local-filesystems and net-device-up IFACE!=lo) stop on runlevel [!2345] env STNORESTART=yes -env HOME=/home/jake -setuid "jake" -setgid "jake" +env HOME=/home/$USER +setuid "$USER" +setgid "$USER" exec /usr/local/bin/syncthing