LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - General (http://www.linuxquestions.org/questions/linux-general-1/)
-   -   Odd cron behavior with CentOS5 (http://www.linuxquestions.org/questions/linux-general-1/odd-cron-behavior-with-centos5-638766/)

jakev383 04-29-2008 07:30 PM

Odd cron behavior with CentOS5
 
I recently installed CentOS5 on my home file server and also use this machine to "backup" my subversion repos. I created a script to go into each dir and update the repo. This script runs fine when I'm at the CLI. I move the script to /etc/cron.hourly and I get problems:
Code:

Authentication realm: <http://127.0.0.1:80> Jake's Subversion Repository
Password for 'root': Authentication realm: <http://127.0.0.1:80> Jake's Subversi
on Repository
Username: svn: PROPFIND request failed on '/svn'
svn: PROPFIND of '/svn': authorization failed (http://127.0.0.1)

Here's the script itself:
Code:

#!/bin/sh
SVNDIR=/rd0/svn-backup

cd $SVNDIR/Projects
svn update
cd $SVNDIR/Documents
svn update
cd $SVNDIR/QTP
svn update
cd $SVNDIR/JakesProgs
svn update

Now this runs perfectly if I just run it from the CLI (./svn-backup.sh). I've already chmod'ed it to +x.
Any ideas?

billymayday 04-29-2008 07:34 PM

Try putting the full path for svn - cron doesn't inherit your environment (eg path)

jailbait 04-29-2008 07:34 PM

Try giving the full path for the svn command. Or you could set the PATH in the cron job to be the same as the PATH that you have at your CLI.

--------------------
Steve Stites

jakev383 04-30-2008 09:14 AM

That didn't work either. I ended up putting the script in /usr/local/sbin (irrelevant really) and then adding the cron to root's crontab (crontab -e). That pulled my ENV variables with it so all seems well now.
Thanks!

unSpawn 04-30-2008 10:34 AM

When you run the command or script from the commandline you run it as root account user, and crond runs as another user. If one doesn't want to use the root account crontab then Sudo should work.


All times are GMT -5. The time now is 10:33 AM.