mailx in scripts


 
Thread Tools Search this Thread
Operating Systems AIX mailx in scripts
# 1  
Old 06-04-2009
CPU & Memory mailx in scripts

Guys

if i wanna send a mail ,i just type

"mailx -s "test" <ak@abc.com>

without 'CTRL+d' interrupt,mail won be sent.

If i wish to achive this in a script,how do i handle the interrupt?

Regards
Abhi
# 2  
Old 06-04-2009
What you can do in a script is as below:

=======================================
mailx -s "test" whoever@wherever.com <<-EOF
hello
EOF
=======================================

You can use any word for "EOF" in the above example but it makes most sense as "End Of File/Input" is what ctrl-D does.

Make sure there is no indent before "EOF"
# 3  
Old 06-04-2009
SCRIPT bla
bla
mail_to="yourmail@mail1 othermail@mail"
/bin/mailx -s "`uname -n|tr '[a-z]' '[A-Z]'` Backup Report `" $mail_to < /tmp/bkp_monitor.log.$$

bla
#end script
# 4  
Old 06-04-2009
CPU & Memory

thanks guys.

If mailx is receiving input from say,'if' loop or 'cat' command,its sure going to end ,without a need of EOF signal.

I have two enviroments.On both envs,mailx is under 'if' loop.
On one env,'if' gets executed ,mail is sent ,script ends but on other env its stuck at mailx command.Why so?

Does mailx version make a diffrence?

Regards
Abhi
Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Calling multiple scripts from another scripts

Dear all, I am working on script which call other shell scripts in a loop but problem is from second script am not able to come out. Here is the snippet:- #!/bin/bash HSFILE=/root/Test/Components.txt LOGFile=/opt/domain/AdminDomain/application/logs... (3 Replies)
Discussion started by: sharsour
3 Replies

2. Shell Programming and Scripting

Calling scripts from with scripts

Hi all, I'm wondering if you could give me some advice. I am new to scripting and am getting rather frustrated that i can get my script to call another script if certain criteria is met, via command line, but I cannot get the same script to work thru the cron jobs. My first script monitors... (8 Replies)
Discussion started by: echoes
8 Replies

3. Shell Programming and Scripting

KSH - How to call different scripts from master scripts based on a column in an Oracle table

Dear Members, I have a table REQUESTS in Oracle which has an attribute REQUEST_ACTION. The entries in REQUEST_ACTION are like, ME, MD, ND, NE etc. I would like to create a script which will will call other scripts based on the request action. Can we directly read from the REQUEST_ACTION... (2 Replies)
Discussion started by: Yoodit
2 Replies

4. Shell Programming and Scripting

Mailx: How to send a attachment using mailx command

Hi All, Can anyone please provide the command for sending an mail with attachment using mailx command. Thanks in Advance :) Regards, Siram. (3 Replies)
Discussion started by: Sriram.Vedula53
3 Replies

5. Shell Programming and Scripting

Changing the Bash Scripts to Bourne Scripts:URGENT

Hi, I have to write a program to compute the checksums of files ./script.sh I wrote the program using bash and it took me forever since I am a beginner but it works very well. I'm getting so close to the deadline and I realised today that actually I have to use normal Bourne shell... (3 Replies)
Discussion started by: pgarg1989
3 Replies

6. Shell Programming and Scripting

Running scripts within scripts from cron

Hi all, I have set up a cron job which calls another shell script shell script which in turn calls a Java process. The cron tab looks so. 0,30 7-18 * * 1-5 /u01/home/weblogic/brp/bin/checkstatus.sh >> /u01/home/weblogic/logs/checkstatus.log The checkstatus.sh scripts looks like this. ... (4 Replies)
Discussion started by: sirbrian
4 Replies

7. Shell Programming and Scripting

Help with Script using rsh and scripts within scripts

Hi, I've written a script that runs on a Database server. It has to shutdown the Application server, do an Oracle Dump and then restart the Application server. Its been a long time since I wrote any shells scripts. Can you tell me if the scripts that I execute within my script will be executed... (3 Replies)
Discussion started by: brockwile1
3 Replies

8. UNIX for Dummies Questions & Answers

Profile scripts versus rc scripts....

what is the difference between login and profile scripts versus the rc scripts? (1 Reply)
Discussion started by: rookie22
1 Replies

9. UNIX for Dummies Questions & Answers

mailx error message : mailx: NUL changed to @

If I use the "Mail" link instead of the "mail" link to ../mailx I get this error. Mail so-n-so @whatever.com mailx: NUL changed to @ Unknown command: "postmaster" The email still goes through but i get the error. If I use "mail" it goes thru without the error. Any ideas?? (2 Replies)
Discussion started by: BG_JrAdmin
2 Replies
Login or Register to Ask a Question