Skip to content

Instantly share code, notes, and snippets.

@DDR0
Created January 26, 2019 09:33
Show Gist options
  • Save DDR0/97ce3913434ce16521c3b314454e8496 to your computer and use it in GitHub Desktop.
Save DDR0/97ce3913434ce16521c3b314454e8496 to your computer and use it in GitHub Desktop.
horrible bash scripting
#!/bin/bash
set -uo pipefail
IFS=$'\n'
trap "exit;" SIGINT SIGTERM #The following loop works fine in Konsole but won't ever stop on Gnome Terminal.
while true; do
find -regex '\./[^_\.].*' ! -name git_description ! -path 'util/stats_reported' | entr -d bash -c "
if [[ \$(cat git_description) != \$(git describe --tags --always) ]]; then #Only update when description changes, results in some thrashing otherwise.
git describe --tags --always > git_description
fi
while IFS=\"\" read -r ring_camera_account || [ -n \"\$ring_camera_account\" ]
do
RCA_ARRAY=(\${ring_camera_account//@/ })
rsync -ir ./ \"\${RCA_ARRAY[0]}@[\${RCA_ARRAY[1]}]:/root/ring-software/\" \
--delete --links --inplace --times \
--exclude \"__pycache__\" --exclude \"/.git\" &
done < ~/.ring_cameras
wait
"
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment