802c509eb3
TODAY is a variable, add missing $ - which leads to removal of .venv on every run ;( Change-Id: I92a73304bb3f2f4d514df08b190bfa4ba2eac9e1
29 lines
486 B
Bash
29 lines
486 B
Bash
#!/bin/bash -xe
|
|
|
|
# Delete some files on slave at most once a day.
|
|
# Stores a marker file with date of last deletion.
|
|
|
|
VENV=~/.venv
|
|
|
|
|
|
MARKER=$VENV/CREATED
|
|
|
|
if [[ -f $MARKER ]] ; then
|
|
|
|
TODAY=$(date '+%Y%m%d')
|
|
# Delete only once a day
|
|
if [[ $(date -f $MARKER '+%Y%m%d') != $TODAY ]] ; then
|
|
rm -rf $VENV
|
|
fi
|
|
fi
|
|
|
|
# Create marker file if it does not exist.
|
|
|
|
if [[ ! -d $VENV ]] ; then
|
|
mkdir -p $VENV
|
|
fi
|
|
|
|
if [[ ! -f $MARKER ]] ; then
|
|
date '+%Y%m%d' > $MARKER
|
|
fi
|