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 > Software - Troubleshooting and Discussion > Mac OS X > cron an nohup weirdness under 10.2.7

cron an nohup weirdness under 10.2.7
Thread Tools
Dedicated MacNNer
Join Date: Oct 2000
Location: Pasadena, CA, USA
Status: Offline
Reply With Quote
Oct 2, 2003, 11:07 AM
 
Yes, I have a shiny new G5 running 10.2.7, and I have two problems:

1. cron doesn't seem to run any of my added tasks
2. things run in the background using nohup are still being killed when the current user logs out

For cron, I tried using "crontab -e" for a regular user, an administrator, and root, and editing /etc/crontab directly, but in all cases the script was not run. Here's the entry I used:

*/5 * * * * * /Users/userhome/dir/script.pl

Or something like that. I'm not at my computer so I may not have the right number of "*", but the "*/5" is right - I have a job I want run every 5 minutes, period. But no love - the script doesn't run.

So I changed my script to run in a loop, sleeping for 5 minutes between loops, and tried nohup:

> nohup script.pl &

And this works, but if I log out the process is killed about 1/2 the time.

Any ideas?
     
Mac Elite
Join Date: Dec 2001
Location: Atlanta, GA, USA
Status: Offline
Reply With Quote
Oct 2, 2003, 12:17 PM
 
Originally posted by eyadams:
Yes, I have a shiny new G5 running 10.2.7, and I have two problems:

1. cron doesn't seem to run any of my added tasks
2. things run in the background using nohup are still being killed when the current user logs out

For cron, I tried using "crontab -e" for a regular user, an administrator, and root, and editing /etc/crontab directly, but in all cases the script was not run. Here's the entry I used:
Is cron actually running? There should be a process running as root like this:
Code:
[arkham@flybook /] ps -auxww | grep cron | grep -v grep root 399 0.0 0.0 13868 140 ?? Ss Mon09AM 0:00.63 cron
If that process is not running, you need to fix that first. I remember having to do something to start cron. Anyway, cron is started by /System/Library/StartupItems/Cron/Cron if you need to investigate.



> nohup script.pl &

And this works, but if I log out the process is killed about 1/2 the time.
Not sure why your script is dying when you log out, but it might help to log the standard out/standard error. Instead, run it like this (assuming a bourne shell here):

nohup script.pl > ~/script.log 2>&1 &

If you're using csh or tcsh, do this instead:

nohup sh -c "test.pl > testlog 2>&1 &"
Mac Pro 2x 2.66 GHz Dual core, Apple TV 160GB, two Windows XP PCs
     
   
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 03:52 AM.
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