unix script to check if rsh to box and send status mail


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers unix script to check if rsh to box and send status mail
# 1  
Old 09-22-2008
unix script to check if rsh to box and send status mail

rshstatus=`rsh -n lilo /db/p2/oracle/names9208/restart_names.sh`
if $rshstatus <>0 then
errstatus=1
mailx -s "xirsol8dr" ordba@xxx.com >> $log_dr
else if errstatus=0
echo "status to xirsol8dr successful"


can anyone provide if this is t he correct way to do this or is there a better way?
# 2  
Old 10-09-2008
rsh doesn't return the exit code of the remote command. It would be nice if it did, but it doesn't. So you have to have restart_names.sh send the mail, or have it output something like FAILED and use your code above. Of course, you should use != instead of <>. Oh, and "errstatus" is completely redundant here.
 
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Check file if not found send mail if exit call second script

I need to check my script and change to working mode. currently it was not sending the mail and exit without calling the second script. I need to check the file is present ="/home/Rvtools/test.csv" if this file not found after the time retry send mail file not found If the file exit run the... (2 Replies)
Discussion started by: ranjancom2000
2 Replies

2. Shell Programming and Scripting

How to write this script:- check output word and send a mail?

Hi Guys, I am not Good at scripting. I need to write a script such that if output of command shows the particular word in output then send mail to abc@compay.com -bash-3.2$ ps -ef | grep bpbkar root 6040 1 0 13:05:19 ? 0:00 bpbkar -r 2678400 -ru root -dt 47395 -to 0... (20 Replies)
Discussion started by: manalisharmabe
20 Replies

3. Shell Programming and Scripting

Help....script check status if see something then send email

autorep -m bogus Machine Name Max Load Current Load Factor O/S Status ___________ ________ ___________ ______ ________ ______ bogus --- --- 1.00 Sys Agent Online Status ______ Online Offline Missing Unqualified The "Status" always "Online". I like create a script execute run... (6 Replies)
Discussion started by: dotran
6 Replies

4. Shell Programming and Scripting

Clean up UNIX mail box using script

Hi, I would like to clean up by unix mail mail box thru some script command.. I do know how to delete from mail box ... e.g. $ mail ? d* ? quit But I need to clean up thru some command which I can use in my script before sending any email.. Thanks in advance! (1 Reply)
Discussion started by: pareshkp
1 Replies

5. Shell Programming and Scripting

check postfix deferred mail and send notification script

Hi Guys, I have a postfix server which is deferring emails. Now I need to send notification to a specific email address if: The sender of the deferred email is: abc@example.com Contains specific subjects: a file (/opt/subjects) contains all the subjects in place Then need to send a... (0 Replies)
Discussion started by: linuxrulz
0 Replies

6. Red Hat

Send mail from redhat box to exchange server

we have an exchange server in company as excmailbocx.company.com i wanna send mail using sendmail from redhat to my exchange mail account how can it be possible? (1 Reply)
Discussion started by: oguzhantrg
1 Replies

7. Shell Programming and Scripting

script to send mail from unix??

Hi all, I wrote a shell script to send a mail, it is not showing any errors but i didn't receive any mail #!/bin/ksh . ./set_mail_details.ksh echo 'In script' subject=$1 echo '\nsubject' echo $1 echo "$subject" | sed 's/~/ /g' | read sub body_of_email=$2 echo '\nBody' echo $2... (7 Replies)
Discussion started by: deepaknbk
7 Replies

8. UNIX for Advanced & Expert Users

send mail from sun box 8

Hi experts, I need to send email form my sun box but i unable to send? 1) What Basic setting i have to check? 2) We have DNS server running on other system (ISP-DNS 202.62.64.3,Primary-DNS 192.168.10.4 slave-DNS 192.168.10.1) 3) what Files need to be check, what files need to be created. ... (1 Reply)
Discussion started by: saisivakumar
1 Replies

9. Shell Programming and Scripting

Script to send a mail in UNIX

Hi, I need to write one unix script gor sending a mail notification. I have to pass the followinf as arguments,from ,to,subject,messege body Can i use mailx....Please provide the code Thanks in advance. (1 Reply)
Discussion started by: sudhi
1 Replies

10. Shell Programming and Scripting

check the status and send an email with status

Hi, We have a text file which has the following data. ISA~00~ ~00~ ~ZZ~VISTN ~ZZ~U1CAD ~051227~183 7~U~00200~000011258~0~P~< GS~FA~EE05J~U1CAD~051227~1831~000011258~X~002002 ST~997~0001 AK1~SH~247 AK2~856~2470001 AK5~A AK2~856~2470002 AK5~A... (3 Replies)
Discussion started by: isingh786
3 Replies
Login or Register to Ask a Question