469,272 Members | 1,459 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,272 developers. It's quick & easy.

Suppress output from psql?

Is there a way 'within' psql to suppress output?

One of our cron scripts calls a sql file which contains various database
commands (ALTER TABLEs, UPDATEs, etc) and various user-defined functions.
So within this sql file there are various SELECT * FROM myFunction(); which
sends output to the user from cron. I can't see anyway to suppress this from
the psql docs and I don't believe that I can suppress it from cron
either (I'll do
some more checking there).

Thanks
Ron
---------------------------(end of broadcast)---------------------------
TIP 6: Have you searched our list archives?

http://archives.postgresql.org

Nov 23 '05 #1
6 6017
Ron St-Pierre <rs*******@syscor.com> writes:
Is there a way 'within' psql to suppress output?

One of our cron scripts calls a sql file which contains various database
commands (ALTER TABLEs, UPDATEs, etc) and various user-defined functions.
So within this sql file there are various SELECT * FROM myFunction(); which
sends output to the user from cron. I can't see anyway to suppress this from
the psql docs and I don't believe that I can suppress it from cron
either (I'll do
some more checking there).


How about putting ">/dev/null 2>&1" after the command line in your crontab?

Or redirect it to a file if you think you might need it...

-Doug
--
Let us cross over the river, and rest under the shade of the trees.
--T. J. Jackson, 1863

---------------------------(end of broadcast)---------------------------
TIP 6: Have you searched our list archives?

http://archives.postgresql.org

Nov 23 '05 #2
Ron St-Pierre <rs*******@syscor.com> writes:
Is there a way 'within' psql to suppress output?


Perhaps "\o /dev/null" ?

regards, tom lane

---------------------------(end of broadcast)---------------------------
TIP 6: Have you searched our list archives?

http://archives.postgresql.org

Nov 23 '05 #3
You could redirect the output from your cron initiated script with:
/dev/null 2>&1
Is there a way 'within' psql to suppress output?

One of our cron scripts calls a sql file which contains various
database
commands (ALTER TABLEs, UPDATEs, etc) and various user-defined
functions.
So within this sql file there are various SELECT * FROM myFunction();
which
sends output to the user from cron. I can't see anyway to suppress
this from
the psql docs and I don't believe that I can suppress it from cron
either (I'll do
some more checking there).

Thanks
Ron
---------------------------(end of
broadcast)---------------------------
TIP 6: Have you searched our list archives?

http://archives.postgresql.org

---------------------------(end of broadcast)---------------------------
TIP 3: if posting/reading through Usenet, please send an appropriate
subscribe-nomail command to ma*******@postgresql.org so that your
message can get through to the mailing list cleanly

Nov 23 '05 #4
On Tue, Aug 31, 2004 at 09:00:24PM -0400, Doug McNaught wrote:
Ron St-Pierre <rs*******@syscor.com> writes:
Is there a way 'within' psql to suppress output?

One of our cron scripts calls a sql file which contains various database
commands (ALTER TABLEs, UPDATEs, etc) and various user-defined functions.
So within this sql file there are various SELECT * FROM myFunction(); which
sends output to the user from cron. I can't see anyway to suppress this from
the psql docs and I don't believe that I can suppress it from cron
either (I'll do
some more checking there).
How about putting ">/dev/null 2>&1" after the command line in your crontab?


This is a bad idea if the command fails ...
Or redirect it to a file if you think you might need it...


Yeah, redirect it to a temp file (use mktemp) and

if [ $? == 0 ]; then
delete the file
else
cat the file
fi

--
Alvaro Herrera (<alvherre[a]dcc.uchile.cl>)
"El Maquinismo fue proscrito so pena de cosquilleo hasta la muerte"
(Ijon Tichy en Viajes, Stanislaw Lem)
---------------------------(end of broadcast)---------------------------
TIP 7: don't forget to increase your free space map settings

Nov 23 '05 #5
Checkout http://www.hentzenwerke.com/wp/cron_explained.pdf

Look for the MAILTO="" command which you can use to suppress the mailing
of cron job output.

And try redirecting std output to /dev/null, and/or send the output from
psql to a file.

John Sidney-Woollett

Ron St-Pierre wrote:
Is there a way 'within' psql to suppress output?

One of our cron scripts calls a sql file which contains various database
commands (ALTER TABLEs, UPDATEs, etc) and various user-defined functions.
So within this sql file there are various SELECT * FROM myFunction(); which
sends output to the user from cron. I can't see anyway to suppress this
from
the psql docs and I don't believe that I can suppress it from cron
either (I'll do
some more checking there).

Thanks
Ron
---------------------------(end of broadcast)---------------------------
TIP 6: Have you searched our list archives?

http://archives.postgresql.org


---------------------------(end of broadcast)---------------------------
TIP 7: don't forget to increase your free space map settings

Nov 23 '05 #6
Ron St-Pierre wrote:
Is there a way 'within' psql to suppress output?

One of our cron scripts calls a sql file which contains various database
commands (ALTER TABLEs, UPDATEs, etc) and various user-defined functions.
So within this sql file there are various SELECT * FROM myFunction();
which
sends output to the user from cron. I can't see anyway to suppress
this from
the psql docs and I don't believe that I can suppress it from cron
either (I'll do
some more checking there).


Tom, that looks like exactly what I need, I'll try it. Doug, Scott,
Alvaro, John, I don't want to send the entire output
of my cron script to /dev/null, just the parts inside of my misc.sql
file (which cron calls) where I call my own functions,
eg SELECT * FROM myFunction();

Also. I will check out the MAILTO="" which will be helpful for some of
my other cron scripts. Thanks John.

Ron
---------------------------(end of broadcast)---------------------------
TIP 6: Have you searched our list archives?

http://archives.postgresql.org

Nov 23 '05 #7

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

15 posts views Thread by Daniel Schuchardt | last post: by
3 posts views Thread by Philipp Staempfli | last post: by
3 posts views Thread by Russ Schneider | last post: by
1 post views Thread by Ron St-Pierre | last post: by
1 post views Thread by Vinay Jain | last post: by
1 post views Thread by Josué Maldonado | last post: by
6 posts views Thread by Jerome Lyles | last post: by
1 post views Thread by rn5a | last post: by
14 posts views Thread by fdu.xiaojf | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.