How to put a "timer" when running df - NFS error


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting How to put a "timer" when running df - NFS error
# 1  
Old 05-26-2011
How to put a "timer" when running df - NFS error

Hi gurus,

OS = SunOS 5.8

Not sure whether to post this in the scripting one or to advance and experts. Am posting on both since there is two things that am wanting to achieve.

Am currerntly having NFS server errors where it is having problems NFS mounting some of the volumes from the same NFS NAS server. Unfortunately, our UNIX SAs is the least helpful of the type of SAs that you can ever have Smilie all he can say is no problem that he/she can see.

I don't know which ones are having the NFS problems. so I decided I want to write a script to check which ones are having NFS mount problems but my script stalls whenever it reaches one that is having NFS problem and hence I cannot check the rest of the mount point.

To illustrate what am wanting to do, for example, the /etc/mnttab file have the following mount entries:

Code:
/etc/mnttab example:

/nas_mnt/u01
/nas_mnt/u02
 /nas_mnt/u03
 /nas_mnt/u04
 /nas_mnt/u05

I want to have a script that does ...

while read mnt
do
   df -k #{mnt}
done < /etc/mnttab

So what am wanting to achieve is giving df maybe only 10 seconds and if it does not response due to the NFS error, then terminate and process the next one in the list.

Would be best of course if someone know of a command besides df that I can use to check for NFS-filesystem mounts that are having problems.

Am thinking can I put the df into a script that creates/removes a lock file and run that script in the background then let the script sleep 10, then after 10 seconds, if the lock file still exists, it does a kill -9 of the script that is running in the background.

This is what I have in mind. Will it work?

Code:
 /etc/mnttab example:
 
 /nas_mnt/u01
 /nas_mnt/u02
  /nas_mnt/u03
  /nas_mnt/u04
  /nas_mnt/u05
 
df.sh:
df_processid=$$
echo "${df_processid}" > df.lock
df -k ${1}
remove df.lock


 while read mnt
 do
    df.sh ${mnt} &
   sleep 10
  -- check for df.lock, if it exists, then kill -9 for df_processid
  -- otherwise do nothing
done < /etc/mnttab


Any response / feedback will be much appreciated. Thanks in advance.
# 2  
Old 05-26-2011
What we use to do is , to redirect the stdout of df to a file, check for content change(i.e. number of lines) frequently sar every 10 secs, if that doesn't change the content of the file,then kill the last df command and go for next.

I think this is simple to implement and serves the purpose.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Bash script - Print an ascii file using specific font "Latin Modern Mono 12" "regular" "9"

Hello. System : opensuse leap 42.3 I have a bash script that build a text file. I would like the last command doing : print_cmd -o page-left=43 -o page-right=22 -o page-top=28 -o page-bottom=43 -o font=LatinModernMono12:regular:9 some_file.txt where : print_cmd ::= some printing... (1 Reply)
Discussion started by: jcdole
1 Replies

2. SCO

NFS umount shows the "Device busy (Error 16)"

Hi there After making a backup copy of it sometimes happens that when I want to unmount an NFS indicates the error:umount: /path_mount busy: Device busy (Error 16) if I run lsoff, I can not find the process that is blocking the application. I'm using OpenServer 5.0.2c as one NFS server ... (14 Replies)
Discussion started by: flako
14 Replies

3. UNIX for Dummies Questions & Answers

SSHd is running, but cant connect "Network error: Connection refused"

Hi, i checked on rhel VPS is running sshd (service ssh status) But i cant connect via putty: "Network error: Connection refused" Please which log file in my centos rhel linux i need to watch or what are steps to do to discover cause? (3 Replies)
Discussion started by: postcd
3 Replies

4. UNIX for Dummies Questions & Answers

Unix "look" Command "File too large" Error Message

I am trying to find lines in a text file larger than 3 Gb that start with a given string. My command looks like this: $ look "string" "/home/patrick/filename.txt" However, this gives me the following message: "look: /home/patrick/filename.txt: File too large" So, I have two... (14 Replies)
Discussion started by: shishong
14 Replies

5. Shell Programming and Scripting

awk command to replace ";" with "|" and ""|" at diferent places in line of file

Hi, I have line in input file as below: 3G_CENTRAL;INDONESIA_(M)_TELKOMSEL;SPECIAL_WORLD_GRP_7_FA_2_TELKOMSEL My expected output for line in the file must be : "1-Radon1-cMOC_deg"|"LDIndex"|"3G_CENTRAL|INDONESIA_(M)_TELKOMSEL"|LAST|"SPECIAL_WORLD_GRP_7_FA_2_TELKOMSEL" Can someone... (7 Replies)
Discussion started by: shis100
7 Replies

6. Red Hat

"ERROR : failed to mount nfs source" Red Hat Kickstart

Hi There, I have been googling for this error and try solution provided but still not avail to resolve Kickstart Issue. Any expert have encounter this problem? Thanks. Regards, Regmaster (4 Replies)
Discussion started by: regmaster
4 Replies

7. HP-UX

script running with "ksh" dumping core but not with "sh"

Hi, I have small script written in korn shell. When it is called from different script, its dumping core, but no core dump when we run it standalone. And its not dumping core if we run the script using "/bin/sh" instead of "ksh" Can some body please help me how to resolve this issue. ... (9 Replies)
Discussion started by: simhe02
9 Replies

8. HP-UX

ERROR: more than one instance of overloaded function "vprintf" has "C" linkage

Hi people! I've got this own library: -------------------------------------------- Personal.h -------------------------------------------- #ifdef __cplusplus extern "C" { #endif #include <stdio.h> #include <stdarg.h> #include <string.h> ... (0 Replies)
Discussion started by: donatoll
0 Replies

9. Shell Programming and Scripting

Startup Script "run process with Timer"

Hi I have a script that execute every X minute for checking new files in a folder and converting to pdf. Is there any way to start this script automatically on linux startup?. I use sleep function in script with infinite loop. while do killall -u `whoami` -q soffice soffice... (0 Replies)
Discussion started by: zawmn83
0 Replies

10. UNIX for Dummies Questions & Answers

error running COBOL - ".loader does not exist"

Hello. I am new to the unix environment. Currently, I am taking existing COBOL source code and attempting to compile and run on our new UNIX machine. I have succesfully compiled an object. When I try to run I get the follwing error: 0509-036 Cannot load program abeunix.o because of the... (16 Replies)
Discussion started by: jbrubaker
16 Replies
Login or Register to Ask a Question