Move cleaning to a global position.
This commit is contained in:
parent
ef18e94ff8
commit
8b4a5e0847
@ -89,7 +89,6 @@ function cmd_start {
|
|||||||
mkdir -p "$RUN_DIR"
|
mkdir -p "$RUN_DIR"
|
||||||
local PORTUPDATE=0
|
local PORTUPDATE=0
|
||||||
local LASTBUILD=0
|
local LASTBUILD=0
|
||||||
local LASTCLEAN=0
|
|
||||||
if [ -e "$TIMES_FILE" ]; then
|
if [ -e "$TIMES_FILE" ]; then
|
||||||
source "$TIMES_FILE"
|
source "$TIMES_FILE"
|
||||||
fi
|
fi
|
||||||
@ -105,22 +104,34 @@ function cmd_start {
|
|||||||
build -j "$JAIL" -p "$PORTS" -z "$SET" -f /usr/local/etc/poudriere.d/$JAIL-$PORTS-$SET-pkglist
|
build -j "$JAIL" -p "$PORTS" -z "$SET" -f /usr/local/etc/poudriere.d/$JAIL-$PORTS-$SET-pkglist
|
||||||
LASTBUILD=$(date +%s)
|
LASTBUILD=$(date +%s)
|
||||||
fi
|
fi
|
||||||
if [ $((now - LASTCLEAN)) -gt "$CLEAN_SECONDS" ]; then
|
|
||||||
log "Cleaning for $JAIL-$PORTS-$SET"
|
|
||||||
# Cleanup old unused dist files
|
|
||||||
poudriere distclean -v -y -p "$PORTS" -f /usr/local/etc/poudriere.d/$JAIL-$PORTS-$SET-pkglist
|
|
||||||
poudriere logclean -v -y "$LOG_RETENTION_DAYS"
|
|
||||||
# TODO: Should clean be a global ?
|
|
||||||
LASTCLEAN=$(date +%s)
|
|
||||||
fi
|
|
||||||
|
|
||||||
cat > "$TIMES_FILE" <<EOF
|
cat > "$TIMES_FILE" <<EOF
|
||||||
PORTUPDATE=$PORTUPDATE
|
PORTUPDATE=$PORTUPDATE
|
||||||
LASTBUILD=$LASTBUILD
|
LASTBUILD=$LASTBUILD
|
||||||
LASTCLEAN=$LASTCLEAN
|
|
||||||
EOF
|
EOF
|
||||||
)
|
)
|
||||||
done
|
done
|
||||||
|
|
||||||
|
(
|
||||||
|
set +e
|
||||||
|
local GLOBAL_TIMES_FILE="$INFO_DIR/times"
|
||||||
|
local LASTCLEAN=0
|
||||||
|
if [ -e "$GLOBAL_TIMES_FILE" ]; then
|
||||||
|
source "$GLOBAL_TIMES_FILE"
|
||||||
|
fi
|
||||||
|
local now=$(date +%s)
|
||||||
|
if [ $((now - LASTCLEAN)) -gt "$CLEAN_SECONDS" ]; then
|
||||||
|
log "Global Cleaning."
|
||||||
|
# Cleanup old unused dist files
|
||||||
|
poudriere distclean -v -y -a
|
||||||
|
poudriere logclean -v -y "$LOG_RETENTION_DAYS"
|
||||||
|
LASTCLEAN=$(date +%s)
|
||||||
|
cat > "$GLOBAL_TIMES_FILE" <<EOF
|
||||||
|
LASTCLEAN=$LASTCLEAN
|
||||||
|
EOF
|
||||||
|
fi
|
||||||
|
|
||||||
|
)
|
||||||
sleep 300
|
sleep 300
|
||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user