I have a script I am migrating from one server to another. On the previous one it worked fine, but now a call to svn info
is failing when run inside a cronjob. The same call works fine if I su
as the same user cron
uses. The call only fails when it is a http://
url; info calls to file:///
urls work perfectly.
This is a vanilla CentOS 6.5 server with minimal software installed (svn 1.6.11
)
#cron
*/1 * * * * myuser /opt/update-stuff.sh >> /opt/update-stuff.log
#/1 is for testing this right now... got tired of waiting
The script looks a little like this, but a lot longer. It is only the one call that is failing
# update-stuff.sh
# this call just outputs blank. I can't tell what is failing
echo ==[ remote test ]==
svn info http://svn.corp.com/svn/repo1
# this call works just fine. not an auth test, just to show svn is working
echo ==[ local test ]==
svn info file:///opt/mirrors/repo1
Notes:
su
as myuser
and run the script, everything is fineroot
and myuser
is the same (exactly)svn
binary is usedFailing all else, is there some way to look at stderr
or some other output to hopefully see at least a simple error message.
Additional Info:
Thanks @LazyBadger. Just seeing the error finally let me to this:
/etc/bashrc
and others are not runSolution:
After finally getting the errors, I tried forcing svn to use the u/p. This works, but it complains about saving the auth info. So I edit .subversion/servers
. Still complains. So add a set
to the script. See the environment variables aren't being set (wrong home). To google! Then to a web-scraper that stole the answer that helped me from serverfault.com
# * * * * * user-name command to be executed
# use root user, and 'su' to get the same environment as if the user logged in
*/5 * * * * root su - myuser /opt/update-stuff.sh >> /opt/update-stuff.log 2>&1
Unrelated
*/1
in cron is Bad Idea (tm)svn info
file:///
protocol means nothing: file-based access doesn't use any authentication|authorization methods and (or) SVN-specific ACLs, which can (in theory) prevent accessing http-repoRelated
svn info
additionally, something like svn info http://svn.corp.com/svn/repo1 >> /opt/update-remote.log 2>&1
*/1
preventing from from getting any response from remote sideCollected from the Internet
Please contact [email protected] to delete if infringement.
Comments