random script termination


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting random script termination
# 1  
Old 07-13-2008
random script termination

I'm writing a script to archive data. First, the files are all rsync'd to the archive directory via NFS mounts(I know not the most efficient, but the only choice in this situation), then I use md5sum to validate the transfers. During execution of the script, it will exit for no apparent reason. It runs under ksh, and I've executed the program with ksh -x for debugging, left myself all kinds of debug messages throughout the script, but cannot find a logical reason for the programs termination. At the time of exit, it's in a while loop that reads the archived files names from a list file then does an md5sum on the source and destination. It will exit at different points in the loop. The filenames it's parsing don't seem to be the issue as doing the same files over and over, it will exit at different files. The test directory that I'm using has 5700+ files in it. Sometimes albeit rarely, it will do all 5700, sometimes about 200, other around 1500. It seems totally random. I've niced the md5sum part and it appears to be working better, but still not completing most of the time.

My question is: Is their something that will terminate a program if it takes too much processing power, memory, etc.? Like a "runaway" process catcher? I don't really see any thing doing a ps -ef or ps auxc, or in chkconfig --list, and the program itself while running doesn't seem to be taking too much of the available resources. The reason I'm suspicious of this type of this is that a couple of times it would output "Quit"(which is NOT anywhere in the script) upon exit, and once it said "SIGTERM +6". I tried looking at the man pages for signal and couldn't find much.

Any Ideas?

Thanks in advance.
# 2  
Old 07-13-2008
Just to be clear, is that getting terminated during transfers ( rsynce'd) or only during checksum process ?

Try tracing ( strace ) the running process, that should give more hint though looking at the strace log for the first time is irritating but its very useful.

Regarding runway - catcher, we do have similar to that like process_monitor_controller which is a sub version of the scheduler in kernels which will save the current process image, stack frames and push it to sleeping mode if it crosses limit that it had promised not to cross.

Not sure, this might help you but few points to think about
# 3  
Old 07-13-2008
Does your script run to completion if you remove the md5sum validation code?
# 4  
Old 07-13-2008
random script termination

matrixmadhan,
Quote:
Just to be clear, is that getting terminated during transfers ( rsynce'd) or only during checksum process ?
Rsync runs to completion. At the time of termination, It's in a loop of getting the md5sums and checking the source against the destination file. The weird thing is that it exits at random points in the loop. This is where your suggestion of strace will probably come in quite handy. To be honest I haven't used it in years, and didn't consider it in regard to using for a script. Every time I'd used it in the past it was for compiled programs. Thanks for the brain slap!

In almost 20 years of programming, I've never had a script do this before. It's always been traceable to the code itself. I.E. programmer error. Smilie

fpmurphy:
Quote:
Does your script run to completion if you remove the md5sum validation code?
Yes it does finish without the md5sum. Thanks, I had highly suspected md5, but never ruled it in or out by removing it. The rest of the code in the loop just check if the file exist and if the md5sums are the same. Based on switches, either removes, or leaves the source file.

Thank you both. I'll let you know what I find with the strace.

MPH
# 5  
Old 07-13-2008
Next thing to check for is that you have the latest version of md5sum.
# 6  
Old 07-13-2008
As far as I know everything is up to snuff. I have the updater running and install updates whenever they show up.

The strace had some interesting output. I'll have to do more research Monday when I get to work.

Strace Output
Quote:
rt_sigaction(SIGRT_32, {0x80500e0, [], SA_INTERRUPT}, {SIG_DFL}, 8) = 0
rt_sigaction(SIGRT_32, {0x80500e0, [], SA_INTERRUPT}, {0x80500e0, [], SA_INTERRUPT}, 8) = 0
close(0) = 0
fcntl64(11, F_DUPFD, 0) = 0
--- SIGCHLD (Child exited) @ 0 (0) ---
waitpid(-1, [{WIFSIGNALED(s) && WTERMSIG(s) == SIGPIPE}], WNOHANG|WSTOPPED|WCONTINUED) = 25200
close(0) = 0
fcntl64(11, F_DUPFD, 0) = 0
close(11) = 0
rt_sigprocmask(SIG_UNBLOCK, [], NULL, 8) = 0
rt_sigaction(SIGRT_32, {SIG_DFL}, {0x80500e0, [], SA_INTERRUPT}, 8) = 0
rt_sigprocmask(SIG_SETMASK, [], [CHLD], 8) = 0
kill(25142, SIGRT_32) = 0
--- SIGRT_32 (Real-time signal 30) @ 0 (0) ---
+++ killed by SIGRT_32 +++
# 7  
Old 07-18-2008
Update:

This script is running on a Dell PowerEdge 400SC, with dual 2.8G processors running CentOS 5. If I disable one of the processors the script works fine. I can run the script on a AMD quad core running Mandriva on without issue. Nothing else on the Dell shows any indications of problems. I would have to deduce that there is either a problem with CentOS and smp, or the hardware itself. So, I've posted this on the CentOS support site forums.

Thanks to all who replied, your information was a great help.

MPH
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Script termination without pressing Enter key[nohup]

I have a script in which we have used nohup. Once script is executed it will be terminated only when enter key is pressed. I want the script to be terminated without pressing enter key nohup imqbrokerd -name user_id port 2>1 1>$home_`date` & I am a newbie to shell, Kindly please help (3 Replies)
Discussion started by: Suganbabu
3 Replies

2. Shell Programming and Scripting

Script that will random choose an IP address

Hi, I need to write a bash script that will random choose and login into these below ip addresses. 192.168.116.130 192.168.116.131 192.168.116.132 192.168.116.133 I'm new into scripting and I need to enhance my logic. Below is what i did ... (4 Replies)
Discussion started by: Milon
4 Replies

3. Shell Programming and Scripting

Random script error with rndc

Hello coders, been running into an strange behavior into one of my script and i'm wondering if my code wouldn't be responsible. Bash on rhel 5.7 This is a basic check to see if bind is up and running on server. # rndc check INFO="Checking rndc" for DNS_SERVER in ${DNS_MASTER_SERVERS};... (10 Replies)
Discussion started by: maverick72
10 Replies

4. Shell Programming and Scripting

Random number generating script?

Having a hard time with this. Very new to scripting and linux. Spent all sunday trying to do this. Appreciate some help and maybe help breaking down what the syntax does. Create a Bash program. It should have the following properties • Creates a secret number between 1 and 100 i. The... (3 Replies)
Discussion started by: LINUXnoob15
3 Replies

5. Shell Programming and Scripting

Need to generate a file with random data. /dev/[u]random doesn't exist.

Need to use dd to generate a large file from a sample file of random data. This is because I don't have /dev/urandom. I create a named pipe then: dd if=mynamed.fifo do=myfile.fifo bs=1024 count=1024 but when I cat a file to the fifo that's 1024 random bytes: cat randomfile.txt >... (7 Replies)
Discussion started by: Devyn
7 Replies

6. Shell Programming and Scripting

Cat termination in script

So, I'm writing a shell script to help automate a process I'm doing. Basically I want to take input from the user for 2 variables, then create a file that consists of: Variable1,Variable2 Constant1 Constant2 .. Constant2000 then run an awk script. I'm pretty new to unix though, and so... (11 Replies)
Discussion started by: Parrakarry
11 Replies

7. Shell Programming and Scripting

Generate random numbers in script

i want to generate a random number through a script, and even if anyone reads the script, they wont be able to figure out what the random number is. only the person who setup the script would know it. something like this could work: random the full thread is here: ... (13 Replies)
Discussion started by: SkySmart
13 Replies

8. Ubuntu

expect script for random password and random commands

Hi I am new to expect. Please if any one can help on my issue its really appreciable. here is my issue: I want expect script for random passwords and random commands generation. please can anyone help me? Many Thanks in advance (0 Replies)
Discussion started by: vanid
0 Replies

9. Shell Programming and Scripting

Catching the termination of one script

Hi I have a Shell script that needs to execute a command at the End of the excursion of other script And I cant get a handel On the trap command. And that is if the trap command Is the proper way to go this is a extract of the script MYHOST=`hostname| cut -d. -f1` echo $MYHOST ... (4 Replies)
Discussion started by: Ex-Capsa
4 Replies

10. Shell Programming and Scripting

random function script

hi, I need a command which picks the records randomly from the file. For example. i am having some 10000 entries in a file and need to extract the lines randomly without repeating the numbers. Do anybody have any idea on how to get this out. (4 Replies)
Discussion started by: prash_b
4 Replies
Login or Register to Ask a Question