Re: Shell Script help for backup

From: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
To: ratlhead <ratlhead(at)ratlhead(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Shell Script help for backup
Date: 2002-07-29 03:22:22
Message-ID: 200207290322.g6T3MMa27411@candle.pha.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general


You can do 'zcat < file' to prevent the *.Z requirement. Yes, head -n
should work fine.

---------------------------------------------------------------------------

ratlhead wrote:
> strange(at)nsk(dot)yi(dot)org wrote in message news:<20020723150902(dot)A5173(at)nsk(dot)yi(dot)org>...
> > What's wrong with the solution I sent?
> >
> > And I doubt the checking for a 0k file will work for you as gzip will
> > create a 20 byte file even for a 0 byte input (some headers, etc.).
> >
> > Regards,
> > Luciano Rocha
>
> Luciano,
>
> Was wondering if you could provide some help with the solution you
> sent...
>
> [ "$( zcat /folder/pg_backup.$DATE.gzip | head -c1 | wc -c )" -eq 1 ]
>
> First, I can't seem to use zcat, because it likes to add on a ".Z" to
> the filename for some reason or another. Also, I find with the
> version of 'head' installed on my machine, that -c isn't available,
> but instead, -n. I tried changing that and zcat to cat, but was
> getting a fail on something that should be valid.
>
> This basically checks to see if the file contains data right?
>
> Thanks man!
>
> ---------------------------(end of broadcast)---------------------------
> TIP 6: Have you searched our list archives?
>
> http://archives.postgresql.org
>

--
Bruce Momjian | http://candle.pha.pa.us
pgman(at)candle(dot)pha(dot)pa(dot)us | (610) 853-3000
+ If your life is a hard drive, | 830 Blythe Avenue
+ Christ can be your backup. | Drexel Hill, Pennsylvania 19026

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Bruce Momjian 2002-07-29 03:25:50 Re: Is this query possible in PostgreSQL ?
Previous Message Alex Cheung Tin Ka 2002-07-29 02:51:44 Fw: questions in query on 7.1 and 7.2