Commit 2c7fc036 authored by Igor Pecovnik's avatar Igor Pecovnik
Browse files

syntching fixes

parent 1962408d
...@@ -672,12 +672,15 @@ install_syncthing () ...@@ -672,12 +672,15 @@ install_syncthing ()
# #
# Install Personal cloud https://syncthing.net/ # Install Personal cloud https://syncthing.net/
# #
curl -s https://syncthing.net/release-key.txt | apt-key add -
if !(grep -qs syncthing "/etc/apt/sources.list.d/syncthing.list");then add_choose_user
echo "deb http://apt.syncthing.net/ syncthing release" | tee /etc/apt/sources.list.d/syncthing.list curl -s https://syncthing.net/release-key.txt | apt-key add - >/dev/null 2>&1
debconf-apt-progress -- apt-get update if !(grep -qs syncthing "/etc/apt/sources.list.d/syncthing.list");then
install_packet "syncthing syncthing-inotify" "Install Personal cloud https://syncthing.net/" echo "deb http://apt.syncthing.net/ syncthing release" | tee /etc/apt/sources.list.d/syncthing.list
cat > /etc/systemd/system/syncthing.service <<"EOF" fi
debconf-apt-progress -- apt-get update
install_packet "syncthing syncthing-inotify" "Install Personal cloud https://syncthing.net/"
cat <<EOT > /etc/systemd/system/syncthing.service
[Unit] [Unit]
Description=Syncthing - Open Source Continuous File Synchronization Description=Syncthing - Open Source Continuous File Synchronization
Documentation=man:syncthing(1) Documentation=man:syncthing(1)
...@@ -688,20 +691,19 @@ ExecStart=/usr/bin/syncthing -no-browser -no-restart -logfile=/var/log/syncthing ...@@ -688,20 +691,19 @@ ExecStart=/usr/bin/syncthing -no-browser -no-restart -logfile=/var/log/syncthing
Restart=on-failure Restart=on-failure
SuccessExitStatus=3 4 SuccessExitStatus=3 4
RestartForceExitStatus=3 4 RestartForceExitStatus=3 4
User=root User=$CHOSEN_USER
[Install] [Install]
WantedBy=default.target WantedBy=default.target
EOT
EOF cat <<EOT > /etc/systemd/system/syncthing-inotify.service
cat > /etc/systemd/system/syncthing-inotify.service <<"EOF"
[Unit] [Unit]
Description=Syncthing Inotify File Watcher Description=Syncthing Inotify File Watcher
After=network.target syncthing.service After=network.target syncthing.service
Requires=syncthing.service Requires=syncthing.service
[Service] [Service]
User=root User=$CHOSEN_USER
ExecStart=/usr/bin/syncthing-inotify -logfile=/var/log/syncthing-inotify.log -logflags=3 ExecStart=/usr/bin/syncthing-inotify -logfile=/var/log/syncthing-inotify.log -logflags=3
SuccessExitStatus=2 SuccessExitStatus=2
RestartForceExitStatus=3 RestartForceExitStatus=3
...@@ -711,14 +713,15 @@ ProtectHome=read-only ...@@ -711,14 +713,15 @@ ProtectHome=read-only
[Install] [Install]
WantedBy=multi-user.target WantedBy=multi-user.target
EOF EOT
# increase open file limit # increase open file limit
if !(grep -qs "fs.inotify.max_user_watches=204800" "/etc/sysctl.conf");then
echo -e "fs.inotify.max_user_watches=204800" | tee -a /etc/sysctl.conf echo -e "fs.inotify.max_user_watches=204800" | tee -a /etc/sysctl.conf
systemctl enable syncthing fi
systemctl start syncthing systemctl enable syncthing
systemctl enable syncthing-inotify systemctl start syncthing
systemctl start syncthing-inotify systemctl enable syncthing-inotify
fi systemctl start syncthing-inotify
} }
......
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