Hi,
I have deployed the same script on a number of Solaris application servers.
It is run by cron every ten minutes to check the OS for application daemons.
If any of the daemons is found not running, a message is generated to a temporary file.
At the end of the script the there is a check to see if the temporary file
exists. If the file exists, its contents are sent via /usr/ucb/mail through an ms exchange relay server using the following code:
if [ -s /tmp/daemon_check.$$ ]
then
cat /tmp/daemon_check.$$ | /usr/ucb/mail -s "Warning $Host"
ourgroup@domain.co.uk
fi
There a is noticable difference in behaviour in the code on various servers.
On a V880 running SunOS 5.8 Generic_117350-28 the code does not work; the only way I can get any mailed response is to change the line
cat /tmp/daemon_check.$$ | /usr/ucb/mail -s "Warning $Host"
ourgroup@ourdomain.co.uk
to
/usr/ucb/mail -s "Warning $Host"
ourgroup@ourdomain.co.uk < /tmp/daemon_check.$$
The actual output received in MS Outlook has the "To:" field set to "root@bghgapp01.ourdomain.co.uk" and the Subject as "Output from "cron" command"; the contents of the mail is:
your "cron" job on bghgapp01
/usr/local/scripts/daemon_check.ksh
produced the following output:
No bseng process for genhgat
No wfeng process for genhgat
This behaviour is the same on another V880 running SunOS 5.8 Generic_117350-29.
This contrasts with the the output on a V440 running SunOS 5.9 Generic_118558-10; the subject field on the received email is correct - "Warning blpapp01", the "To:" field is OURGROUP which is also correct. The output in the mail body is also correct:
No wfeng process for llophte
The extra, unwanted output:
your "cron" job on bghgapp01
/usr/local/scripts/daemon_check.ksh
produced the following output:
is not present
The code that generates this correct version of the email is:
cat /tmp/daemon_check.$$ | /usr/ucb/mail -s "Warning $Host"
ourgroup@ourdomain.co.uk
Can this difference be explained simply by the OS version?
Thanks,
J