Skip to content

Instantly share code, notes, and snippets.

@samirfor
Last active December 19, 2016 17:21
Show Gist options
  • Save samirfor/31c1ce396eb146c87212627094543a8f to your computer and use it in GitHub Desktop.
Save samirfor/31c1ce396eb146c87212627094543a8f to your computer and use it in GitHub Desktop.
Rsync incremental + beep when finished
#!/bin/bash
SOURCE_DIR="$1"
if [ "${SOURCE_DIR}x" = "x" ]; then
SOURCE_DIR="/home/${USER}/Downloads/Fortaleza2040/" # the last / is important!
fi
[ ! -d "${SOURCE_DIR}" ] && echo "${SOURCE_DIR} is not a dir. Usage: $0 <dir>" && exit 2
for mount_point in $(find /media/${USER}/ -maxdepth 1 -type d); do
if ! mountpoint -q ${mount_point}/; then
continue
fi
echo ":: ${mount_point}"
rsync --archive --human-readable --info=progress2 \
--delete --delete-excluded --exclude="*Thumbs.db" \
"${SOURCE_DIR}" "$mount_point" &
done
wait # Expects all jobs finished second plan.
for mount_point in $(find /media/${USER}/ -maxdepth 1 -type d); do
if ! mountpoint -q ${mount_point}/; then
continue
fi
umount ${mount_point} &
done
wait
( speaker-test -t sine -f 1000 > /dev/null 2>&1 )& pid=$! ; sleep 0.3s ; kill -9 $pid
#!/bin/bash
rsync --archive --human-readable --info=progress2 --delete --delete-excluded --exclude="*Thumbs.db" \
"/var/run/user/1000/gvfs/smb-share:server=jupiter,share=publicos/Fortaleza 2040/" "./Fortaleza2040"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment