Skip to content

Instantly share code, notes, and snippets.

@D4R4
Last active February 25, 2019 07:59
Show Gist options
  • Save D4R4/8f3b9747c7f313236494318441fa808f to your computer and use it in GitHub Desktop.
Save D4R4/8f3b9747c7f313236494318441fa808f to your computer and use it in GitHub Desktop.
postgres db for IBSng
#!/bin/bash
su postgres -c "pg_dump IBSng" > IBSng_"`date +%Y-%m-%d`".sql
#tar czf IBSng_"`date +%Y-%m-%d`".tar.gz IBSng_"`date+%Y-%m-%d`".sql
DELDATE=$(date -d "-31 days" +"%Y-%m-%d")
HOST=aaaa
USER=ssss
PASS=zzzzz
ftp -inv $HOST << EOF
user $USER $PASS
cd ibsng-backups
put IBSng_"`date +%Y-%m-%d`".sql
mdel IBSng_$DELDATE.sql
bye
EOF
DELDATE2=`date -d "-7 days" +"%Y-%m-%d"`
rm IBSng_$DELDATE2.sql
#rm IBSng_"`date +%Y-%m-%d`".tar.gz
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment