Newbie question

Started by Hugoalmost 21 years ago8 messagesgeneral
Jump to latest
#1Hugo
htakada@gmail.com

hi,

is it possible to schedule the execution of an sql stored procedure in
postgress on linux?

thanks

Hugo

#2Vlad
marchenko@gmail.com
In reply to: Hugo (#1)
Re: Newbie question

IMHO cron would be the best for that...

is it possible to schedule the execution of an sql stored procedure in
postgress on linux?

--
Vlad

#3Dann Corbit
DCorbit@connx.com
In reply to: Vlad (#2)
Re: Newbie question

Sure. Just set up psql with a SQL script containing your task using a
chron job.

The psql utility will accept a command file as a parameter.

PostgreSQL has functions rather than stored procedures, but it works out
about the same.

You could also put a bunch of SQL commands that you want to run in the
file that you feed to psql.

-----Original Message-----
From: pgsql-general-owner@postgresql.org [mailto:pgsql-general-
owner@postgresql.org] On Behalf Of Hugo
Sent: Wednesday, May 18, 2005 8:24 AM
To: pgsql-general@postgresql.org
Subject: [GENERAL] Newbie question

hi,

is it possible to schedule the execution of an sql stored procedure in
postgress on linux?

thanks

Hugo

---------------------------(end of

broadcast)---------------------------

Show quoted text

TIP 8: explain analyze is your friend

#4Csaba Nagy
nagy@ecircle-ag.com
In reply to: Hugo (#1)
Re: Newbie question

Dear Hugo,

It is possible using cron and psql. Just "man cron" on unix if you're
not already familiar with that. The command line you should use is
something like:

psql [connection options] -f sql_commands_file.sql

Also "man psql" for the options you can use...
Starting the procedure should be done by something like:

SELECT procedure_name();

in the sql commands file given to psql.
Alternatively you can do:

echo "SELECT procedure_name();" | psql [connection options]

but I don't know how well that works with cron... I'm not actually using
it...

HTH,
Csaba.

Show quoted text

On Wed, 2005-05-18 at 17:23, Hugo wrote:

hi,

is it possible to schedule the execution of an sql stored procedure in
postgress on linux?

thanks

Hugo

---------------------------(end of broadcast)---------------------------
TIP 8: explain analyze is your friend

#5Bricklen Anderson
banderson@presinet.com
In reply to: Hugo (#1)
Re: Newbie question

Hugo wrote:

hi,

is it possible to schedule the execution of an sql stored procedure in
postgress on linux?

thanks

Hugo

cron job:
eg. Sat 2:30am

30 2 * * Sat psql -d dbname -c "select your_func()"

--
_______________________________

This e-mail may be privileged and/or confidential, and the sender does
not waive any related rights and obligations. Any distribution, use or
copying of this e-mail or the information it contains by other than an
intended recipient is unauthorized. If you received this e-mail in
error, please advise me (by return e-mail or otherwise) immediately.
_______________________________

#6Hugo
htakada@gmail.com
In reply to: Hugo (#1)
Re: Newbie question

thanks all for your help, I'll try your suggestions

regards

Hugo

2005/5/18, Kaloyan Iliev Iliev <news1@faith.digsys.bg>:

Show quoted text

Hi Hugo,

Yes, it is possible. Just write an outer perl script(in example), which
to call this stored procedure. Then put in the cron to call whis perl
script. As Far As I Know there isn't other way.

Kaloyan Iliev

Hugo wrote:

hi,

is it possible to schedule the execution of an sql stored procedure in
postgress on linux?

thanks

Hugo

---------------------------(end of broadcast)---------------------------
TIP 8: explain analyze is your friend

#7Kaloyan Iliev Iliev
news1@faith.digsys.bg
In reply to: Hugo (#1)
Re: Newbie question

Hi Hugo,

Yes, it is possible. Just write an outer perl script(in example), which
to call this stored procedure. Then put in the cron to call whis perl
script. As Far As I Know there isn't other way.

Kaloyan Iliev

Hugo wrote:

Show quoted text

hi,

is it possible to schedule the execution of an sql stored procedure in
postgress on linux?

thanks

Hugo

---------------------------(end of broadcast)---------------------------
TIP 8: explain analyze is your friend

#8Geoffrey
esoteric@3times25.net
In reply to: Kaloyan Iliev Iliev (#7)
Re: Newbie question

Kaloyan Iliev Iliev wrote:

Hi Hugo,

Yes, it is possible. Just write an outer perl script(in example), which
to call this stored procedure. Then put in the cron to call whis perl
script. As Far As I Know there isn't other way.

Depending on whether you want to schedule a procedure on a regular basis
or not. You could us 'at' to schedule a one time procedure execution.

--
Until later, Geoffrey