For some reason, find does stat the current working directory,
which, when invoked via cron, may or may not be readable by the
process (issue 880). Therefore, first change to a directory that
is definitely accessible to the process; the directory it logs
into is such a safe place.
Signed-off-by: Klaus Aehlig <aehlig@google.com>
Reviewed-by: Petr Pudlak <pudlak@google.com>
echo "Cleaner started at $(date)"
+# Switch to a working directory accessible to the cleaner
+cd $CLEANER_LOG_DIR
+
# Remove old cleaner log files
find $CLEANER_LOG_DIR -maxdepth 1 -type f | sort | head -n -$KEEP_LOGS | \
xargs -r rm -vf
export PYTHON=${PYTHON:=python}
GNTC=daemons/ganeti-cleaner
-CCE=tools/check-cert-expired
+CCE=$PWD/tools/check-cert-expired
+
+if [ "x$PYTHONPATH" = "x." ]
+then export PYTHONPATH=$PWD
+fi
err() {
echo "$@"