git://git.onelab.eu
/
infrastructure.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
debian builds on warhol
[infrastructure.git]
/
scripts
/
ple-backup-cleanup.cron
diff --git
a/scripts/ple-backup-cleanup.cron
b/scripts/ple-backup-cleanup.cron
index
fd4fab6
..
bb7a89f
100755
(executable)
--- a/
scripts/ple-backup-cleanup.cron
+++ b/
scripts/ple-backup-cleanup.cron
@@
-37,6
+37,8
@@
function backup_db {
# $3: Date
function backup_all_dbs {
for i in $(psql -qtAF '|' -U postgres -l 2> /dev/null) ; do
# $3: Date
function backup_all_dbs {
for i in $(psql -qtAF '|' -U postgres -l 2> /dev/null) ; do
+ NF=$(echo $i | awk -F '|' '{print NF}')
+ if [ $NF -ne 6 ]; then continue; fi
DBNAME=$(echo $i | cut -d '|' -f 1)
DBUSER=$(echo $i | cut -d '|' -f 2)
case $DBNAME in
DBNAME=$(echo $i | cut -d '|' -f 1)
DBUSER=$(echo $i | cut -d '|' -f 2)
case $DBNAME in
@@
-83,6
+85,9
@@
BACKUP_DIR=/db-backup
# save all databases, either postgresql (currently on www) or ejabberd (currently on boot)
function backup () {
# save all databases, either postgresql (currently on www) or ejabberd (currently on boot)
function backup () {
+ echo "backup script on $HOST"
+ echo "Please do not change this script directly, use git and related makefile at"
+ echo "but http://git.onelab.eu/?p=infrastructure.git;a=blob;f=scripts/ple-backup-cleanup.cron"
# postgresql
ps -C postmaster >& /dev/null && backup_all_dbs $BACKUP_DIR $HOST $DATE \
|| echo "No postgresql database to backup on $HOST"
# postgresql
ps -C postmaster >& /dev/null && backup_all_dbs $BACKUP_DIR $HOST $DATE \
|| echo "No postgresql database to backup on $HOST"
@@
-94,6
+99,9
@@
function backup () {
# trash old files in $BACKUP_DIR
# formerly in /etc/cron.weekly/clean-backup.sh
function cleanup () {
# trash old files in $BACKUP_DIR
# formerly in /etc/cron.weekly/clean-backup.sh
function cleanup () {
+ echo "cleanup script on $HOST"
+ echo "Please do not change this script directly, use git and related makefile at"
+ echo "but http://git.onelab.eu/?p=infrastructure.git;a=blob;f=scripts/ple-backup-cleanup.cron"
DATE=$(date +%s)
ONE_WEEK=$((7*24*60*6))
DATE_OLD=$(($DATE - $ONE_WEEK))
DATE=$(date +%s)
ONE_WEEK=$((7*24*60*6))
DATE_OLD=$(($DATE - $ONE_WEEK))