Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!

SETI script and the Console app UNIX
I run the SETI@home command line program on both cpus in my OSX box. After doing this for many months I finally got sick of seeing their terminal icons in the dock, so decided to run SETI in the background and not tie up a terminal (or two) to monitor SETI output.

Read the rest of this article for an excellent tutorial on how to set up Seti to run without requiring a terminal window...

Here is the script I use:

#!/bin/csh -f

cd /Users/rob/Seti/cpu$1
while (1)
./setiathome -nice 20 >/dev/console
sleep 600
end

I run the script like this:
/Users/rob/bin/start_SETI 1 &
/Users/rob/bin/start_SETI 2 &

cpu$1 is translated to cpu1 or cpu2 respectively, so that the SETIs run from 2 different directories.

The infinite while loop is there to keep restarting SETI should it ever crash (it does crash about once a month :-)

To stop the SETI program from spewing output to a terminal or some black hole, I redirect the output to /dev/console.

I always leave the Console.app (in /Applications/Utilities) running so that I can see system messages and error diagnostics. (Console tip: console remembers its shape and location, so resize and move it till you're happy. Also, use the preferences to make it disappear (hide) a short while after showing new output).

So now when SETI has something to tell me, the console appears automagically and I don't have to keep 2 terminal windows around to monitor SETI diagnostic messages.
    •    
  • Currently 2.33 / 5
  You rated: 2 / 5 (3 votes cast)
 
[3,853 views]  

SETI script and the Console app | 3 comments | Create New Account
Click here to return to the 'SETI script and the Console app' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
Upgrade
Authored by: babbage on May 07, '01 12:21:48PM
You might want to consider getting a more recent version of the S@H software. I'm running:
/Users/chris/setiathome-3.03.powerpc-apple-darwin1.2% setiathome -version
SETI@home client.
Platform: powerpc-apple-darwin1.2
Version: 3.03

[...sniiiiip]

The version I installed last week came with a very helpful README file that seem to give a more straightforward approach here. A relevant section reads as follows:

    If you want setiathome to be started automatically, you can
    set up a cron job.  Add the following line to your crontab:

    0 * * * * cd ; ./setiathome -nice 19 > /dev/null 2> /dev/null

    Where  is the directory where the setiathome client is installed.
    This cron job will attempt to start the client at the top of every hour.
    If it is already running, the next invocation will do nothing.
    If the client is not running, it will be started.
    For more information on cron jobs see the crontab(1) manual page.

As per your advice, it might be a good idea to chance /dev/null to /dev/console, but otherwise, this seems like a better approach to me. It runs as a cron job, so the system will run it even when you're not logged in (or someone else is logged in, or whatever). No monkeying around with new terminals for it etc.

The bit I'm not sure about is how you might want to adjust things for a multiprocessor setting. I have no experience with this, and perhaps things should indeed be done differently. All the same, I still feel that going through the cron system is a better strategy overall.

[ Reply to This | # ]

Upgrade (not)
Authored by: robh on May 07, '01 12:58:07PM

I'm running the 3.03 version and aware of their cron suggestion.

The problem with the cron method is that every time cron tries to start a new SETI it will output a warning that there's one already running. Now if you follow their advice and dump all output into the bit bucket (/dev/null), then there's no problem, but you never see ANY output. If you redirect the output to /dev/console then you'll see a warning every time cron fires it up. Even if it's once an hour it can be a distraction. Using my script, SETI is only (re)started when an earlier invocation has crashed or terminated.

Pick the method that suits you best.



[ Reply to This | # ]
Upgrade (not)
Authored by: babbage on May 07, '01 02:22:55PM
Ok, so adjust the cronjob to only launch if setiathome isn't running:
0 * * * * cd setidir; ((ps ax | grep seti | grep -v grep) || ./setiathome -nice 19) > /dev/console 2> /dev/console

Check for the presense of the setiathome process, filter out the check itself, and if the check fails then launch seti again. There's probably about a million ways to do this ("timtowtdi"), but as a general rule I still think that ways that work through the cron system are going to be more suitable than ways that try to avoid or work around it.

My actual line goes to /dev/console (now, but I may put it back to /dev/null if I decide I'd rather have it run quietly), and more importantly it also sends an email if anything goes wrong (which seems like a better alert mechanism than the console anyway, at least to me -- it can go to another machine, can be read later, etc).

[ Reply to This | # ]