Created
August 8, 2014 09:31
-
-
Save cschell/84a8842ea56855484827 to your computer and use it in GitHub Desktop.
Backup gziped postgresql dump to a ftp server
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# shell command: | |
pg_dump <db_name> -U <db_user> -h <db_host> | gzip | curl -u <ftp_user>:<ftp_password> ftp://<ftp_host>/`date '+%Y-%m-%d_%H-%M'`/db_backup.sql.gz --ftp-create-dirs -T - | |
# if you want to execute it through cron, be sure to escape all %! | |
# for crontab: | |
pg_dump <db_name> -U <db_user> -h <db_host> | gzip | curl -u <ftp_user>:<ftp_password> ftp://<ftp_host>/`date '+\%Y-\%m-\%d_\%H-\%M'`/db_backup.sql.gz --ftp-create-dirs -T - |
Como coloca data no nome do arquivo?
How do you put date in the file name?
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
See https://gist.github.com/cschell/086867e61d87ec6a2bf4 to delete old backups