Need to echo command successful if command is executed successfully


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Need to echo command successful if command is executed successfully
# 1  
Old 02-28-2014
Need to echo command successful if command is executed successfully

Hello,

I have written a command n shell script :

Code:
srvctl relocate service -d t1 -s s1 -i i1 -t t1 -f

If the above command executes successfully without error I need to echo

Code:
"Service relocated successfully

and If it errors out I need to trap the errors in a file and also need to make sure that the script does not terminate because of a single service relocation error.I mean it ocntinues for other services relocation if one fails but logs the error in a file


Please advise.


Best regards,
Vishal
# 2  
Old 02-28-2014
What have you tried so far?
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

To check if the JAVA Program is successfully executed in sh shell scripting

Hi , I have written a shell script to call a java program say load_id.sh .This sh script indeed is executed implicitly in other sh script which calls 2 more sh scripts one by one. I need to check if the load_id.sh (which calls java program) is executed successfully only then continue with... (1 Reply)
Discussion started by: preema
1 Replies

2. UNIX for Dummies Questions & Answers

Confirm the execution of copy command is successful or not

All, I have to copy huge file from one location to another using python . I want to make sure the execution of Copy command is successful and all the files are copied properly (there has not been any abrupt interruption to the copy process or error like no space available is encountered during... (5 Replies)
Discussion started by: IshuGupta
5 Replies

3. UNIX for Dummies Questions & Answers

Set Command to output a log of every command executed in the script

Hi Guys, I like to output every command executed in the script to a file. I have tried set -x which does the same. But it is not giving the logs of the child script which is being called from my script. Is there any parameters in the Set command or someother way where i can see the log... (2 Replies)
Discussion started by: mac4rfree
2 Replies

4. HP-UX

Mailx command running successfully but no mails received.

Hi, I am working on a HP-UX box. Mailx command running successfully but no mails received. Here is what I am doing rocfm@comhp73 - mailx -s "subject" abc@gmail.com < abc.txt Null message body; hope that's ok rocfm@comhp73 - echo $? 0 rocfm@comhp73 - echo "something" | mailx -v -s... (1 Reply)
Discussion started by: Sunayna
1 Replies

5. Shell Programming and Scripting

script has been executed successfully or not??

Guys, How can we know whether a script has been executed successfully or not ? We dont have any log directories, and we are not given a chance to modify the script. Could someone help me out with this Thanks (2 Replies)
Discussion started by: bobby1015
2 Replies

6. Shell Programming and Scripting

System Command dies even when command gets executed successfully

Hi I have created a perl script & running it using Linux machine. I want my script to die when system command is unsuccessful but script is dying even when system command gets executed successfully. :wall: I am using the command below :- system($cmd) || die "FAILED $!"; print "Hello"; ... (2 Replies)
Discussion started by: Priyanka Gupta
2 Replies

7. Shell Programming and Scripting

Need help! command working ok when executed in command line, but fails when run inside a script!

Hi everyone, when executing this command in unix: echo "WM7 Fatal Alerts:", $(cat query1.txt) > a.csvIt works fine, but running this command in a shell script gives an error saying that there's a syntax error. here is content of my script: tdbsrvr$ vi hc.sh "hc.sh" 22 lines, 509... (4 Replies)
Discussion started by: 4dirk1
4 Replies

8. UNIX for Advanced & Expert Users

Script working successfully only when executed twice

Guys, i am facing a very strange issue, my code below does an ftp to server A and gets a file to Server B, once the file is in B an if condition is present to check if the pattern of the filename is ABC* then it has to be encrypted using OPENSSL as ABC.enc else if it of pattern 123* has to be... (3 Replies)
Discussion started by: meva
3 Replies

9. Cybersecurity

Help Required: Command to find IP address and command executed of a user

Hi, I am trying to write a script which would figure out who has run which command and their IP. As i dont have any clue as to which commands would do this job, i request some gurus to help me on this. Thanks Vishwas (2 Replies)
Discussion started by: loggedout
2 Replies

10. Solaris

Where we can get the logs for a command execution successfully?

Hi, How to get the logs for successfully executing of a solaris command? Where the logs will be stored? How to know that the commands is executed successfully or not? Thanks, Susi. (4 Replies)
Discussion started by: susinthaa
4 Replies
Login or Register to Ask a Question