emcrisostomo / fswatch

A cross-platform file change monitor with multiple backends: Apple OS X File System Events, *BSD kqueue, Solaris/Illumos File Events Notification, Linux inotify, Microsoft Windows and a stat()-based backend.
https://emcrisostomo.github.io/fswatch/
GNU General Public License v3.0
5.04k stars 328 forks source link

Doesn't work with crontab #235

Closed JamesHopbourn closed 4 years ago

JamesHopbourn commented 4 years ago

sh script:

fswatch ~/Desktop/1 | while read file
do
rsync -trl --delete ~/Desktop/1 ~/Desktop/2
now=$(date +"%T")
echo "⚠️  $now ${file} synced"
done

It can work well by command: nohup ./sync.sh &. But I want to us crontab to launch sh script automator and add this to crontab file:

@reboot (nohup zsh $HOME/Desktop/sync.sh &)

But it doesn't work.

emcrisostomo commented 4 years ago

Are you sure fswatch is in the path expected by your cron job?