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 | Blog | 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.)

I held back the script because I don't like to impose my scripts on people, and I had a pretty good hunch it was "something" to do with environment outside the script. But it looks like more information is needed so..

Basically script does a CVS checkout, tars it up and moves it to a normal user's http: directory. 

1) By "working OK when run manually, I mean I get a tarball the right size - 5MB - and which tar can read back in. In other words, I run the script from a bash shell.
2) When it runs via a symlink in /etc/cron (I just ln -s the script to a point inside /etc/cron.hourly/), the script runs... I get an output file. But the "tarball" isn't a valid tar, and is 10k. I looked inside the file and it's just binary junk. 
3) When we scheduled the script via a crontab entry, it runs OK (as in #1 exactly). I could accept that I "should" always use crontab and not link the cron dirs. BUT not knowing WHY the script flubbed up is like an itch you can't scratch. I guess it comes with working in SQA for 10 years. ;-)

And yeah, I know I didn't need to do this as root. Bad habit. It's a routinely dd-imaged box on a private LAN, so I'll just use root if I can.




# Abstract: An hourly cronjob to package the stest portion of CVS.
#   Currently I am running this on "tower15" so the stest
#   "install script" will have somewhere to fetch stest.tar from.
# Author: Scott Prive
# Depends: Requires prior CVS login under account running this script.

export CVSROOT=:pserver:qalab at bathtub:/var/cvsroot_generic
export CVSREAD=y
# temporarily rename tarball so we don't stomp on good version
export STEST='stest-dontuse-test.tar'
cd /root

#Clean it:
/bin/rm -rf stest
/bin/rm /sfs/qatest/$STEST

# Tar it:
/usr/bin/cvs co stest
/bin/tar cf /root/$STEST stest/

# Move it:
/bin/cp /root/$STEST /sfs/qatest/

# 0wn it
/bin/chown qatest:qatest /sfs/qatest/$STEST

-----Original Message-----
From: Nathan Meyers [mailto:nmeyers at]
Sent: Tuesday, June 04, 2002 6:37 PM
To: Scott Prive
Subject: Re: crontab vs. links in /etc/cron.hourly (etc.)

On Tue, Jun 04, 2002 at 06:11:02PM -0400, 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.

Different environment variables? Running as a different user? And what
does "work OK" mean - that it runs at all, that it has some expected
effects? What makes you think that posting the script would cloud the
issue? I think it might help explain the issue.

And could you explain your last sentence - I don't understand the
contrast between "running as root" and "called via a symlink"? Is the
script being run by root always, sometimes, or never?

Nathan Meyers
nmeyers at

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 /