I want to use the system command in a bash shell script. Being more specific,
if some condition in awk is satisfied (number of working nodes is 17) I want
to send me an email, I wrote the following code:
showq | grep nodes | awk '{if ($3 == 17) system("mailx -s 'Everything is Ok' armando@nodes.com <<EOF Tranquiquis EOF") ; else print "some nodes are not working"; fi }'
if I typed that I get the message:
awk: {if ($3 == 17) system(“mailx -s Everything
awk: ^ unterminated string
The problem I think is related to how the body of the message is specified. I don’t
know how to do it. I have tried several ways to fix the error but no success.
regards.
I found the problem, it had nothing to do with single quotes. Actually, I was using commands like ‘showq’ but one must use the whole
path of the command in this way: ‘/opt/moab/bin/showq’ in crontabs.
Thanks.