nix-setup/startsync.script.nix

26 lines
521 B
Nix
Raw Normal View History

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