- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Re: Problem w/ -s switch on mailx
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Discussions
Discussions
Forums
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО10-01-2007 08:19 AM
тАО10-01-2007 08:19 AM
Problem w/ -s switch on mailx
Thanks!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО10-01-2007 08:22 AM
тАО10-01-2007 08:22 AM
Re: Problem w/ -s switch on mailx
~thanks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО10-01-2007 08:25 AM
тАО10-01-2007 08:25 AM
Re: Problem w/ -s switch on mailx
#!/usr/bin/ksh
echo 'Script execution begins..........'
export ORACLE_SID=odsdw3
echo "
WHENEVER SQLERROR EXIT FAILURE;
set serveroutput off;
spool /tmp/mks2997.log;
@/hna/scripts/dba_scripts/catapult_tables_refresh.sql
spool OFF;
" | sqlplus @/u01/app/oracle/admin/odsdw3/util/parms.txt
if [[ $? -eq 0 ]]
then
echo "Script successfully executed!"
mailx -s "GDW:DW3:catapult_tables_refresh.sql execution log" mark.frederickson@us.hjheinz.com < /tmp/mks2997.log
exit 0
else
echo "Errors encountered. Check Log!"
mailx -s "GDW:DW3:catapult_tables_refresh.sql execution log" mark.frederickson@us.hjheinz.com < /tmp/mks2997.log
exit 1
fi
Here's the test case that does:
#!/usr/bin/ksh
echo 'Script execution begins..........'
export ORACLE_SID=odsdw3
echo "
WHENEVER SQLERROR EXIT FAILURE;
set serveroutput off;
spool /tmp/MailTest.log;
@/hna/scripts/dba_scripts/MailTest.sql
spool OFF;
" | sqlplus @/u01/app/oracle/admin/odsdw3/util/parms.txt
if [[ $? -eq 0 ]]
then
echo "Script successfully executed!"
mailx -s "GDW:DW3:MailTest.sql execution log" mark.frederickson@us.hjheinz.com < /tmp/mks2997.log
exit 0
else
echo "Errors encountered. Check Log!"
mailx -s "GDW:DW3:MailTest.sql execution log" mark.frederickson@us.hjheinz.com < /tmp/MailTest.log
exit 1
fi
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО10-01-2007 02:53 PM
тАО10-01-2007 02:53 PM
Re: Problem w/ -s switch on mailx
You may need to add "set -x" to trace your problem.
I naturally don't have problems because I change your "sqlplus" to /usr/bin/true or false and I echo something to /tmp/mks2997.log.
Are you saying you don't get mail, or you have the wrong subject?
In your "good" one, you seem to have this inconsistency:
spool /tmp/MailTest.log;
Then you read from either /tmp/mks2997.log (success) or /tmp/MailTest.log (failure).
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО10-02-2007 08:02 AM
тАО10-02-2007 08:02 AM
Re: Problem w/ -s switch on mailx
Thanks for taking the time to look @ this. To answer your questions, I am getting mail, no problem. The issue is that the subject line is not being passed in the prod example. The difference in the file redirection, mks2997.log or MailTest.log makes no difference in the results.
Mark
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО10-02-2007 08:51 AM
тАО10-02-2007 08:51 AM
Re: Problem w/ -s switch on mailx
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО10-02-2007 08:53 AM
тАО10-02-2007 08:53 AM
Re: Problem w/ -s switch on mailx
Thanks for contributing to my hopeful resolution, however.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО10-02-2007 02:52 PM
тАО10-02-2007 02:52 PM
Re: Problem w/ -s switch on mailx
It worked for me. Do you get a subject at all? (It would help if your mail subject said whether it was good or bad results. ;-)
Can you add that "set -x" so we can trace your execution path?
I don't see how that -s option can fail. You are quoting it. You don't have any special chars in it. A cut&paste of your example shows one long line. (Are you doing this in crontab?)
>The difference in the file redirection, mks2997.log or MailTest.log makes no difference in the results.
I had to change it so it existed. Otherwise the mail wasn't sent.
(You may want to ask the moderators to disguise/remove your mail address. You may get spam from it. Make your request here:
http://forums1.itrc.hp.com/service/forums/questionanswer.do?threadId=1157827
>Sandman: Have you tried interactively running the mailx command line by itself instead of in a script?
Hmm, when I diffed the two, the mailx line looked almost the same.
One other thing is the fact that the subject has multiple ":" in it. But both the good and the bad do. Some mail clients may not like it? What do you use to read it?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО10-02-2007 03:02 PM
тАО10-02-2007 03:02 PM
Re: Problem w/ -s switch on mailx
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО10-03-2007 05:38 AM
тАО10-03-2007 05:38 AM
Re: Problem w/ -s switch on mailx
>It worked for me. Do you get a subject at all? (It would help if your mail subject said whether it was good or bad results. ;-)
No, I do not get a subject at all when the prod script is run & I know we should have some kind of indicator of success/failure, but I'm dealing with a third-party out-sourcing organization & they are a bunch of kunckleheads.
>Can you add that "set -x" so we can trace your execution path?
Here's the example with 'set -x' trace on (this test results in a good subject line returned to me):
hgdwtest:mfrederi:/home/mfrederi$log" mark.frederickson@us.hjheinz.com < /tmp/MailTest.log <
+ mailx -s GDW:DW3:MailTest.sql execution log mark.frederickson@us.hjheinz.com
+ 0< /tmp/MailTest.log
>I don't see how that -s option can fail. You are quoting it. You don't have any special chars in it.
I don't see how this could fail either, which is the reason why I thought I would ask you all!
>Are you doing this in crontab?
Yes, the prod script is scheduled with crontab.
>One other thing is the fact that the subject has multiple ":" in it. But both the good and the bad do. Some mail clients may not like it? What do you use to read it?
In my test today, I executed from the command line with the ':' & '.' in place. It still works (and always had @ the cmd-line - it's when run in the prod script that it is a problem).
I am sending this to a MS Outlook client.
Thanks for looking into this!
Mark