startsync: auto unmount when not ok
This commit is contained in:
parent
38c61b0740
commit
19ab3c5385
1 changed files with 11 additions and 0 deletions
|
@ -2,13 +2,24 @@ 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
|
||||
(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
|
||||
''
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue