3 # we're getting called by cron, so just in case
4 PATH=/bin:/usr/bin:$PATH
7 COMMANDDIR=$(dirname $0)
8 COMMANDDIR=$(cd $COMMANDDIR; pwd -P)
10 DATE=$(date +%y-%m-%d-%H-%M-%S)
12 LOGDIR=$DATADIR/aa-dumplog
13 LOG=$LOGDIR/${DATE}.log
18 source $COMMANDDIR/functions.sh
23 *build*|*kruder*|*blitz*)
24 DEFAULTS="subversion" ;;
26 DEFAULTS="planetlab4" ;;
28 echo "$COMMAND: WARNING: no known defaults for hostname $(hostname)"
40 echo "This is $COMMAND, $REVISION"
41 echo "Usage: $COMMAND [subversion]"
42 echo -e "\tkeyword 'subversion' : $SUBVERSION_REPO/ is dumped"
43 # echo -e "\tkeyword 'apache' : $APACHE_ROOT/ is tared"
44 # echo -e "\tkeyword 'env' : $ENV_ROOT/ is tared"
45 # echo -e "\totherwise performs a dump of the given database"
46 echo -e "default arguments are $DEFAULTS"
52 output=$DATADIR/$database-$DATE.sql
53 latest=$database-latest.sql
54 echo "Dumping $database into $output (drop-mode)"
55 pg_dump --user=$DB_USER $database > $output
56 manage_link $output $latest
59 function dumpsubversion () {
60 output=$DATADIR/subversion-$DATE.svndump
61 latest=subversion-latest.svndump
62 echo "Creating subversion archive in $output"
63 svnadmin dump $SUBVERSION_REPO/ > $output
64 manage_link $output $latest
67 function dumpregulardir () {
70 output=$DATADIR/$name-$DATE.tar
71 latest=$name-latest.tar
72 echo "Creating tar archive of $dumpdir into $output"
73 tar cf $output $dumpdir
74 manage_link $output $latest
79 # give one or more target names on the command-line
81 if [[ -z "$@" ]] ; then
87 [ -n "$DEBUG" ] && set -x
95 clean $DATADIR $SUBVERSION_KEEPTIME -name "$arg\*"
98 # dumpregulardir $arg $APACHE_ROOT
99 # clean $DATADIR $APACHE_KEEPTIME -name "$arg\*"
102 # dumpregulardir $arg $ENV_ROOT
103 # clean $DATADIR $ENV_KEEPTIME -name "$arg\*"
107 clean $DATADIR $DB_KEEPTIME -name "$arg\*"
114 manage_link $LOG $LATESTLOG
117 ##############################
129 main "$@" > $LOG 2>&1