0

I'm using rsync to push some changes to a server, for that I made a bash script and I want to show a status notification in the desktop (I'm using Linux Mint 18 Cinnamon)

Is it possible to send the output of rsync to notify-send so I can see the amount of data synchronized? Here is my actual bash script:

notify-send "sincronizando esteticas"
rsync -tprvkku --exclude "00_docs" --exclude "temp" --exclude "config.php" --progress public_html/ rsync://myserver:/myfiles 
notify-send "sincronizacion terminada"
  • Have you tried this? As written there's no particular reason why this wouldn't work. If it doesn't please explan how you're running it (remember to update your question with this extra information). – roaima Oct 17 '16 at 7:56
  • Depending on how this script is being run it's a possible duplicate of Using notify-send with cron – roaima Oct 17 '16 at 8:01
  • Do you mean you want to see the progress bar in the notify during the rsync? – meuh Oct 17 '16 at 8:49
  • Not the progress bar.. the output that rsync shows on the terminal – Chico3001 Oct 17 '16 at 14:09
1

If you want a notify popup holding the final summary line, something like

sent 6,673,231 bytes  received 17,718 bytes  13,381,898.00 bytes/sec
total size is 6,613,892  speedup is 0.99

then you can capture the rsync output into a file, and use the last 2 lines of the file:

rsync ... | tee /tmp/out
notify-send "$(tail -2 /tmp/out)"

If you would like a more detailed summary, add --info=stats2

rsync --info=stats2 ... | tee /tmp/out
notify-send "$(tail -16 /tmp/out)"

This will provide extra info such as:

Number of files: 932 (reg: 929, dir: 2, link: 1)
Number of created files: 932 (reg: 929, dir: 2, link: 1)
Number of deleted files: 0
Number of regular files transferred: 929
Total file size: 6,613,892 bytes
Total transferred file size: 6,613,888 bytes
Literal data: 6,613,888 bytes
Matched data: 0 bytes
File list size: 0
File list generation time: 0.001 seconds
File list transfer time: 0.000 seconds
Total bytes sent: 6,673,231
Total bytes received: 17,686
| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.