rsync.sh (1080B)
1 #!/bin/bash 2 3 OPTIONS="push\npull" 4 5 if [ $# -eq 0 ] 6 then 7 SELECTION=$(echo -e $OPTIONS| fzf) 8 else 9 10 prompt="rsync:" 11 12 dmenu_cmd="dmenu -p \"$prompt\"" 13 SELECTION=$(echo -e $OPTIONS | eval "$dmenu_cmd" ) 14 15 fi 16 17 18 19 if [ $SELECTION = "pull" ]; then 20 echo "==== PULLING ====" >> ~/logs/sync.log 21 date >> ~/logs/sync.log 22 if rsync -vrph --stats andrew@brgr:/home/shared/fileSharing/syncing ~/ >> ~/logs/sync.log; then 23 echo "==== PULL COMPLETED ====" >> ~/logs/sync.log 24 notify-send "Pull Succeeded!" 25 else 26 notify-send -u "critical" "Pull Failed! See ~/logs/sync.log" 27 echo "==== PULL FAILED ====" >> ~/logs/sync.log 28 fi 29 fi 30 31 if [ $SELECTION = "push" ]; then 32 echo "==== PUSHING ====" >> ~/logs/sync.log 33 if rsync -vrph --stats ~/syncing andrew@brgr:/home/shared/fileSharing/ >> ~/logs/sync.log ; then 34 echo "==== PUSH COMPLETED ====" >> ~/logs/sync.log 35 notify-send "Push Succeeded!" 36 else 37 notify-send -u "critical" "Push Failed! See ~/logs/sync.log" 38 echo "==== PUSH FAILED ====" >> ~/logs/sync.log 39 fi 40 fi