3 ms·
Forking might be easier to debug.. but I think I might have missed some of the functionality in your script.. something like (totally untested): (while true
by jamiesonbecker 11y ago
Forking might be easier to debug.. but I think I might have missed some of the functionality in your script.. something like (totally untested):
(while true
do
inotifywait \
--exclude '.*\.sw.' \
--recursive \
--event close_write \
--event delete \
--event moved_to \
--event moved_from \
dir1/
git push
sleep 0.1
done
) 2>&1 >/var/log/push_log.log &
(while true
do
cat << 'EOF' | ssh remotebox
inotifywait \
--exclude '.*\.sw.' \
--recursive \
--event close_write \
--event delete \
--event moved_to \
--event moved_from \
dir1/
git push #??
sleep 0.1
EOF
# (second EOF cannot be indented)
done
) 2>&1 >/var/log/pull_log.log &
echo "Kicked off pull and push processes."
wait
- prashanthellina 11y agoThat is Gold! Implementing the functionality in shell itself was what I considered first however I needed two things 1. Make it work on OSX 2. Use a lock file to prevent multiple instances from running when I put this in crontab I found watchman[0]. Got to see if I can use that in place of "inotifywait". [0]: https://facebook.github.io/watchman/docs/install.html https://facebook.github.io/watchman/docs/install.html
- jamiesonbecker 11y agoYeah that should work!