crontab question

Sep 17, 2002 10:34

Trying to set up a system that will cause all my Movable Type posts to be mirrored here on LJ for friends lists. Have everything working from the command line just fine, but it just won't work from the crontab no matter what I do ( Read more... )

Leave a comment

Comments 19

jfusion September 17 2002, 11:56:10 UTC
You must have a blank line at the end of the file for cron to run. Check that.

Reply

jfusion September 17 2002, 11:56:44 UTC
And by "file," I mean your crontab.

Reply

shacker September 17 2002, 14:43:41 UTC
Well, again, the crontab is definitely running - I can see it in the logs, and other items in the crontab run just fine. It's just this item that fails silently. Thanks though.

Reply


cron debugging anonymous September 17 2002, 12:04:26 UTC
If you got a bash/sh/ksh on your system, you can use the following. It helps a lot...it's from another Unix, but it should work on OS-X (maybe with some mods). You run this script, then run your program, and voila, it runs in the cron environment. I use it a bunch.

#!/usr/bin/bash ( ... )

Reply

Re: cron debugging shacker September 17 2002, 14:52:04 UTC
Very interesting. When I execute this (without even following it with the script I want to run), I get this at the end of the output:

/Users/shacker/bin/crondebug.sh: rm: command not found
/Users/shacker/bin/crondebug.sh: sh: command not found

In other words, it has NO awareness of paths on my system. Does that mean I need full paths to every single little thing in the perl script? There's got to be a better way...

Thanks for this!

Reply

Re: cron debugging yakko September 17 2002, 16:12:51 UTC
That would be because rm and sh are in /bin, which doesn't appear to be in the PATH included in the script.

As long as you've got a sane PATH, your script (and any processes it spawns) should be fine.

Reply

Re: cron debugging shacker September 18 2002, 00:15:39 UTC
You're right - the final solution turned out to be creating a script that reproduced my entire path env, then the script command. Thanks man...

Reply


(The comment has been removed)

shacker September 17 2002, 14:45:39 UTC
Just changed my password so it's not using any special characters, still won't run from cron.

Running the script from the command line, I just noticed something else strange - the entries it creates aren't quite in the form you mentioned last night. Rather than

[blog link ] [item link]

I get

[blog link ] [http://shacker.livejournal.com/]

So there is no permalink for the reader to follow even if I could get this running from cron. Any idea what's up with that?

Reply

(The comment has been removed)

shacker September 17 2002, 15:16:18 UTC
Excellent, I'll try the update tonight (busy at work today). Yep, I'm running the crontab on my home OS X box, which is also www.betips.net - cron run several other tasks that go fine, and the script does show up in the syslog.

Thanks for your work on this!

Reply


yakko September 17 2002, 16:15:53 UTC
Have /bin/sh evaluate your script as a command:

* * * * * /bin/sh -c "/Users/shacker/bin/blaggupdate.sh"

If you have the #!/bin/sh in as the first line of blaggupdate.sh, just make sure it's executable and leave off the /bin/sh part in crontab.

Reply

(The comment has been removed)

Re: Another hint... shacker September 17 2002, 23:18:56 UTC
Good suggestion, but no joy. Thanks though. I'm really getting frustrated with this... have never been so beaten by a crontab...

Reply


Leave a comment

Up