diff --git a/startsync.script.nix b/startsync.script.nix index df0afbd..edcb47c 100644 --- a/startsync.script.nix +++ b/startsync.script.nix @@ -2,13 +2,24 @@ with import {}; 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 + (ls ~/sync ; echo -n yes > ~/.syncfs_ok) & + sleep 5 + if ! [ -e ~/.syncfs_ok ] ; then + "$script" stop + exit + fi + rm ~/.syncfs_ok + done & disown exec keepassxc ''