At the end of my script, I check for specific error codes that are returned from a process I execute within the shell script. Based on the error code, I send an email.
Do I need to turn off exec feature prior to send each email so the piping will work correctly? I would have tested this out before posting but i dont have that ability right now. Thank you all!
I'm not sure why you're asking about exec, but there are definitely other problems in your script.
An exec command will not affect a pipeline whose first process is not reading anything from standard input and whose last process is not writing anything to standard output. If your pipeline writes to standard error, those messages will be written to the file specified by your exec command. If that isn't what you want to happen, you'll need to change something to make it do what you do want; but since you have given us no indication of what you want to happen, there is no way we can guess if your use of exec is right or wrong.
Expanding variables that have been set to empty strings (or to strings containing whitespace characters) without quoting them is a disaster waiting to happen. You have dozens of those.
Every time you execute a command (such as the command [ $? -eq x ] where x is some digit) resets the value of $?. So, only your first test of $? is testing the exit status of your dotting the /u02/EssbaseServer/essbaseserver1/bin/startMaxl.sh command. Presumably, you need something more like:
and use $ret_val in all of your following tests instead of $?.
So you're saying even if the first if conditional isn't met, it still resets '$?' ?
I'm also asking about exec because I have it set above:
Then I was wondering for instance if the following line in the first if conditional would just be sent to the error file directory instead of being executed:
As in other scripts, when using exec as I have set up, I need to 'turn it off' in order to use commands such a cat and so on.
Yes. A side effect of executing any pipeline of 1 or more commands is to set the value of the shell special parameter $? to the exit status of that pipeline.
Every command will (re)set the shell's $? parameter, so it can be meaningfully used to evaluate a certain command's success exactly ONCE. To evaluate it several times, assign it to a variable immediately after the command and use that variable hencefoth.
Hi Team,
While sending the email using the mutt command, mail body not appearing properly and attachment it is showing without line breaks and i used the CSS Style (nowrapper )it is working fine.
in this case how to handle the email body, please help me. (1 Reply)
Hi,
I am able to send the mail with attachment through mailx/mutt command.But i am seeing the log file statements all together when i tried to open from my outlook.
log file have the details like below
aaa
bbb
ccc
when i tried to open it from my outlook after receiving the mail attachment... (1 Reply)
Hi Folks -
To make a long story short, this script is loaded into a workbench, executed via workbench user interface, and then I need to display the output on screen. However, I'm using the functions to direct stdout and stderror to their respective directories.
Is there a way to turn that... (5 Replies)
Hello there,
I am using "mutt" command to send e-mails.
mutt -s "Mail subject line" $( printf -- '-a attachment_name') < "mail body file" "e-mail id"
I wish to change the name of the attachment by appending the date to it.
Something like "attachment_name_$DATE.html" in the mutt... (5 Replies)
Hey guys.....
Im new user for linux fedora 20.... i really need help ....... i have no idea why suddently when i turn on my laptop fedora turn to be black screen and ask me loging in , when i loging then nothing happen , it stay at the same screen... then i try to go to "with linux secure...,"... (12 Replies)
Hello All,
I know we can put body inside a mail using -i option for specifying the file which contains body message, is there an option for me to specify body content instead of a file specification only using mutt?
Below is not working and i don't see any options in manual page!
... (4 Replies)
Hi all:
Been racking my brain on this for the last couple of days and what has been most frustrating is that this is the last piece I need to complete a project.
There are numerous posts discussing mutt in this forum and others but I have been unable to find similar issues.
Running with... (1 Reply)
Hi All,
I want to attach the file as well send html content in the mail body using mutt command or any other command.(uuencode is not present). Please help me. Thanks in advance (1 Reply)
Hello,
I am attempting to send emails from AIX 5.2 using either the mailx command or mutt. When I use mutt:
mutt -a jim.txt -s "Test Email" me@mydomain.com
It sends the attachment, but it forces me into the interactive menu.
When I use mailx:
cat data.txt | uuencode... (10 Replies)
hi there,
Would you able to advise that why the syntax or statement below couldn't work as expected ?
/usr/bin/find /backup -name "*tar*" -mtime +2 -exec /bin/rm -f {} \; 1> /dev/null 2>&1
In fact, I was initially located it as in crontab job, but it doesn't work at all. So, I was... (9 Replies)