Boston Linux & Unix (BLU) Home | Calendar | Mail Lists | List Archives | Desktop SIG | Hardware Hacking SIG
Wiki | Flickr | PicasaWeb | Video | Maps & Directions | Installfests | Keysignings
Linux Cafe | Meeting Notes | Linux Links | Bling | About BLU

BLU Discuss list archive


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

crontab vs. links in /etc/cron.hourly (etc.)



On Tue, 4 Jun 2002, Scott Prive wrote:

> Hello,
> 
> Could someone tell me why, if I create a crontab entry for my script (or
> run it manually), it will work OK... but it will not run properly if
> called via a symlink in /etc/cron.hourly.
> 
> I chose not to post my script so as to not cloud the issue -- I have a
> solution.
> 
> To rephrase, I'm asking why something running as root would behave
> differently than if called via a symlink in /etc/cron.whatever.

It's almost certainly an environment variable issue, or a group issue, if 
you are saying you can log in (not just su) as root, and it runs fine, 
but it does not when you run it via cron. 

My almost-always-works debugging technique for shell scripts is:
turn on -xv to show lines as they are read and as they are executed.  
You can do this by:
- Putting -xv at the end of the #!, like    #!/bin/sh  -xv
- Running the script as "sh -xv myscript,sh"
- putting "set -xv" inside the script.  You can turn debugging off again
  with  "set +xv" (yes, it's backwards).
When you do this, every line will print as its read, and as it's executed 
(it will be prepended with a plus sign), complete with all variable 
substitutions, so you can really see what's happening.

Also, you know that /etc/crontab is a different format, right? 

-------------------------------------------------------------------
DDDD   David Kramer                   http://thekramers.net
DK KD  "The Hitchhiker's Guide to the Galaxy also mentions alcohol. 
DKK D  It says that the best drink in existance is the Pan Galactic
DK KD  Gargle Blaster."
DDDD             Douglas Adams, "Hitchhiker's Guide to the Galaxy".





BLU is a member of BostonUserGroups
BLU is a member of BostonUserGroups
We also thank MIT for the use of their facilities.

Valid HTML 4.01! Valid CSS!



Boston Linux & Unix / webmaster@blu.org