PDA

View Full Version : Improving my DF keepalive script



Kosh
08-29-2002, 12:45 AM
Considering the speed of this protein this is no time for any processor to be idle (especially when I'm in Chinasaur's crosshairs). I wanted to post my foldit script and see what others have to say about it (improve dead process detection, find other problems, etc), or maybe just have other people in the team benefit from my script:


!/bin/bash
cd /usr/local/distribfold
echo "Taking first sample"
sampleOne=`ps -A|grep -i foldtrajlite`
sleep 3
sampleTwo=`ps -A|grep -i foldtrajlite`
echo "Taking second sample"
if [ "$sampleOne" != "$sampleTwo" ]; then
./df-linux-bench.pl|tee "`hostname`"
else
if [ "$sampleOne" != "" ]; then
echo "DF stalled ($sampleOne)"
killall foldtrajlite
fi

echo "Starting DF ..."
if [ -e foldtrajlite.lock ]; then
echo "Old lock found -- attempting to upload"
rm foldtrajlite.lock
./foldtrajlite -f protein -n native -ut
fi
nohup ./foldtrajlite -f protein -n native -qt -df -it -rt -g 25 &
sleep 1
if [ "`ps -A|grep -i foldtrajlite`" != "" ]; then
echo "DF started"
else
echo "*** ERROR *** DF has not been started"
fi
fi


The script uses Dyyryath's benchmark script, but you can just cut that part out if you don't want it.
It's already saved me once since I put it into cron (thanks Paratima).

Paratima
08-29-2002, 07:13 AM
Very neat!

/me takes notes/ ;)

And congrats on turning red. I know whatcha mean about Chinasaur... one of the things that keeps me up to speed is ulv breathing down my neck.

bwkaz
08-29-2002, 08:18 AM
Is there a reason that you don't use the user's foldit script to restart the client? I would think, at first, that using their script (so you get any of their modifications, without them having to change your script) would be the Right Thing to do. You could even keep nohup, and the "run in background" & stuff there. Then again, maybe it wouldn't be good. I'm guessing someone has brought this up, but I've never really looked at your script before ( :o ), so if you could enlighten me on the reasoning, I'd be appreciative.

Otherwise, I think it looks pretty good!

Paratima
08-29-2002, 12:40 PM
I just noticed that your upload line (-ut) needs a -df, or it won't send more than six result files. I think.

Kosh
08-29-2002, 06:00 PM
Originally posted by bwkaz
Is there a reason that you don't use the user's foldit script to restart the client? I would think, at first, that using their script (so you get any of their modifications, without them having to change your script) would be the Right Thing to do. You could even keep nohup, and the "run in background" & stuff there. Then again, maybe it wouldn't be good. I'm guessing someone has brought this up, but I've never really looked at your script before ( :o ), so if you could enlighten me on the reasoning, I'd be appreciative.

Otherwise, I think it looks pretty good!

I was not aware that the foldit script was anything more than the execution line for foldtrajlite. I will have to look at this when I get home, it's entirely possible that I am the one that needs enlightening.

Kosh
08-29-2002, 06:04 PM
Originally posted by Paratima
I just noticed that your upload line (-ut) needs a -df, or it won't send more than six result files. I think.

Thanks again Paratima! With this protein I could imagine a great many buffered result sets.

Do you have any comments about what bkwaz said? I am planning to d/l a fresh copy of DF when I get home and have a look at the foldit script but your insight would be appreciated.

bwkaz
08-29-2002, 07:13 PM
Originally posted by Kosh
I was not aware that the foldit script was anything more than the execution line for foldtrajlite.That's sort of all it is, at least in the various Unix flavors (the Windows foldit.bat does a lot more, but then, this script isn't for Windows ;) ). But the first time foldtrajlite runs (this is a new addition, added in the past few months), it asks the user a whole bunch of questions, and modifies the foldit script accordingly. Things like "use extra RAM", "use large buffer size", stuff like that. Once that happens, the foldit script becomes the only place where that info is stored. I was thinking that it might be better to respect the user's settings in there when the client got restarted.

Paratima
08-29-2002, 07:40 PM
Yeah! What kaz said. :p

Kosh
08-30-2002, 10:55 AM
You make a good point, right now all my machines run with the same set of options but the script should be machine independant. I'll post an edited version of the script in case anyone will be using what I've written.

Thanks for the suggestions and be sure to post more if you have any.

Also, could one of the admins please add a message to the first post letting people know they shouldn't copy and paste the script since it is currently written for my set of switches only.

TIA

Dyyryath
08-31-2002, 03:59 AM
This is what I'm using:

Dyyryath's Quickie Status Script (http://www.zerothelement.com/code/df-linux-status.html)

I run it by cron every 10 minutes or so. If a client is down, it attempts to restart it and emails me a message to let me know what's happened.

If it can't restart it after a set number of attempts, it quits trying and emails me a message to that effect.

I've had it in place for months now and it works great. It also keeps me from having to worry about starting the client after rebooting. It just comes back automatically.