Commit 4ba72249 authored by Igor Pecovnik's avatar Igor Pecovnik
Browse files

Create services for starting syntching properly.

parent 72261d9f
...@@ -481,14 +481,48 @@ curl -s https://syncthing.net/release-key.txt | apt-key add - ...@@ -481,14 +481,48 @@ curl -s https://syncthing.net/release-key.txt | apt-key add -
if !(grep -qs syncthing "/etc/apt/sources.list.d/syncthing.list");then if !(grep -qs syncthing "/etc/apt/sources.list.d/syncthing.list");then
echo "deb http://apt.syncthing.net/ syncthing release" | tee /etc/apt/sources.list.d/syncthing.list echo "deb http://apt.syncthing.net/ syncthing release" | tee /etc/apt/sources.list.d/syncthing.list
debconf-apt-progress -- apt-get update debconf-apt-progress -- apt-get update
install_packet "syncthing" "Install Personal cloud https://syncthing.net/" install_packet "syncthing syncthing-inotify" "Install Personal cloud https://syncthing.net/"
sed -e 's/exit 0//g' -i /etc/rc.local cat > /etc/systemd/system/syncthing.service <<"EOF"
cat >> /etc/rc.local <<"EOF" [Unit]
syncthing Description=Syncthing - Open Source Continuous File Synchronization
exit 0 Documentation=man:syncthing(1)
After=network.target
[Service]
ExecStart=/usr/bin/syncthing -no-browser -no-restart -logfile=/var/log/syncthing.log -logflags=3
Restart=on-failure
SuccessExitStatus=3 4
RestartForceExitStatus=3 4
User=root
[Install]
WantedBy=default.target
EOF EOF
syncthing >/dev/null 2>&1 & cat > /etc/systemd/system/syncthing-inotify.service <<"EOF"
sleep 5 [Unit]
Description=Syncthing Inotify File Watcher
After=network.target syncthing.service
Requires=syncthing.service
[Service]
User=root
ExecStart=/usr/bin/syncthing-inotify -logfile=/var/log/syncthing-inotify.log -logflags=3
SuccessExitStatus=2
RestartForceExitStatus=3
Restart=on-failure
ProtectSystem=full
ProtectHome=read-only
[Install]
WantedBy=multi-user.target
EOF
# increase open file limit
echo -e "fs.inotify.max_user_watches=204800" | tee -a /etc/sysctl.conf
systemctl enable syncthing
systemctl start syncthing
systemctl enable syncthing-inotify
systemctl start syncthing-inotify
fi fi
} }
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment