jablonka.czprosek.czf

hotsanic

Subversion Repositories:
[/] [trunk/] [clearall] - Rev 20 Go to most recent revision

Compare with Previous - Blame - Download


#!/usr/bin/env sh

. ./settings

if [ "$1" = "" ]; then
  echo "Usage:"
  echo "clearall <SINGLE OPTION>"
  echo ""
  echo "Options:"
  echo "  CLEAR_DATABASES"
  echo "    removes ALL .rrd database files!"
  echo "    CAUTION! ALL SAMPLED DATA WILL BE LOST!!!"
  echo ""
  echo "  CLEAR_WEBPAGE"
  echo "    removes all webgraphs"
  echo ""
  echo "  CLEAR_GRAPHS"
  echo "    removes temporary files for webgraphs"
  echo ""
  echo "  CLEAR_COUNTERS"
  echo "    removes temporary files used to build the databases"
  echo ""
  echo "  CLEAR_BINARIES"
  echo "    removes compiled perls and re-installs the original"
  echo "    scripts"
  echo ""
  echo "  CLEAR_EVERYTHING"
  echo "    does all of the things above"
  echo ""
  fi

if [ "$1" = "CLEAR_BINARIES" ]; then
  echo "This will slow down script-execution. Enter  yes  to continue"
  read nn
  if [ "$nn" = "yes" ]; then 
    for nn in ./modules/*; do
      rm -f $nn/read-data
      done
    fi
  fi

if [ "$1" = "CLEAR_DATABASES" ]; then
  echo "This will destroy all sampled data. Enter  yes  to continue"
  read nn
  if [ "$nn" = "yes" ]; then 
    rm -rf modules/*/rrd
    fi
  fi

if [ "$1" = "CLEAR_WEBPAGE" ]; then
  if [ -e $WEBDIR ]; then
    echo "This will destroy everything under $WEBDIR and therefore your web-graphs. Enter  yes  to continue"
    read nn
    if [ "$nn" = "yes" ]; then 
      cd $WEBDIR
      rm -f */*.html */*.gif */*.png *.html *.gif *.png convert
      rmdir *
      fi
    fi
  fi

if [ "$1" = "CLEAR_GRAPHS" ]; then
  rm -rf modules/*/*.gif modules/*/*.png modules/*/expires modules/*/idxdata modules/*/index index.html
  fi

if [ "$1" = "CLEAR_COUNTERS" ]; then
  rm -f */*/*.dat */*/*.old *.log
  fi

if [ "$1" = "CLEAR_EVERYTHING" ]; then
  echo "This will destroy all sampled data and delete all pre-compiled PERL-scripts and clear the webpage output. Enter  yes  to continue"
  read nn
  if [ "$nn" = "yes" ]; then 
    rm -rf modules/*/rrd
    fi
  for nn in ./modules/*; do
    rm -f $nn/read-data
    done
  rm -f nohup.out
  rm -rf modules/*/*.png modules/*/*.gif modules/*/expires modules/*/idxdata modules/*/index index.html
  rm -f */*/*.dat */*/*.old *.log
  cd $WEBDIR
  rm -f */*.html */*.gif */*.png *.html *.gif *.png convert
  rmdir *
  fi


Powered by WebSVN 2.2.1