Welcome to the MacNN Forums.

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

You are here: MacNN Forums > Community > Team MacNN > Simple DF script

Simple DF script
Thread Tools
Grizzled Veteran
Join Date: Sep 2000
Location: Florida
Status: Offline
Reply With Quote
Apr 15, 2002, 08:27 PM
 
I wrote a very very simple script that keeps tabs on the dFold client's progress when it is hidden. It outputs the progress in structures completed and remaining until upload. It also displays the current time and uptime, so you can make some speed calculations.

<BLOCKQUOTE><font size="1"face="Geneva, Verdana, Arial">code:</font><HR><pre><font size=1 face=courier>#!/bin/sh

while [ <font color = blue>1</font> ]; do

echo <font color = red>" "</font>
echo <font color = red>"progress"</font>
more progress.txt
echo <font color = red>" "</font>
echo <font color = red>"Current time and uptime"</font>
uptime


sleep <font color = blue>60</font>

done</font>[/code]
What I am about to say is alot like what mikkyo said about his script. Copy and paste that code into a textedit document and make is plain text. Then navigate to the file in the terminal and type "chmod a+rx (filename)" to make it executeable. then run the client hidden or quiet, and then run the script to see the progress. It displays the info every 60 seconds, but that is easy to change. The working directory must be the one with the client for the script to work; it need not be /Applications/distribfold.

You could also insert the line

<BLOCKQUOTE><font size="1"face="Geneva, Verdana, Arial">code:</font><HR><pre><font size=1 face=courier>
./foldtrajlite -f protein -n native -qt &
</font>[/code]

before the word while, so that one script starts the client and then keeps tabs on it.

Thanks mikkyo for your Ubero script, and giving me a great example to learn from.

[ 04-20-2002: Message edited by: SkiBikeSki ]
-- SBS --
     
Grizzled Veteran
Join Date: Sep 2000
Location: Florida
Status: Offline
Reply With Quote
Apr 15, 2002, 08:30 PM
 
The UBB code failed, but it is still ledgible, right?
-- SBS --
     
Mac Elite
Join Date: Jan 2002
Location: Mile High City
Status: Offline
Reply With Quote
Apr 15, 2002, 11:50 PM
 
Originally posted by SkiBikeSki:
<STRONG>The UBB code failed, but it is still ledgible, right?</STRONG>
I little tough for someone not used to reading html or UBB.

You used HTML brackets instead of UBB brackets, that is why it failed. Get rid of all the fancy font and color stuff and just post the code straight up or use a simple UBB bold or quote code.

Still I am going to try it. If I get the time tonight, I may even repost it cleaned up if you don't get the chance.

Thanks, it looks great.!!!!!!!


[ 04-16-2002: Message edited by: Shaktai ]
     
Administrator
Join Date: May 2000
Location: California
Status: Offline
Reply With Quote
Apr 16, 2002, 12:29 AM
 
The problem is the &lt;code&gt; tag is not properly re-evaluated when you edit a post. It was fine until the edit, then the HTML was not converted back to UBB tags. When the edited page was resubmitted, the HTML was not accepted (HTML is off in the Team forum).

This is what I came up with when I cleaned out the extra tags:
<BLOCKQUOTE><font size="1"face="Geneva, Verdana, Arial">code:</font><HR><pre><font size=1 face=courier>#!/bin/sh

while [ <font color = blue>1</font> ]; do

echo <font color = red>" "</font>
echo <font color = red>"progress"</font>
more progress.txt
echo <font color = red>" "</font>
echo <font color = red>"Current time and uptime"</font>
uptime

sleep <font color = blue>60</font>

done</font>[/code]

... and for the launch command:
<BLOCKQUOTE><font size="1"face="Geneva, Verdana, Arial">code:</font><HR><pre><font size=1 face=courier>./foldtrajlite -f protein -n native -qt &</font>[/code]
Note, I did not check syntax or function, just cleaned out the UBB junk.

[ 04-16-2002: Message edited by: reader50 ]
     
Grizzled Veteran
Join Date: Sep 2000
Location: Florida
Status: Offline
Reply With Quote
Apr 16, 2002, 12:33 AM
 
I guess editing a message with UBB code is a no no. Thanks Skaktai. Thanks reader.
-- SBS --
     
Administrator
Join Date: May 2000
Location: California
Status: Offline
Reply With Quote
Apr 16, 2002, 12:42 AM
 
No problem.

It is safe to edit posts with UBB tags, except where they use the &lt;code&gt; tag. In that case, you would have to clean out the "extra" HTML, and restore that part of the post.

This failure to convert the code tag back is a bug left over from when parallax added the colors code. Someday we will bug him enough to fix the problem.
     
Mac Elite
Join Date: Jan 2002
Location: Mile High City
Status: Offline
Reply With Quote
Apr 16, 2002, 12:59 AM
 
Okay, I keep getting the following error message:

./folditscript: command not found: 1 [4]

And here is the script.....

#!/bin/sh

./foldtrajlite -f protein -n native -qt &
while 1; do
echo " "
echo "progress"
more progress.txt
echo " "
echo "Current time and uptime"
uptime
sleep 60
done


What have I done wrong. It does run as an executable, and it actually starts up foldtrajlite in quiet mode without the need for the terminal. But it gives no feedback, just the error.
     
Grizzled Veteran
Join Date: Sep 2000
Location: Florida
Status: Offline
Reply With Quote
Apr 16, 2002, 01:03 AM
 
I think your while statement needs to look like this:

<BLOCKQUOTE><font size="1"face="Geneva, Verdana, Arial">code:</font><HR><pre><font size=1 face=courier>
while [ <font color = blue>1</font> ]; do
</font>[/code]

I basically copied that from mikkyo's script.
-- SBS --
     
Mac Elite
Join Date: Jan 2002
Location: Mile High City
Status: Offline
Reply With Quote
Apr 16, 2002, 01:21 AM
 
Yippe ki yay! This is what I got after the correction.

[localhost:~] xxxxxxx% cd /Applications/distribfold
[localhost:/Applications/distribfold] xxxxxx% ./folditscript

progress
progress.txt: No such file or directory

progress
Building structure 10
4990 until next upload

Current time and uptime
11:12PM up 1 day, 12:06, 2 users, load averages: 1.67, 1.83, 1.81
Does anyone know what the "2 users" and "load averages" refer to?

[ 04-16-2002: Message edited by: Shaktai ]
     
Administrator
Join Date: May 2000
Location: California
Status: Offline
Reply With Quote
Apr 16, 2002, 02:29 AM
 
The last line (users, loads) is generated by the "uptime" command, which is present in the script. "uptime" gives the time since last boot. Try "man uptime" for more info.
     
Junior Member
Join Date: Apr 2001
Location: London, UK
Status: Offline
Reply With Quote
Apr 16, 2002, 03:36 AM
 
As we're posting code, here's my variant on the status code. It's quite similar except I don't bother with a while loop as I only take a look at it occasionally. Also I've made it cope with 1 or 2 cpus and give a slightly different reading on CPU and memory usage.

<BLOCKQUOTE><font size="1"face="Geneva, Verdana, Arial">code:</font><HR><pre><font size=1 face=courier>
#!/bin/sh

# Edit this to be the number of cpus you are using

CPUS=<font color = blue>2</font>

# Edit CPU1_DIR to be the path to the first cpu's directory

CPU1_DIR=/usr/local/macnn/dfold/p1

# Edit CPU2_DIR to be the path to the second cpu's directory
# If you only have one cpu then don't worry about this

CPU2_DIR=/usr/local/macnn/dfold/p2

echo
echo System Utilisation
ps -awrc -Ouser,%cpu,%mem,rss,vsz | egrep <font color = red>"foldtrajlite|COMMAND"</font> | grep -v egrep

echo
echo dfold1 status
more ${CPU1_DIR}/progress.txt
echo

if [ ${CPUS} -eq <font color = blue>2</font> ]; then
echo dfold2 status
more ${CPU2_DIR}/progress.txt
echo
fi

</font>[/code]

For the System Utilisation here's what the various headings mean:

PID is the process number
USER is the user name of the process owner
%CPU is the percentage of total CPU currently used by that process
%MEM is the percentage of total memory currently used by that process
RSS is the real memory (resident set) size of the process in Kbytes.
VSZ is the virtual size in Kbytes.
TT is an abbreviation for the pathname of the controlling terminal, if any. The abbreviation consists of the three letters following /dev/tty, or, for the console, ``con''. This is followed by a ``-'' if the process can no longer reach that controlling terminal (i.e., it has been revoked).
STAT is the process state given by a sequence of letters. See the man pages for a full list of states.

I've set up an alias to this in my shell environment so all I have to type is dfstatus to get this to run.
Join the fun Join Team MacNN
     
Grizzled Veteran
Join Date: Sep 2000
Location: Florida
Status: Offline
Reply With Quote
Apr 16, 2002, 09:03 PM
 
I was gonna make a DP version but you beat me to it. The reason I have the while loop is so that overnight it collects a lot of data. For instance in a 20 hours period, my G4 crunched at an average rate of 1587Units/Hour. About half of what it was before the update.

[ 04-17-2002: Message edited by: SkiBikeSki ]
-- SBS --
     
Junior Member
Join Date: Apr 2001
Location: London, UK
Status: Offline
Reply With Quote
Apr 17, 2002, 01:52 AM
 
Originally posted by SkiBikeSki:
<STRONG>I was gonna make a DP version but you beat me to it. The reason I have the while loop is so that overnight it collects a lot of data. For instance in a 20 hours period, my G4 crunched at an average rate of 1587Units/Hour. About of what it was before the update.</STRONG>
Now that my box is more stable I will do some stats collection. I'll do a benchmarking run tonight and see what my DP 450 can do. I've set up a cron job to dump the status into a file every hour. For those not savvy with cron the line was:

30 * * * * /usr/local/macnn/dfold/status &gt;&gt;! /usr/local/macnn/dfold/crunch.log

I also changed the more to cat so I didn't get file headers in my logfile. If I hadn't already put in a header line per process I'd have left the more in as it gives a nice underlined title for the whole path of each progress.txt file.

[ 04-17-2002: Message edited by: wheeles ]
Join the fun Join Team MacNN
     
Grizzled Veteran
Join Date: Sep 2000
Location: Florida
Status: Offline
Reply With Quote
Apr 20, 2002, 04:04 PM
 
I wrote another much better script to monitor 1 or 2 dFold clients. And it can stop and restart them periodically to avoid the memory leak problem. Here's a rundown of what it does:

1User config area explained with comments in script
2Gets number of CPU's
3Starts 1 or 2 clients in quiet mode
4Displays the progress of 1 or 2 clients
5Displays the time and uptime
6Repeats last 2 steps periodically
7After enough time has passed it gracefully stops both clients
8Goes to step 3

Here's what's in the user config area:
dfdir1 = the full path to the first or only DF directory
dfdir2 = the full path to the second DF directory
numCPU = Set automatically
outtime = How often you want the info outputted to the screen
runtime = How long you want the clients to run before stopping and restarting

I Haven't yet had a chance to make absolutely sure that the stopping code work perfectly, so I would appreciate some feedback. The worst case scenario is that the client isn't stopped, so there is much to worry about.

Enjoy!


Download it here! Only 777Bytes!

[ 04-21-2002: Message edited by: SkiBikeSki ]
-- SBS --
     
Grizzled Veteran
Join Date: Sep 2000
Location: Florida
Status: Offline
Reply With Quote
Apr 20, 2002, 04:06 PM
 
I fixed the problem. I got some help from the X-UNIX section of these forums. Now everything should work exactly as I said it would.

[ 04-21-2002: Message edited by: SkiBikeSki ]
-- SBS --
     
Grizzled Veteran
Join Date: Sep 2000
Location: Florida
Status: Offline
Reply With Quote
Apr 21, 2002, 02:30 AM
 
BUMP! I edited the messages above and wanted this topic bumped to the top. I also wanted my post counter to be incremented.
-- SBS --
     
Mac Elite
Join Date: Jan 2002
Location: Mile High City
Status: Offline
Reply With Quote
Apr 21, 2002, 02:56 AM
 
Originally posted by SkiBikeSki:
<STRONG>BUMP! I edited the messages above and wanted this topic bumped to the top. I also wanted my post counter to be incremented.</STRONG>
I'll give it a try.... maņana.
     
Grizzled Veteran
Join Date: Sep 2000
Location: Florida
Status: Offline
Reply With Quote
Apr 22, 2002, 01:35 AM
 
It works! I just witnessed it restart the client.

In my next version I will have it output the info to a file. And add more text that is ouputted, like when it restarts. Then in TextEdit you can search for the word "restart" and find the time and units in between and get easy benchmarks.

BTW is it just me and Shaktai that use this script. I would hope that everyone in the comp. would use it, since that would level the playing field a bit.
-- SBS --
     
Mac Elite
Join Date: Jan 2002
Location: Mile High City
Status: Offline
Reply With Quote
Apr 22, 2002, 01:49 AM
 
Originally posted by SkiBikeSki:
<STRONG>It works! I just witnessed it restart the client.

In my next version I will have it output the info to a file. And add more text that is ouputted, like when it restarts. Then in TextEdit you can search for the word "restart" and find the time and units in between and get easy benchmarks.

BTW is it just me and Shaktai that use this script. I would hope that everyone in the comp. would use it, since that would level the playing field a bit.</STRONG>
Well I haven't witnessed a restart yet and won't before tomorrow afternoon, but so far it does seem to work fine otherwise.
     
Grizzled Veteran
Join Date: Sep 2000
Location: Florida
Status: Offline
Reply With Quote
Apr 22, 2002, 04:33 PM
 
The next revision is up on my iDisk. Download it here! Only 921 Bytes!

I changed the way one inputs the desired time delays. Now they're in minutes and hours for simplicity. I added some more screen output when it restarts, and some simple instructions on how to take benchmarks. I also added another script called "DFL2file.txt" that launches the original script, and sends the output to a file called "DFLog.txt" If FDLog.txt already exists it then adds to the end of it.

Enjoy!
-- SBS --
     
Grizzled Veteran
Join Date: Sep 2000
Location: Florida
Status: Offline
Reply With Quote
May 23, 2002, 01:10 AM
 
There now seems to be a bit of talk about DFold scripts, so BUMP here it is.
-- SBS --
     
Senior User
Join Date: Jan 2001
Location: San Francisco, CA
Status: Offline
Reply With Quote
May 24, 2002, 12:10 AM
 
Thanks for the work SKI.. Got one running today, I'll check it tomorrow then move the rest o my macs onto the script.

Team MacNN :: Crush the competition :: crunching :: Dual Ghz G4/Radeon 9000/23" Cinema Display
     
   
Thread Tools
Forum Links
Forum Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Top
Privacy Policy
All times are GMT -5. The time now is 11:55 PM.
All contents of these forums © 1995-2011 MacNN. All rights reserved.
Branding + Design: www.gesamtbild.com
vBulletin v.3.8.7 © 2000-2011, Jelsoft Enterprises Ltd., Content Relevant URLs by vBSEO 3.3.2