Code indexing in gitaly is broken and leads to code not being visible to the user. We work on the issue with highest priority.

Skip to content
Snippets Groups Projects
Commit acb3ed2a authored by loktionova_n's avatar loktionova_n
Browse files

PG backup

parent b40a7e3c
No related branches found
No related tags found
No related merge requests found
#!/bin/bash
mail_to="nina.loktionova@psi.ch "
# mail_to="cms-tier3@lists.psi.ch"
backup_dir="/pg-backup"
# backup_dir="/var/lib/pgsql/11/backups"
backup_file="pg_`date +\%Y-\%m-\%d`.sql.gz"
log_file=" /var/log/PG-backup-`date +\%Y-\%m-\%d`"
#Logging all the output to a LogFile:
exec 1> $log_file 2>&1
function send_warning_and_exit()
{
cat <<EOF | /usr/sbin/sendmail -t
To: $mail_to
Subject: PG backup TROUBLE on `hostname`
echo $1
`date`
EOF
echo "***** PG backup FAILURE ***** "
`date`
exit 1
}
if [ ! -d $backup_dir ]
then
send_warning_and_exit "$backup_dir dosen't exist"
fi
if [ -s $backup_dir/$backup_file ]
then
send_warning_and_exit "$backup_file exists"
fi
echo "start PGDB dump" `date`
pg_dumpall -U postgres|gzip > $backup_dir/$backup_file
echo "end PGDB dump" `date`
# cleaning old:
find $backup_dir -type f -name '*.gz' -mtime +2 -exec rm {} \;
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment