Last active 1752986223

rsync success/fail message

gaiety's Avatar gaiety revised this gist 1752986222. Go to revision

No changes

gaiety's Avatar gaiety revised this gist 1752986207. Go to revision

1 file changed, 11 insertions

rsync-status-check.sh(file created)

@@ -0,0 +1,11 @@
1 + # rsync ./src ./copy
2 +
3 + if [ "$?" -eq "0" ]; then
4 + # rsync succeeded, 2nd to last line of log has some data amount moved for a message
5 + MESSAGE=$(tail $logFile -n 2 | head -n 1)
6 + else
7 + # rsync failed, take last line and make it the message
8 + MESSAGE=$(tail $logFile -n 1)
9 + fi
10 +
11 + echo "rsync result: $MESSAGE"
Newer Older