nix-setup/startsync.script.nix

25 lines
521 B
Nix

with import <nixpkgs> {};
pkgs.writeShellScriptBin "startsync" ''
#!/bin/sh
script="$0"
killall sshfs sftp
sleep 0.5
killall -9 sshfs sftp
sudo umount -l sync
sleep 0.5
if [ "$1" = "stop" ] ; then exit ; fi
sshfs -p 23 root@tudbut.de:sync ~/sync
while ! ls ~/sync/Passwords.kdbx ; do sleep 0.2 ; done
while true ; do
(cat ~/sync/test > /dev/null ; touch ~/.syncfs_ok) &
sleep 7
if ! [ -e ~/.syncfs_ok ] ; then
"$script" stop
exit
fi
rm ~/.syncfs_ok
done & disown
exec keepassxc
''