It turns out that many of the options I've been given only work when the Terminal 
isn't already launched.  I ended up with the following crontab job

15  2  *  *  *  open -a Terminal.app /Volumes/Builds/Development/build.pl

So my next and hopefully last question is, does anyone know why this fails when the 
termianl is already open, even if it's not doing anything?  Is there a known 
workaround for this?

Thanks one last time!
Noah




-----Original Message-----
From: Charles Albrecht [mailto:[EMAIL PROTECTED]]
Sent: Thursday, August 08, 2002 1:18 PM
To: '[EMAIL PROTECTED]'
Subject: RE: Launching a Perl file with Cron on OS X?


I'd imagine the error you'd be receiving via email might be:

 root: Command not found.

You'll notice that it's attempting to execute the CMD

  "root open /Volumes/Builds/Development/perl.pl.command"

I'm not aware of an optional sixth field in the crontab format that
would designate "the user to run this command as" if there is
(the evidence of /etc/crontab notwithstanding).

The crontab that cron is running is the one that you installed using:

% crontab -e

It uses the format of crontab(5)

A) If you want this to run as root, you've got two options:

Install it into root's crontab using

% sudo crontab -e

B) Or into your own crontab with a listing of:

16 12 * * * sudo open /Volumes/Builds/Development/perl.pl.command

Of course, then, you'd need to special case /usr/bin/open in /etc/sudoers

C) Or, you could create a perl.sh.command with something (untested) like this:

!/bin/sh

sudo /Volumes/Builds/Development/perl.pl

(with /Volumes/Builds/Development/perl.pl special cased in /etc/sudoers)

And then use:

16 12 * * * open /Volumes/Builds/Development/perl.sh.command

in your own crontab.

D) But in general, I'd recommend, as others have, simply redirecting
output to a logfile that you can tail -f

% sudo crontab -e

16 12 * * * /Volumes/Builds/Development/perl.pl \
            1>& /var/log/development.log \
            2>& /var/log/development.err
# Or >> to append rather than replace

Then, you'd use

% tail -f /var/log/development.log

to watch its progress.

The benefit of this is that you're not chained to 'having the gui running'
as you would be if you were using open or some other technique that
forced a terminal to open.


Hope this helps,

-Charles
 [EMAIL PROTECTED]


At 12:37 PM -0700 8/8/2002, Noah Hoffman wrote:
>Hmm, still not working.  Here's what's in /var/log/system.log
>
>Aug  8 12:16:00 dhcp-192-168-66-178 CRON[4954]: (releaseb) CMD (root open 
>/Volumes/Builds/Development/perl.pl.command)
>Aug  8 12:16:00 dhcp-192-168-66-178 sendmail[4955]: g78JG0eG004955: SYSERR(releaseb): 
>collect: Cannot write ./dfg78JG0eG004955 (bfcommit, uid=25, gid=25): P$
>Aug  8 12:16:00 dhcp-192-168-66-178 sendmail[4955]: g78JG0eG004955: SYSERR(releaseb): 
>queueup: cannot create queue temp file ./tfg78JG0eG004955, uid=25: Per$
>Aug  8 12:16:00 dhcp-192-168-66-178 CRON[4953]: (releaseb) MAIL (mailed 29 bytes of 
>output but got status 0x0047 )
>Aug  8 12:17:52 dhcp-192-168-66-178 su: releaseb to root on /dev/ttyp1
>
>
>In crontab, I have [EMAIL PROTECTED] but I'm not getting email either.  
>Do you know what I'm missing?  I thought I was getting the 'cannot create temp file' 
>error because I wasn't root, but the crontab line is as follows:
>
>16  12  *  *  *  root open Volumes/Builds/Development/perl.pl.command
>
>Any thoughts?
>
>Thanks,
>Noah

Reply via email to