symcthing: add systemd autostart on login

This commit is contained in:
Frieder Schlesier 2021-10-30 10:06:40 +02:00
parent d62ce0a041
commit 8c977bc737
4 changed files with 58 additions and 9 deletions

View File

@ -0,0 +1,10 @@
[Unit]
Description=My auto backup to WD Passport
Requires=media-wdpassport2tb.mount
After=media-wdpassport2tb.mount
[Service]
ExecStart=/home/fschl/dotfiles/scripts/show_local_backup.sh
[Install]
WantedBy=media-wdpassport2tb.mount

View File

@ -0,0 +1,11 @@
[Unit]
Description=Restart Syncthing after resume
Documentation=man:syncthing(1)
After=sleep.target
[Service]
Type=oneshot
ExecStart=-/usr/bin/pkill -HUP -x syncthing
[Install]
WantedBy=sleep.target

View File

@ -0,0 +1,24 @@
[Unit]
Description=Syncthing - Open Source Continuous File Synchronization for %I
Documentation=man:syncthing(1)
After=network.target
StartLimitIntervalSec=60
StartLimitBurst=4
[Service]
User=%i
ExecStart=/usr/bin/syncthing serve --no-browser --no-restart --logflags=0
Restart=on-failure
RestartSec=1
SuccessExitStatus=3 4
RestartForceExitStatus=3 4
# Hardening
ProtectSystem=full
PrivateTmp=true
SystemCallArchitectures=native
MemoryDenyWriteExecute=true
NoNewPrivileges=true
[Install]
WantedBy=multi-user.target

View File

@ -262,6 +262,12 @@ install_i3() {
Exec=/usr/lib/notification-daemon/notification-daemon
EOF
echo "... setting capslock to control"
sed -i "s/^XKBOPTIONS=.*/XKBOPTIONS=\"ctrl:nocaps\"/" /etc/default/keyboard
}
install_syncthing() {
# install Syncthing via https://apt.syncthing.net/
# Add the release PGP keys:
curl -s https://syncthing.net/release-key.txt | sudo apt-key add -
@ -280,16 +286,14 @@ EOF
apt autoclean
apt clean
TARGET="/home/$USERNAME/.emacs.d"
git clone https://github.com/syl20bnr/spacemacs "${TARGET}"
# rm -rf "${TARGET}"/private/snippets
# git clone https://github.com/AndreaCrotti/yasnippet-snippets "${TARGET}"/private/yas-snippets
# ln -s "${TARGET}"/private/yas-snips/snippets "${TARGET}"/private/snippets/
echo "enable and start the syncthing per-user service for ${USERNAME}"
cp ../etc/systemd/system/syncth* /etc/systemd/system/
user=${USERNAME}
sudo systemctl daemon-reload
sudo systemctl enable syncthing@${USERNAME}
sudo systemctl start syncthing@${USERNAME}.service
systemctl status syncthing@${USERNAME}.service
no_suspend
echo "... setting capslock to control"
sed -i "s/^XKBOPTIONS=.*/XKBOPTIONS=\"ctrl:nocaps\"/" /etc/default/keyboard
}
install_vscodium() {