forked from ISTI-ansible-roles/ansible-roles
crontab postgres dump log enhanced
This commit is contained in:
parent
b4a9e1e582
commit
e07f621b4c
|
@ -13,7 +13,8 @@ fi
|
|||
|
||||
# Remote backup performed by duplicity. When active, do not run via cron
|
||||
if [ -x /etc/cron.daily/duplicity_backup ] ; then
|
||||
echo "duplicity backups active. Exiting" > $LOG_FILE
|
||||
DATE=$( date )
|
||||
echo "$DATE: duplicity backups active. Exiting" >> $LOG_FILE
|
||||
exit 0
|
||||
fi
|
||||
|
||||
|
@ -23,7 +24,8 @@ if [ -f /var/log/backuppc.log ] ; then
|
|||
. /var/log/backuppc.log
|
||||
LAST_BACKUP_TIME=$( expr $TMSTMP - $BACKUP_TIMESTAMP )
|
||||
if [ $LAST_BACKUP_TIME -lt 86400 -a $BACKUP_RESULT == 'OK' ] ; then
|
||||
echo "BackupPC is active, doing nothing" > $LOG_FILE
|
||||
DATE=$( date )
|
||||
echo "$DATE: BackupPC is active, doing nothing" >> $LOG_FILE
|
||||
exit 0
|
||||
fi
|
||||
fi
|
||||
|
@ -34,20 +36,22 @@ PG_RUNNING=$?
|
|||
|
||||
if [ $PG_BACKUP_ENABLED == 'True' ] ; then
|
||||
if [ "$PG_RUNNING" -ne "0" -a "$PG_RUNNING" -ne "3" ] ; then
|
||||
echo "The postgresql service is not running" > $LOG_FILE
|
||||
DATE=$( date )
|
||||
echo "$DATE: The postgresql service is not running" >> $LOG_FILE
|
||||
exit 1
|
||||
else
|
||||
if [ ! -d $LOG_DIR ] ; then
|
||||
mkdir -p $LOG_DIR
|
||||
fi
|
||||
DATE_START=$( date )
|
||||
echo "$DATE_START: Starting the backup procedure" > $LOG_FILE
|
||||
echo "$DATE_START: Starting the backup procedure" >> $LOG_FILE
|
||||
$PG_BCK_BIN >> $LOG_FILE 2>&1
|
||||
DATE_END=$( date )
|
||||
echo "$DATE_END: Backup procedure finished" >> $LOG_FILE
|
||||
fi
|
||||
else
|
||||
echo "Postgresql backups administratively disabled" > $LOG_FILE
|
||||
DATE=$( date )
|
||||
echo "$DATE: Postgresql backups administratively disabled" >> $LOG_FILE
|
||||
fi
|
||||
|
||||
if [ "${USE_NAGIOS}" == "yes" ] ; then
|
||||
|
|
Loading…
Reference in New Issue