Main Topics
Browse All TopicsHi,
I'm using a script to start my application on a daily basis. A cron-like application called Control-M calls this script at a give time and starts the app. The script istelf is very simple as you can see below.
However the line "Load app" occasionally has thrown an error which has resulted in "app.sh" failing to start up the applicartion. I need to check the "Load app" command has completed successfully before calling app.sh, otherwise abort.
How can I do this? Some one mention using exit codes, but I don't know how this works. any ideas?
This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.
Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.
If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.
Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.
Access the answers to your technology questions today.
30-day free trial. Register in 60 seconds.
Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Try it out and discover for yourself.
30-day free trial. Register in 60 seconds.
Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.
I think.... from a somewhat failing memory...
Load app runs, if it runs successfully (ie return code 0) it will then run app.sh
If load app returns anything other than return code 0 app.sh will not run, this should be ok in most cases but if the Load app returns a valid (perhaps for a warning) non zero return code then it will not run app.sh in any case. But I guess that will be true of all the examples above anyway...
You may want to use something like the 2nd option in the "or" example, you may find it easier to read and debug if you have to.
What does the error look like that's thrown by `Load App`? In some circumstances it might even be that this command throws an error but quits with exit code 0 (I saw that often with old or badly written software), that way you won't be able to track the error in that application.
If it produces output to the screen, you might need to `grep` the output and act accordingly, f.ex. if the `Load App` invocation prints out "Error 0x8cf" when it fails, a script like this might help:
Business Accounts
Answer for Membership
by: wilhelm_voigtPosted on 2008-07-18 at 02:35:09ID: 22034058
It's covered here: http://www.bolthole.com/so laris/ksh- basics.htm l
The exit status is available in the variable $? directly after the call. So after line 3, you can include a block like the one described in the link above:
Select allOpen in new window