LOG=$LOGDIR/${DATE}.log
LATESTLOG=latest.log
-REVISION="$Revision$"
-
-source $COMMANDDIR/functions.sh
+### create a symlink in same dir
+# arguments
+# actual : full path of the actual file
+# link : the link name, only basename is used, will be created in same dir
+function manage_link () {
+ actual=$1; shift
+ latest=$1; shift
+ # go in the right directory
+ cd $(dirname $actual)
+ actualbase=$(basename $actual)
+ # just in case
+ latest=$(basename $latest)
+ echo "In $(pwd) : linking $actualbase to $latest"
+ rm -f $latest ; ln -s $actualbase $latest
+ # go back to current dir
+ cd -
+}
+
+# usage
+# clean <where> <keeptime> [... find arguments]
+function clean () {
+ where=$1; shift
+ keeptime=$1; shift
+ echo "== In $where"
+ echo "Cleaning $@ - older than $keeptime days"
+ find $where "$@" -atime +$keeptime | xargs rm
+}
###
case $(hostname) in
- *build*)
+ *build*|*kruder*|*blitz*)
DEFAULTS="subversion" ;;
*plc*|*private*)
DEFAULTS="planetlab4" ;;
SUBVERSION_REPO=/svn
function usage () {
- echo "This is $COMMAND, $REVISION"
+ echo "This is $COMMAND"
echo "Usage: $COMMAND [subversion]"
echo -e "\tkeyword 'subversion' : $SUBVERSION_REPO/ is dumped"
# echo -e "\tkeyword 'apache' : $APACHE_ROOT/ is tared"
output=$DATADIR/$database-$DATE.sql
latest=$database-latest.sql
echo "Dumping $database into $output (drop-mode)"
- mysqldump --add-drop-table --user=$DB_USER $database > $output
+ pg_dump --user=$DB_USER $database > $output
manage_link $output $latest
}