Results 1 to 2 of 2
  1. #1
    Join Date
    Nov 2008

    Unanswered: Taking a base backup

    Hi All,

    I am trying to take a very simple base backup on CentOS

    My sh file looks like:

    tar -czf /home/liadmin/db_backups/db_back_`date +%Y.%m.%d.%H.%M.%S` /var/lib/pgsql/data/

    My command and error below:

    sh line 3: syntax error near unexpected token `tar' line 3: `tar -czf /home/liadmin/db_backups/db_back_`date +%Y.%m.%d.%H.%M.%S` /var/lib/pgsql/data/'

    Thanks in advance for any help. I have seen a lot of fancy scripts out there, but I am really trying to keep it as simple as the above.

  2. #2
    Join Date
    Nov 2008
    So this ended up working.

    psql --host localhost --username postgres -c "SELECT pg_start_backup('backup');"
    tar czf /home/liadmin/db_backups/db_back_`date +%Y.%m.%d.%H.%M.%S`.tar.gz /var/lib/pgsql/data/
    psql --host localhost --username postgres -c "SELECT pg_stop_backup();"

    I also had to add a file .pgpass to the home directory I am running the script from.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts