Hi,

I have a running Gitorious installation into 2.4.10 version.

I would like to schedule a snapshot task into a cron job which should be 
executed under root privileges (as mentionned into Gitorious online doc).

Here is my cron job defined into /etc/cron.d/gitorious:

--8<------
RUBY_HOME=/opt/ruby-enterprise
GITORIOUS_HOME=/opt/gitorious

*/5 * * * * root /opt/gitorious-cronjob.sh
--8<------

Here is the simple script:

--8<------
#!/bin/bash

# Lock file
LOCKFILE="/var/lock/gitorious-cronjob.lock"

# Check lock file
[ -f $LOCKFILE ] && exit 2

# Lock this cronjob
echo $$ > $LOCKFILE

# Export path
if [ -n "$GITORIOUS_HOME" ] && [ -n "$RUBY_HOME" ]; then
  export PATH=$GITORIOUS_HOME/bin:$RUBY_HOME/bin:$PATH
fi

# Run jobs
cd /opt/gitorious
./script/snapshot ~git/gitorious-$(date +%Y%m%d).tar.gz

# Remove lock file
rm -f $LOCKFILE
--8<------

When I run manually this simple script, all is working fine and an archive 
is correclty created into "~git" directory.

But the corresponding cron job failed with the following error:

--8<------
X-Cron-Env: <RUBY_HOME=/opt/ruby-enterprise>
X-Cron-Env: <GITORIOUS_HOME=/opt/gitorious>
X-Cron-Env: <SHELL=/bin/sh>
X-Cron-Env: <HOME=/root>
X-Cron-Env: <PATH=/usr/bin:/bin>
X-Cron-Env: <LOGNAME=root>
X-Cron-Env: <USER=root>

Snapshotting state...
(in /opt/gitorious)
Please run the task as superuser/root!
Snapshot done.
--8<------

I had a look into the file "lib/tasks/backup.rake", and into the function 
called "exif_if_sudo". There is a condition which referred to 
"Process.uid". This statement returns "500", the uid of my "git" user which 
owns the entire "/opt/gitorious directory".

There is something I do not understand. So, any help would be greatly 
appreciated.

Cheers,

Thomas.

-- 
-- 
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]

--- 
You received this message because you are subscribed to the Google Groups 
"Gitorious" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to