HCoop
/
clinton
/
scripts.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
s3.common: Get rid of third argument to move_over.
[clinton/scripts.git]
/
s3.common
diff --git
a/s3.common
b/s3.common
index
09d1e77
..
87338c6
100644
(file)
--- a/
s3.common
+++ b/
s3.common
@@
-7,7
+7,6
@@
CHUNKSIZE=5000
BUCKET=hcoop.net-backups
BACKUPDIR=full
BUCKET=hcoop.net-backups
BACKUPDIR=full
-SUBDIR=$(date +%Y.%m.%d)
S3CMD=$(dirname $0)/s3
IFS=$'\n'
S3CMD=$(dirname $0)/s3
IFS=$'\n'
@@
-33,19
+32,18
@@
function s3_cmd () {
function move_over () {
# Move file to its offsite destination.
# Expects the file to come from STDIN.
function move_over () {
# Move file to its offsite destination.
# Expects the file to come from STDIN.
- # $1: filename, $2: relative directory (optional)
- if test -z "$1" || test -n "$3"; then
+ # $1: date subdirectory
+ # $2: filename
+ if test -z "$2" || test -n "$3"; then
echo "Bad programming"
exit 1
fi
echo "Bad programming"
exit 1
fi
- local FILE=$1
- local DEST=$BACKUPDIR/$SUBDIR
- if test -n "$2"; then
- DEST=$DEST/$2
- fi
- split -d -b ${CHUNKSIZE}m - ${FILE}.
- for i in ${FILE}.*; do
- s3_cmd put $DEST/$i $i
+ local subdir=$1
+ local file=$2
+ local dest=$BACKUPDIR/$subdir
+ split -d -b ${CHUNKSIZE}m - ${file}.
+ for i in ${file}.*; do
+ s3_cmd put $dest/$i $i
rm -f $i
done
}
rm -f $i
done
}
@@
-53,6
+51,7
@@
function move_over () {
function prune_old_backups () {
# Implement me
function prune_old_backups () {
# Implement me
+ local subdir=$1
local oldpwd=$PWD
cd $BACKUPDIR
find . -mindepth 1 -maxdepth 1 -type d -ctime +7 \
local oldpwd=$PWD
cd $BACKUPDIR
find . -mindepth 1 -maxdepth 1 -type d -ctime +7 \