Commit faa5ce00 authored by Klaus Aehlig's avatar Klaus Aehlig

Make ganeti-cleaner switch to a save working directory

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: default avatarKlaus Aehlig <aehlig@google.com>
Reviewed-by: default avatarPetr Pudlak <pudlak@google.com>
parent b61e7f29
......@@ -113,6 +113,9 @@ exec >>$LOG_FILE 2>&1
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
......
......@@ -24,7 +24,11 @@ set -o pipefail
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 "$@"
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment