40-autodist-cleanold: improvements in daily file cleaning cron file
This commit is contained in:
parent
949a4c35df
commit
3b15ee14b7
@ -1,14 +1,23 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
[ -e /etc/sysconfig/autoport ] && . /etc/sysconfig/autoport
|
[ -e /etc/sysconfig/autoport ] && . /etc/sysconfig/autoport
|
||||||
|
|
||||||
|
RPMS_CTIME_OLD="+14"
|
||||||
|
BUILD_CTIME_OLD="+14"
|
||||||
|
SOURCES_CTIME_OLD="+60"
|
||||||
|
SRPMS_CTIME_OLD="+30"
|
||||||
|
TMP_CTIME_OLD="+2"
|
||||||
|
|
||||||
function clean() {
|
function clean() {
|
||||||
dir=$1
|
dir=$1
|
||||||
arch=$2
|
arch=$2
|
||||||
find $dir/RPM/RPMS/$arch/ -maxdepth 1 -ctime +21 -exec rm -rf {} \;
|
[ "$VERBOSE" ] && echo "Cleaning from base directory $dir..."
|
||||||
find $dir/RPM/RPMS/noarch/ -maxdepth 1 -ctime +21 -exec rm -rf {} \;
|
[ -e $dir/ ] && find $dir/ -maxdepth 1 -name "pipe\:\[*" -exec rm -f {} \;
|
||||||
find $dir/RPM/BUILD/ -maxdepth 1 -ctime +21 -exec rm -rf {} \;
|
[ -e $dir/RPM/SPECS/ ] && find $dir/RPM/SPECS/ -maxdepth 1 -type f -not -name "*.spec*" -exec rm -f {} \;
|
||||||
find $dir/RPM/SOURCES/ -maxdepth 1 -ctime +120 -a ! -name "*.patch" -exec rm -rf {} \;
|
[ -e $dir/RPM/RPMS/$arch/ ] && find $dir/RPM/RPMS/$arch/ -maxdepth 1 -ctime ${RPMS_CTIME_OLD} -exec rm -f {} \;
|
||||||
find $dir/RPM/SRPMS/ -maxdepth 1 -ctime +48 -exec rm -rf {} \;
|
[ -e $dir/RPM/RPMS/noarch/ ] && find $dir/RPM/RPMS/noarch/ -maxdepth 1 -ctime ${RPMS_CTIME_OLD} -exec rm -f {} \;
|
||||||
|
[ -e $dir/RPM/BUILD/ ] && find $dir/RPM/BUILD/ -maxdepth 1 -ctime ${BUILD_CTIME_OLD} -exec rm -rf {} \;
|
||||||
|
[ -e $dir/RPM/SOURCES/ ] && find $dir/RPM/SOURCES/ -maxdepth 1 -ctime ${SOURCES_CTIME_OLD} -a ! -name "*.patch" -exec rm -f {} \;
|
||||||
|
[ -e $dir/RPM/SRPMS/ ] && find $dir/RPM/SRPMS/ -maxdepth 1 -ctime ${SRPMS_CTIME_OLD} -exec rm -f {} \;
|
||||||
}
|
}
|
||||||
|
|
||||||
for i in `seq 0 ${#AUTOPORT_ARCH[*]}`; do
|
for i in `seq 0 ${#AUTOPORT_ARCH[*]}`; do
|
||||||
@ -18,16 +27,16 @@ for i in `seq 0 ${#AUTOPORT_ARCH[*]}`; do
|
|||||||
[ -e /var/autoport/$a/var/autodist/RPM/RPMS/$arch ] && \
|
[ -e /var/autoport/$a/var/autodist/RPM/RPMS/$arch ] && \
|
||||||
clean /var/autoport/$a/var/autodist ${AUTOPORT_ARCH[$i]}
|
clean /var/autoport/$a/var/autodist ${AUTOPORT_ARCH[$i]}
|
||||||
[ -e /var/autoport/$a/var/tmp/autodist ] && \
|
[ -e /var/autoport/$a/var/tmp/autodist ] && \
|
||||||
find /var/autoport/$a/var/tmp/autodist/ -maxdepth 1 -ctime +25 -exec rm -rf {} \;
|
find /var/autoport/$a/var/tmp/autodist/ -maxdepth 1 -ctime ${TMP_CTIME_OLD} -exec rm -rf {} \;
|
||||||
find /var/autoport/$a/tmp/ -maxdepth 1 -ctime +25 -exec rm -rf {} \;
|
find /var/autoport/$a/tmp/ -maxdepth 1 -ctime ${TMP_CTIME_OLD} -exec rm -rf {} \;
|
||||||
elif [ "${AUTOPORT_UPDATE[$i]}" ]; then
|
elif [ "${AUTOPORT_UPDATE[$i]}" ]; then
|
||||||
clean /var/autodist ${AUTOPORT_ARCH[$i]}
|
clean /var/autodist ${AUTOPORT_ARCH[$i]}
|
||||||
find /var/autodist-tmp/ -maxdepth 1 -ctime +25 -exec rm -rf {} \;
|
find /var/autodist-tmp/ -maxdepth 1 -ctime ${TMP_CTIME_OLD} -exec rm -rf {} \;
|
||||||
elif [ "${AUTOPORT_NATIVE[$i]}" -a "${AUTOPORT_CHROOT_USER[$i]}" ]; then
|
elif [ "${AUTOPORT_NATIVE[$i]}" -a "${AUTOPORT_CHROOT_USER[$i]}" ]; then
|
||||||
WORKINGHOME=`getent passwd ${AUTOPORT_CHROOT_USER[$i]} | cut -d: -f6`
|
WORKINGHOME=`getent passwd ${AUTOPORT_CHROOT_USER[$i]} | cut -d: -f6`
|
||||||
if [ -e $WORKINGHOME ]; then
|
if [ -e $WORKINGHOME ]; then
|
||||||
clean $WORKINGHOME ${AUTOPORT_ARCH[$i]}
|
clean $WORKINGHOME ${AUTOPORT_ARCH[$i]}
|
||||||
fi
|
fi
|
||||||
find /var/autodist-tmp/ -maxdepth 1 -ctime +25 -exec rm -rf {} \;
|
find /var/autodist-tmp/ -maxdepth 1 -ctime ${TMP_CTIME_OLD} -exec rm -rf {} \;
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
Loading…
Reference in New Issue
Block a user