I've recently updated Trac from 0.11.4 to 0.12.2. I'm using the following shell script to backup Trac installation:
#!/bin/sh
DIR=/root/backup/trac/
NAME=`date +%Y-%m-%d-%H-%M`
cd $DIR
trac-admin /var/trac/projects/myproject/ hotcopy ./temp
tar -zcf TRAC_$NAME.tar.gz -C $DIR/temp .
rm -rf ./temp
It works ok when run from console, but the cronjob fails with following message:
Traceback (most recent call last):
File "/usr/bin/trac-admin", line 5, in <module>
from pkg_resources import load_entry_point
File "/usr/lib/python2.6/dist-packages/pkg_resources.py", line 2675, in <module>
parse_requirements(__requires__), Environment()
File "/usr/lib/python2.6/dist-packages/pkg_resources.py", line 552, in resolve
raise DistributionNotFound(req)
pkg_resources.DistributionNotFound: Trac==0.11.4
tar: /root/backup/trac//temp: Cannot chdir: No such file or directory
tar: Error is not recoverable: exiting now
Why does it work when run manually and not when from crontab? Why does it look for 0.11.4 version of Trac if I use 0.12.2 now?
Trac was installed and upgraded with easy_install
.