Script runs as root but not as crontab? or
Why does my script run as the root user but won't run from cron.daily? or
What user does cron.daily run as?
I recently ran into a problem with a Subversion update script I wished to execute daily. Unfortunately the svn update failed due to a permissions error. This made little sense to me as I believed if I ran the script as root the script should work. It turns out that on some *nix systems (RH Linux and other variants) the root user has a home directory called /root. Within this directory is where the .subversion directory sits which contains your connection information. Thus solution was to set the HOME variable in my script, as crontab doesn't necessarily pick up environment variables that you get when you log in.
Below you will find the simple fix.
#!/bin/sh
HOME=/root
export HOME=${HOME}
cd /usr/local/svn_workspace/trunk
/opt/CollabNet_Subversion/bin/svn update
Release Engineering is generally defined as the compilation, packaging and delivery of software. The release engineer is usually responsible for much more and has many roles in the software development processes. These roles can include; Supporting and improving tools for Continuous Integration, integrating automated testing, source control, and systems administration. I have collected notes over the past 20+ years and hope to post the best of them here.
Showing posts with label crontab. Show all posts
Showing posts with label crontab. Show all posts
Monday, August 27, 2012
Subscribe to:
Posts (Atom)