How would I send an email if a background process I run via nohup fails or is completed? I am running a lot of background processes via nohup in a for loop:
for afolder in $dir/dothis* do nohup nice COMMAND afolder & done
I guess because of the background process, when I do
nohup nice COMMAND afolder & ; tail nohup.out | mail firstname.lastname@example.org -s "job done"
I get an email upon execution, not completion. And how would I send a different email subject line depending on whether the process failed to complete vs. successful completion?
Thanks in advance!