I have a script that accepts an error code, and if the error code is not 0 then an email is sent using mailx to details the error.
I want to be able to implement the functiuonlity whereby i can send the email in a background process so the script can continue with other logic
and if the email has not completed say within 30 seconds then to abort
does anyone have a code snippet that I could use/ammend?
something like...
#!/bin/bash
<< normal code>>
<<start background process here>>
echo �message� | mailx -s �<Subject>� <recipient mail address>
if not responsing or email not sent within 30 seconds then abort with error message