473,398 Members | 2,427 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,398 software developers and data experts.

Run Unix Shell Scripts With Postgres Trigger

Hi,

I would like to run shell scripts with respect to the time mentioned in postgres data base tables. Postgres database should trigger the shell script for the time mentioned in the table. To make it more clear, i will add an entry like as below in postgres database table

file_id script_run_time
crd_extract.sh 13:00

Now as part of automation process postgres database should trigger the script to run.

FYI, I know that i can write a shell script and put it in cron table to run continously so the script queries the table every minute and compare the extracted time from the table with the system date and trigger the extraction script which will be the subshell. But this would not be my automation requirement. Iam looking for a solution of triggering the script by looking the time in Postgres table.

Request all the masters in the forum to reply ASAP.

Thanks in advance and with Regards,
Sainath
May 5 '07 #1
1 9042
michaelb
534 Expert 512MB
Postgresql is not the best tool to run the OS jobs and unfortunately I cannot think of any really smooth solution.

Look at the Postgresql job scheduler pgAgent.

Another approach could be to create a trigger on insert, update and delete for your table.
The function invoked by this trigger will get all rows from the jobs table and compile a crontab file out of them. Then it would submit the job and you're done. From that point on cron will take care of running your scheduled tasks.

When this table gets updated the trigger fires and your crontab file is recompiled and resubmitted. If all records are deleted the function will know how to call crontab to remove the job.

Obviously for this function you'll pick a language which has a way of running shell commands.
May 5 '07 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: Al Belden | last post by:
Hi all, I've been working on a problem that I thought might be of interest: I'm trying to replace some korn shell scripts that search source code files with perl scripts to gain certain features...
1
by: dk | last post by:
is there any way to invoke a unix shell script from .net? tia, dk
2
by: timdoyle05 | last post by:
Hi, I have a question relating to how Unix commands can be issued from Python programs. Im am currently writing a large test script in python and I need this script to call three other separate...
7
by: kamkwokho | last post by:
Could any answer following questions as many as you can. ii) Write a C shell script convertmin which will read in a number, thought of as representing minutes, and print out the number of...
2
by: Ryan Gaffuri | last post by:
Ill also need to return values. How do I do this? Im using GNU on solaris 2.8 with korn shell scripts?
1
by: Thierry Missimilly | last post by:
Hi Postgres users, I wonder to know if it is possible to launch a Perl program or a unix comand in a trigger function. I have tried to do that in a C trigger developed with the SPI function....
2
by: traju | last post by:
Hi Friends, I am new user in unix o/s,i have a small ques what is the difference b/w unix shell scripts and korn shell scripts
2
by: zw | last post by:
Hi I have 2 unix boxes. In each box, I have a unix shell script that captures certain statistics to a file of the unix box. During the run of the 2 shell scripts, I need a common timestamp for...
0
by: abhishek | last post by:
any way by which i can trigger a unix shell script from a button click.after that i should display an error message if the script was'nt executed successfully.Please help!!!
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.