[EMAIL PROTECTED] wrote:
I connected to my office LAN a postgresql server with the latest linux
gentoo.
By means of "crontab" each working day at 3am the following "crono" script
- backing up my complete DB and the /etc dir to a network share - is executed:
I would like instead to "enumerate" the two files (starting from monday
= 1, till friday=5)
in order to keep a week backup, such as for instance: curve.1.tar.gz ,
curve.2.tar.gz,
.. curve.5. tar.gz and the same for etc
How can I obtain this result with crontab?
Here is my db backup script. It's for mysql, but the idea is the same.
kashani
#!/bin/bash
set -x
HOST=`hostname --fqdn`
LDIR="/var/sqlbackups"
MLOGIN="user"
MPASS="pass"
RHOST="backupserver.domain.com"
RDIR="/var/sqlbackups/$HOST"
RUSER="root"
RKEY="/root/.ssh/dumps"
DATE=`date +"%Y%m%d"`
OLDDATE=`date --date='6 days ago' +"%Y%m%d"`
DUMP="/usr/bin/mysqldump"
GZIP="/bin/gzip"
SCP="/usr/bin/scp"
SSH="/usr/bin/ssh"
cd $LDIR
$DUMP -u$MLOGIN -p$MPASS --all-databases > $HOST-mysql-fulldump-$DATE
$GZIP -9 $HOST-mysql-fulldump-$DATE
$SCP -q -i $RKEY $HOST-mysql-fulldump-$DATE.gz [EMAIL PROTECTED]:$RDIR
# delete old backups
$SSH -i $RKEY -l $RUSER $RHOST rm $RDIR/$HOST-mysql-fulldump-$OLDDATE.gz
rm -rf $HOST-mysql-fulldump-$OLDDATE.gz
--
[email protected] mailing list