exit status issue

2011-11-17 Thread Dallas Clement
Hello, I've got a script that is periodically performing a disk / raid array integrity check by touching a file. The touch is failing occasionally, with an exit status of 1. If I do 'strace touch' instead of just 'touch' the strace indicates an exit status of 0. So I'm not sure why this is gett

Re: exit status issue

2011-11-18 Thread Dallas Clement
On Fri, Nov 18, 2011 at 6:16 AM, Geir Hauge wrote: > Add ''set -x'' at the start of the function and examine the output to see if > it actually runs touch from PATH. The strace output is showing that the correct 'touch' is being executed. [pid 6747] execve("/bin/touch", ["touch", "/mnt/array1/.

Re: exit status issue

2011-11-18 Thread Dallas Clement
On Fri, Nov 18, 2011 at 2:07 PM, Greg Wooledge wrote: >> Notice that the child process pid=6747 exits with status 0 > > Where does it say that?  How are you even invoking strace here?  I don't > know how to read this output, nor do I know how to reproduce it. [pid 6747] execve("/bin/touch", ["to

Re: exit status issue

2011-11-18 Thread Dallas Clement
On Fri, Nov 18, 2011 at 2:35 PM, Greg Wooledge wrote: > On Fri, Nov 18, 2011 at 02:23:54PM -0600, Dallas Clement wrote: >> [pid  6747] execve("/bin/touch", ["touch", "/mnt/array1/.accesstest"], >> [/* 14 vars */]) = 0 >> >> The = 0 at th

Re: exit status issue

2011-11-22 Thread Dallas Clement
It turns out that my 'touch' command is actually getting executed, but not when I expect it. Here is a recap of my script function which is occasionally misbehaving: # $1 mntpoint fsaccesstest() { local RETRY_MAX=3 local RETRY_INTERVAL=3 local CHK_RESULT=1 TMP=`gr

Re: exit status issue

2011-11-22 Thread Dallas Clement
> That makes no sense.  Fix your quoting (it's atrocious) and then run > the function with "set -x".  Don't throw strace at it, at this point. > It's really not the right tool at this level of debugging. Okay, I simplified the script slightly, fixed the quoting and re-ran with set -x. Here is the

Re: exit status issue

2011-11-22 Thread Dallas Clement
>> + touch /mnt/array1/.accesstest >> + CHK_RESULT=1 > > It looks to me that touch is failing and reporting the failure and > that bash is handling it correctly. > >> + touch /mnt/array1/.accesstest >> + CHK_RESULT=0 > > And then on a subsequent pass touch is reporting success. > > This doesn't (ye

Re: exit status issue

2011-11-22 Thread Dallas Clement
Bob, Yes I agree with everything you've said. I am grasping at straws, which I really don't like. It's very unlikely that the problems are with any of these things I've mentioned bash, Linux kernel, compiler, libc etc. This script is fairly large and it does lots of checking of block devices, r

Re: exit status issue

2011-11-23 Thread Dallas Clement
Hi All, Just wanted to let you know that I have found a solution to my problem, though I can't entirely explain it yet. As mentioned earlier, this script was designed to run as a daemon, i.e. run in the background. This is what I was doing to daemonize the script: Daemon() { while :