|
From: | aws backup |
Subject: | Re: [Findutils-patches] xargs problem |
Date: | Tue, 20 Dec 2016 23:35:56 +0200 |
Hi Berny, thank you so much for the detailed instructions. It's almost working perfectly :-) Needs just some tweaking I think. Ok I started the screen command like this: screen -dmS test /bin/bash -c "/path/to/fswatch.sh" then the first script fswatch.sh: #!/bin/bash fswatch -0 -Ie '.*\.*$' -i '.*\.mp4$' /path/to/folder \ | xargs -0 -n 1 /path/to/s3cmd.sh then the second script s3cmd.sh: #!/bin/bash filename="$(basename "$1")" terminal-notifier -message "s3cmd Upload '$filename' started" s3cmd put "$1" s3://bucket/ \ | tee /path/to/logfile.txt \ | tee >(mail -s 'Upload $filename' address@hidden) \ && /usr/local/bin/terminal-notifier -message "s3cmd Upload of '$filename' done" The second tee command is to get the output also in the screen terminal to see what's going on when I attach the screen. Now what's happening. I change a filename. xargs transfers first the old file name (before renaming) to the script. Therefore I get the notifications upload started and upload done for the old filename and following error from s3cmd (also as email): ERROR: Parameter problem: Nothing to upload. Null message body; hope that's okWhich is correct because the old file is not existing anymore. Then xargs transfers the new file name (after renaming) to the script and everything works as expected. Just the variable "$filename" in the mail command doesn't work. The subject of the notification email is "Upload $filename". How can I avoid that the old file name is transferred to the script? Why does the mail command not understand $filename? Thank you for your great help. Wish you the best. Robert
|
[Prev in Thread] | Current Thread | [Next in Thread] |