1 |
On 2013-05-05 2:18 PM, Neil Bothwick <neil@××××××××××.uk> wrote:> On |
2 |
Sun, 05 May 2013 14:07:50 -0400, Tanstaafl wrote: |
3 |
>> /home/user/mypg_backups/2013/May/Sun/pg_all-13:54.gz: No such file or |
4 |
>> directory |
5 |
>> |
6 |
>> So, it is expanding the variables properly, but apparently won't |
7 |
>> automatically create the directories? Is there some kind of flag |
8 |
>> I can add to the command to do that? |
9 |
|
10 |
> mkdir -p $BACKUP_DIR/$PGyy/$PGmm/$PGdd/ |
11 |
|
12 |
Thanks Neill... |
13 |
|
14 |
Tried changing the command in the script to: |
15 |
|
16 |
> /usr/bin/pg_dumpall -U $PGUSER -o | gzip > mkdir -p $BACKUP_DIR/$PGyy/$PGmm/$PGdd/pg_all-$PGtt.gz |
17 |
|
18 |
and got this error: |
19 |
|
20 |
# ./ecat_pgdump.sh |
21 |
gzip: invalid option -- 'p' |
22 |
|
23 |
Tried putting quotes around it like this: |
24 |
|
25 |
> /usr/bin/pg_dumpall -U $PGUSER -o | gzip > "mkdir -p $BACKUP_DIR/$PGyy/$PGmm/$PGdd/pg_all-$PGtt.gz" |
26 |
|
27 |
and got the original error with the added 'mkdir -p': |
28 |
|
29 |
# ./mypg_pgdumpall.sh |
30 |
./mypg_pgdumpall.sh: line 10: mkdir -p |
31 |
/home/user/mypg_backups/2013/May/Sun/ecat-14:26.gz: No such file or |
32 |
directory |
33 |
|
34 |
I'm guessing I just need to know where to put the quotes? |