I am using fswatch and rsync to automatically sync directories between Mac and ubuntu servers. The shell is like
/Users/david/Documents/code/shell/fswatch_rsync.sh:
#!/bin/bash
sudo fswatch -o /Users/david/Documents/code/python/ | xargs -n1 /Users/david/Documents/code/shell/rsync_shell.sh
/Users/david/Documents/code/shell/rsync_shell.sh:
sudo rsync -vzrp --delete /Users/david/Documents/code/python/ --password-file=/etc/rsyncd.pass -e "ssh -i /Users/david/.ssh/id_rsa -p 22" 192.168.0.109::python
However, when I run bash /Users/david/Documents/code/shell/fswatch_rsync.sh
in terminal and change the files in /Users/david/Documents/code/python/
, it responses:
xargs: /Users/david/Documents/code/shell/rsync_shell.sh: No such file or directory
in the terminal.