|
|
Mac OS X Hints -
Works fine for me -- my instance of setiathome is launched via cron at startup
and has, at current check, been running for just under 900 hours now:
2:20:55pm :chris% top -l1 | grep seti 283 setiathome 0.0% 899 hrs 1 25 672 14.8M 564K 15.0M 18.3M 2:22:12pm :chris% The lines in my /etc/crontab are: # launch seti@home on boot 0 * * * * chris cd /Users/chris/Applications/setiathome; ./setiathome -email -niCe 19 > /dev/console 2> /dev/console 0 * * * * root chmod 0777 /Users/chris/Applications/setiathome/lock.sah >/dev/console 2>/dev/console To be honest, I looked it up, locked it in, and forgot about it, so I forget exactly what these lines are doing in every detail, but suffice to say that they work just fine. The only glitch is that I get some unwanted messages to the console: "unable to start, file is locked" or something to that effect, which makes sense because the process is still running. If it was really a problem I'd write a launch wrapper to fork & exec like Apache does (have a conductor script that makes sure setiathome is running & launches it if not), but there really hasn't been the need for it -- the warnings don't bug me. If this doesn't help you, post more info -- what you've tried, what went wrong, etc.
Mac OS X Hints -
Is that in your user crontab? Or the system crontab, or root, or what? Which of the various cron files are you putting that line into to get it to kick off on startup? I've tried my crontab, root's, and system. What is the path of the cron file that line needs to be put into? I think that's what I'm doing wrong. I can't find the right file to get cron to do its magic on startup. That's what I expect. Or if I've found the correct file, then its proper activation eludes me. I suppose I don't fully understand the launch order for things on MacOS X, or cron for that matter, yet.
Path of appropriate cron file? Command to get that cron file to become active? You have no idea how much of a learning experience this has been for me. And by that I mean it's been really trying. : ]
Mac OS X Hints -
Is that in your user crontab?
I meant what I said: it's in /etc/crontab Sorry I don't understand the cron system better such that I could explain how it works... :(
Mac OS X Hints -
It's magic. I tried your syntax and it worked. now I have to go through the painful process of learning wy mine *didn't* work.
Why it didn't work for you.
Nothing magical - just shell choice.
You see, you used your own crontab (via crontab -e) to enter the script, but used the "setiathome > /dev/console 2> /dev/console" syntax to redirect stdout and stderr. The problem lies in the fact that your default shell is tcsh, and using 2> to redirect stderr only works for Bourne-style shells (sh/ksh/bash/etc). By putting in /etc/crontab, you got it to work because there is a line in /etc/crontab that says "SHELL=/bin/sh", so the 2> redirect works. There are three ways you can fix your script so you can leave your system crontab alone. I recommend using one of them, rather than futzing with /etc/crontab, since the system crontab may get overwritten when you reinstall, and in general you don't want to mess with system stuff. 1) Bring your script into csh compliance. Use "setiathome >& /dev/console" to merge stdout and stderr . 2) Make your crontab use a Bourne shell. Use Cronnix to set the SHELL environment variable to /bin/sh, or edit it yourself to include the line SHELL=/bin/sh 3) Have crontab call a standalone script. (Recommended) Make a file titled "Start.sah" or something similar. Put in it something like the following: #!/bin/sh /path/to/setiathome -nice 19 > /dev/console 2> /dev/console echo "Seti@Home started" > /dev/consoleAs stated, I recommend using option 3, in conjunction with the following trick. Put your crontab in ~/Library/init/crontab.mine. Use "crontab ~/Library/init/crontab.mine" as a command line alias (i.e. update_crontab). I don't think this works with CronniX, but it is nice, since the "permanent" copy of your crontab will live in your user directory, and thus will not get hosed when you move your User directory around for backup or reinstall purposes. |
SearchFrom our Sponsor...Latest Mountain Lion HintsWhat's New:HintsNo new hintsComments last 2 daysNo new commentsLinks last 2 weeksNo recent new linksWhat's New in the Forums?
Hints by TopicNews from Macworld
From Our Sponsors |
|
Copyright © 2014 IDG Consumer & SMB (Privacy Policy) Contact Us All trademarks and copyrights on this page are owned by their respective owners. |
Visit other IDG sites: |
|
|
|
Created this page in 0.08 seconds |
|