Capture linking failures


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Capture linking failures
# 1  
Old 06-04-2010
Capture linking failures

Hi all,
I have a script file that has numerous linking commands (ln -s) and currently there is no checking to see if the linking is successful or not and I need to implement something that checks if any of the linking failed and report a failure.

The method I can think of is a small function that checks the return status of the ln command and report failure if the exit code is not zero. But in thsi method I will have to call the function after every ln command, is there a better way for me to handle this case? Any help is appreciated.

Thx
# 2  
Old 06-04-2010
You don't really need to right a function. Just using the shell built-in in variable $? for the return status of the last comman. In korn shell it would just be


Code:
ls -s $filename

if [[ $? -ne 0 ]]  then

do something

fi


Last edited by Scott; 06-07-2010 at 04:05 PM.. Reason: Please use code tags
# 3  
Old 06-07-2010
Hi Jacksona2, yes that is what I was referring too it can be either in a function or your snippet. In the method you mentioned we will have to type that code after every link, however putting that in a function is better in my opinion.

But back to my main question, is there a better way to implement linking failure in a script with lot of linking commands? Any help is appreciated. Thx
# 4  
Old 06-07-2010
I am not really sure what you mean, you would have to supply some sample code. You could just at you linking piece to the same function that does the testing so you do it all in one function.

and run

link_function(<source> <target)

but maybe I am not getting you requirements properly
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Solaris

11.0 to 11.2 update failures

Attempting to update an 11.0 server with many non-global zones installed. pkg publisher is pkg.oracle.com/solaris/support. FMRI = pkg://solaris/entire@0.5.11,5.11-0.175.1.15.0.4.0:20131230T203500Z When we run pkg update --accept the server contacts oracle, checks packages, finds about 700... (4 Replies)
Discussion started by: CptCarrot
4 Replies

2. Solaris

Solaris 10 svcs failures

I have a solaris 10 machine that was working fine until the system crashed after a power failure. Now, after the system boots up, several services go into maintenance mode. offline 8:54:59 svc:/milestone/multi-user-server:default offline 8:54:59... (15 Replies)
Discussion started by: krishani3831
15 Replies

3. Shell Programming and Scripting

Need to Capture Sql Failures

Hi guys, I am inserting and updating records in Oracle database using shell Script based on business logic. Now Whenever the insert or Update fails, i want to capture it. i tried to capture the return code ($?), but it is not reflecting it.... (3 Replies)
Discussion started by: mac4rfree
3 Replies

4. Solaris

Solaris 10 svcs failures

upon rebooting the solaris 10 system, all the services went offilne or uninitialised. If I break the SVM mirror and reboot the system with the raw device, all services are up. Once I recreate a fresh mirror(metadevices) and reboot, it goes offline again. Needed to do svcadm clear <service> to bring... (16 Replies)
Discussion started by: incredible
16 Replies

5. Solaris

Prediction of failures

Any diagnostic tool to do predictive check on all the SUN hard disks before it fails, as a preventive measure? Meaning, is there any tool that can really check for hdd which are failing/or "will fail soon" for Sun servers? (12 Replies)
Discussion started by: incredible
12 Replies

6. Shell Programming and Scripting

Display login failures

How to display failled login in a file. i.e when there occurs a login failure,the login failed date and time should be printed in that file.. (0 Replies)
Discussion started by: aravind007
0 Replies

7. UNIX for Dummies Questions & Answers

Restarting jobs after failures

Hi, I have a script which has a for loop in it. In that for loop are names of files that are going to be processed. For example, for file in file1 file2 file3 file4 do (something) done Let's say that this script gets executed and it fails at 'file2'. Is there a way that I can actually... (10 Replies)
Discussion started by: hern14
10 Replies

8. HP-UX

Communication Failures

HI ALL, I have been trying to install a particular software using remote linux server. some thing like this: rsh <host ID> /usr/sbin/swinstall -x autoreboot=true -s /tmp/<software> <Product name>. The problem is whenever I try to install the product through a shell script the installation... (1 Reply)
Discussion started by: barun agarwal
1 Replies

9. Solaris

Core dump failures

Does anyone have a list of error codes when core dumps fail? What is error 4? I also have another box that does error-2 occasionally. if anyone has a list of these error codes, it would be appreciated, thanks! I have the error below: NOTICE: core_log: ns-admin core dump failed,... (2 Replies)
Discussion started by: BG_JrAdmin
2 Replies

10. Programming

Linking problem while linking to shared library

Hi I'm getting ld: fatal: option -h and building a dynamic executable are incompatible ld: fatal: Flags processing errors When I run ld -shared -L/usr/dt/lib -lDtSvc -o builtin.so Workspace.o after running gcc -fPIC -I/usr/X11R6/include -I/usr/dt/include -c Workspace.c I'm... (6 Replies)
Discussion started by: laho
6 Replies
Login or Register to Ask a Question