<commit_before><commit_msg>merging development with db backup script<commit_after>#!/bin/bash

# http://serverfault.com/questions/59838/whats-the-best-way-to-automate-backing-up-of-postgresql-databases

BACKUPDIR=/var/lib/postgresql/sql_backups/
DATE=`date +%Y-%m-%dT%H:%M:%S`
DB=polio
USER=djangoapp

DUMPALL="/usr/bin/pg_dumpall"
PGDUMP="/usr/bin/pg_dump"
PSQL="/usr/bin/psql"

echo Backing up $DB database to $BACKUPDIR$DATE-$DB.sql.gz ...

pg_dump --verbose --format=t -f "$BACKUPDIR$DATE.sql" $DB -U $USER

echo back up complete... zipping file

gzip "$BACKUPDIR$DATE.sql"

# delete backup files older than 10 days
OLD=$(find $BACKUPDIR -type d -mtime +10)
if [ -n "$OLD" ] ; then

        echo deleting old backup files: $OLD
        echo $OLD | xargs rm -rfv
fi

{'fraction_non_alphanumeric': 0.15734720416124837, 'fraction_numerical': 0.011703511053315995, 'mean_word_length': 3.967741935483871, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1824755', 'n_tokens_mistral': 307, 'n_tokens_neox': 297, 'n_words': 67}