omega8cc / boa

Barracuda Octopus Aegir 5.4.0
https://omega8.cc/compare
394 stars 75 forks source link

Compress codebases-cleanup and empty platform #365

Open pricejn2 opened 10 years ago

pricejn2 commented 10 years ago

Something like this do the trick for shared_codebases_cleanup ().

shared_codebases_cleanup () {
  if [ -L "/data/all" ] ; then
    _CLD="/data/disk/codebases-cleanup"
  else
    _CLD="/var/backups/codebases-cleanup"
  fi
  REVISIONS="001 002 003 004 005 006 007 008 009 010 011 012 013 014 015 016 017 018 019 020 021 022 023 024 025 026 027 028 029 030 031 032 033 034 035 036 037 038 039 040 041 042 043 044 045 046 047 048 049 050"
  for i in $REVISIONS; do
    if [ -d "/data/all/$i/o_contrib" ] ; then
      for Codebase in `find /data/all/$i/* -maxdepth 1 -mindepth 1 -type d | grep "/profiles$" 2>&1`; do
        CodebaseDir=$(echo $Codebase | sed 's/\/profiles//g'| awk '{print $1}' 2> /dev/null)
        CodebaseTest=$(find /data/disk/*/distro/*/*/ -maxdepth 1 -mindepth 1 -type l -lname $Codebase | sort 2>&1)
        CodebaseName=$(echo ${CodebaseDir##*/})
        if [[ "$CodebaseTest" =~ "No such file or directory" ]] || [ -z "$CodebaseTest" ] ; then
          mkdir -p ${_CLD}/$i
          echo Moving no longer used $CodebaseDir to ${_CLD}/$i/
          mv -f $CodebaseDir ${_CLD}/$i/
          tar -pczf ${_CLD}/$i/$Codebase.tar.gz ${_CLD}/$i/$CodebaseName
          rm -rf ${_CLD}/$i/$CodebaseName
          sleep 1
        fi
      done
    fi
  done
}

Patch worthy?

omega8cc commented 10 years ago

We may consider this in the future. For now we prefer to simply move legacy stuff around, so it is easy to move it back in case there will be some edge case causing cleanup for platform and site with some unexpected or missing directory structure - it did happen to us twice because of this problem: https://github.com/omega8cc/boa/commit/2990f7108ec009d04303d3124d4fa4687ca80141

omega8cc commented 10 years ago

However, feel free to propose a patch!