mailx in kornshell script passing return code to CA-Unicenter


 
Thread Tools Search this Thread
Top Forums UNIX for Advanced & Expert Users mailx in kornshell script passing return code to CA-Unicenter
# 1  
Old 04-05-2002
Tools mailx in kornshell script passing return code to CA-Unicenter

I have a KornShell script that has successfully been scheduled through Cron. We are in the process of changing over from Cron to using CA-Unicenter. To negative test the script I put a bad return code in. At the bottom of the script an e-mail is sent using mailx and then the return code is set using "exit 2". However, CA-Unicenter gets a zero return code back. If I comment out the mailx code, then CA-Unicenter will show up with a return code of 2. My assumption is that the mailx command ends with a zero return code and CA-Unicenter gets it and assumes its from the KornShell script. Here's the piece of code in question:

CENTMSGRC=2
print $CENTMSGRC >> /appl/cmddba/bin/job.log

mailx -s "$subject" "$MAILTO" </appl/cmddba/bin/job.log

print $CENTMSGRC >> /appl/cmddba/bin/job.log

exit $CENTMSGRC

Do you have any idea if my theory is correct? And if it is, do you know a solution to my problem besides creating another Script that will just send the e-mail message and have the script executed after the first one.

Thanks,
Connie
# 2  
Old 04-23-2002
We have discovered that there is a setting within CA-Unicenter that will fix this problem. The following 2 configuation changes where made in CA-Unicenter:

enfcontrol JOB TRIGGER EXITMAIN
instructs CAIENF to consider a job as completed when the main process of the job has completed. We have used this for jobs such as starting a database, the database pid remains active, yet the script that started them can end.

enfcontrol JOB RC EXITMAIN
The control option JOB RC indicates that the exit return code presented by CAIENF to the Unicenter-TNG Workload Management component is the exit code of the main process (shell script).

So essentially CA-Unicenter has been configured to only accept the exit code from the main process script.

Connie
Smilie
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

Email shell script return code

Hi All, I'm new to unix and I have a requirement to execute a shell script and get the return code/Exit code and send it in email. Meaninig we execute a script which in turn execute a shel script and fetches it\s return code and send it to email. I tried the code below as : ... (2 Replies)
Discussion started by: midhun3108
2 Replies

2. Shell Programming and Scripting

Return Code to shell script

Hi, I need to send the return code from a script to the parent shell script. But i am suppressing outputs while calling the child script. Is there any way still to get the return code from the child script with suppress output. Below is my script: I am using :$ while calling return.sh... (5 Replies)
Discussion started by: usrrenny
5 Replies

3. IP Networking

Set default return address for all mails sent from mailx

Hi, I have a question about mailx in Red Hat: If I use 'mail userid@mydomain.com -- -f root@mydomain.com', the return mail address will be root@mydomain.com. How can I make all mails sent from this system use root@mydomain.com as return address by default? Thank you in advance! nz (1 Reply)
Discussion started by: aixlover
1 Replies

4. Shell Programming and Scripting

How to capture script return code?

Hi I am executing database backup via shell script (Korn). The backup log is long, but I would like to capture only the last line so I can send an email if it fails Example of failed backup (only last 3 lines) BR0056I End of database backup: bejbofoh.aff 2012-07-26 07.31.21 BR0280I... (7 Replies)
Discussion started by: nimo
7 Replies

5. HP-UX

return code from oracle to unix script

Hi I'm writing a shell script that connects to oracle database and fires query to check the availability of data in a table. In case of no data found then what will be the return code and how to handle in that in variable. Kindly provide with an example for better understanding... Thanks... (1 Reply)
Discussion started by: ksailesh
1 Replies

6. Shell Programming and Scripting

Help with Kornshell Script

Hi, I'm a novice at programming and need some help with a kornshell script I've been writting. I have an inputdirectory with all my .shp files. In my input directory the shapefiles are named XXXX_original.shp, XXXX_UPDATE.shp ect. In my .ksh script I have created a for loop which... (2 Replies)
Discussion started by: beery
2 Replies

7. UNIX for Dummies Questions & Answers

to pick up the Return Code ( RC) from the mailx command and return it to SAS uisng 's

Hi All, Can anyone please let me know the syntax / how to pick up the Return Code ( RC) from the mailx command and return it to SAS uisng 'system()' function and '${?}'. I am in a process to send the mail automatically with an attachment to bulk users. I have used 'Mailx' and 'Unencode'... (0 Replies)
Discussion started by: manas6
0 Replies

8. Shell Programming and Scripting

return code from script

hey all, I have a simple script #!/bin/bash ./cron.sh test_a.txt & ./cron.sh test_b.txt & wait I want to invoke another program based on the return status of the above calls. How am I were to get that? Thanks! (2 Replies)
Discussion started by: mpang_
2 Replies

9. Shell Programming and Scripting

Mailx Return Email Command

Hi, I'm trying to use the Mailx Return Email Command with a file attachment. If I use the file attachment by itself, it works ok. But If I add the return email command, it won't attach the file to email. Subject, return_email_address Send_email_address, Body, attachment,... (1 Reply)
Discussion started by: lisa0703
1 Replies

10. Shell Programming and Scripting

Need Help with KornShell script

I need a KornShell script that will, among all the users currently logged on to the system, find a slot of one hour that contains the most number of users. I know how to list all the users currently logged on but how do I do anything with the times that are listed? Please help, thanks. (1 Reply)
Discussion started by: ckrieger1
1 Replies
Login or Register to Ask a Question