Automated Backup Script Help (Linux)

From: Carlos Mennens <carlos(dot)mennens(at)gmail(dot)com>
To: "PostgreSQL (General)" <pgsql-general(at)postgresql(dot)org>
Subject: Automated Backup Script Help (Linux)
Date: 2012-03-07 18:33:51
Message-ID: CAAQLLO7iqwS5qeovRgS4fGgwxU+WCQCULiTUBtQ8f4QaTx2eWA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

I'm trying to get the automated backup scripts to work from:

http://wiki.postgresql.org/wiki/Automated_Backup_on_Linux

Currently I'm using PostgreSQL 9.1.3 and have the following three files:

carlos(at)db1:~/postgresql$ ls -l
total 20
drwxr-xr-x 2 carlos users 4096 Mar 7 13:13 backup
-rw-r--r-- 1 carlos users 1434 Mar 7 13:19 pg_backup.config
-rw-r--r-- 1 carlos users 4304 Mar 7 12:54 pg_backup_rotated.sh
-rw-r--r-- 1 carlos users 3379 Mar 7 12:54 pg_backup.sh

My Linux shell user 'carlos' has rwx to the entire directory as well
as the database role 'carlos' is listed as a REPLICATION role:

postgres=# \du
List of roles
Role name | Attributes
| Member of
-----------+----------------------------------------------------------------+-----------
carlos | Superuser, No inheritance, Create role, Create DB,
Replication | {it}

Now when I attempt to run the script for the 1st time, I get the
following error:

carlos(at)db1:~/postgresql$ pwd
/home/carlos/postgresql

carlos(at)db1:~/postgresql$ ls -l
total 20
drwxr-xr-x 2 carlos users 4096 Mar 7 13:13 backup
-rw-r--r-- 1 carlos users 1435 Mar 7 13:25 pg_backup.config
-rw-r--r-- 1 carlos users 4304 Mar 7 12:54 pg_backup_rotated.sh
-rw-r--r-- 1 carlos users 3379 Mar 7 12:54 pg_backup.sh

carlos(at)db1:~/postgresql$ sh pg_backup.sh
pg_backup.sh: 7: cd: can't cd to pg_backup.sh
pg_backup.sh: 8: pg_backup.sh: source: not found
pg_backup.sh: 16: [: !=: unexpected operator
Making backup directory in 2012-03-07/
pg_backup.sh: 54: pg_backup.sh: Bad substitution

So the only thing this script is doing for me is creating an empty
folder with the date as the name. Any idea what I'm doing wrong? I've
attached the configuration file since this is the only thing I was
told that needs to be modified. The contents are exactly as they are
on my server.

Attachment Content-Type Size
pg_backup.config application/octet-stream 1.4 KB

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Bill Moran 2012-03-07 18:47:46 Re: Advisory transaction lock for 128-bit space
Previous Message Matteo Sgalaberni 2012-03-07 18:22:43 Re: corrupted table postgresql 8.3