fix cleanup script
This commit is contained in:
@@ -12,7 +12,7 @@ source $SCRIPT_DIR/defaults.sh
|
|||||||
# call clean on exit
|
# call clean on exit
|
||||||
trap clean EXIT
|
trap clean EXIT
|
||||||
|
|
||||||
run_script $LOCAL_CHIPYARD_DIR/.circleci/clean-old-files.sh
|
run_script $LOCAL_CHIPYARD_DIR/.circleci/clean-old-files.sh $CI_DIR
|
||||||
|
|
||||||
if [ ! -d "$LOCAL_VERILATOR_DIR" ]; then
|
if [ ! -d "$LOCAL_VERILATOR_DIR" ]; then
|
||||||
# set stricthostkeychecking to no (must happen before rsync)
|
# set stricthostkeychecking to no (must happen before rsync)
|
||||||
|
|||||||
@@ -1,10 +1,7 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
# clean directories that are older than 30 days
|
# clean directories that are older than 30 days
|
||||||
|
# argument is used as the directory to look in
|
||||||
# get shared variables
|
|
||||||
SCRIPT_DIR="$( cd "$( dirname "$0" )" && pwd )"
|
|
||||||
source $SCRIPT_DIR/defaults.sh
|
|
||||||
|
|
||||||
age () {
|
age () {
|
||||||
local AGE_SEC
|
local AGE_SEC
|
||||||
@@ -21,10 +18,12 @@ age () {
|
|||||||
echo $(expr $DIFF_SEC / $SEC_PER_DAY)
|
echo $(expr $DIFF_SEC / $SEC_PER_DAY)
|
||||||
}
|
}
|
||||||
|
|
||||||
for d in $CI_DIR/*/ ; do
|
for d in $1/*/ ; do
|
||||||
DIR_AGE="$(age $d)"
|
DIR_AGE="$(age $d)"
|
||||||
if [ $DIR_AGE -ge 30 ]; then
|
if [ $DIR_AGE -ge 30 ]; then
|
||||||
echo "Deleting $d since is it $DIR_AGE old"
|
echo "Deleting $d since is it $DIR_AGE old"
|
||||||
rm -rf $d
|
rm -rf $d
|
||||||
|
else
|
||||||
|
echo "Keep $d since it is $DIR_AGE old"
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ run () {
|
|||||||
}
|
}
|
||||||
|
|
||||||
run_script () {
|
run_script () {
|
||||||
ssh -o "StrictHostKeyChecking no" -t $SERVER 'bash -s' < $1
|
ssh -o "StrictHostKeyChecking no" -t $SERVER 'bash -s' < $1 "$2"
|
||||||
}
|
}
|
||||||
|
|
||||||
clean () {
|
clean () {
|
||||||
|
|||||||
Reference in New Issue
Block a user