Re: [SQL] a script that queries database periodically

Поиск
Список
Период
Сортировка
От Peter Eisentraut
Тема Re: [SQL] a script that queries database periodically
Дата
Msg-id Pine.LNX.4.21.0011272323020.832-100000@peter.localdomain
обсуждение исходный текст
Список pgsql-general
Bernie Huang writes:

> My boss wants me to write a script that will send a email report to him
> monthly with the result of database queries.

> I guess a shell script is necessary.  So, is it possible to call
> 'psql' and returning its query result and I can use sendmail to email
> the result? Any other idea?

Conceptually, what you want is something like this:

#! /bin/sh

(
  echo "Here's your report:"
  psql -c 'SELECT ...'
) | mail -s Subject foo@bar

Reading man pages on each of these is advisable.

--
Peter Eisentraut      peter_e@gmx.net       http://yi.org/peter-e/


В списке pgsql-general по дате отправления:

Предыдущее
От: "Poul L. Christiansen"
Дата:
Сообщение: Re: [SQL] a script that queries database periodically
Следующее
От: Partyka Robert
Дата:
Сообщение: one ask