3

Is there some mechanism in postgres that can fire off a shell script when a database record is written? I can write a script to just monitor the database and table but before doing that I wanted to make sure there wasn't a "better" way.

2 Answers 2

6

Write a trigger function using PL/sh. That's what it's for.

Sign up to request clarification or add additional context in comments.

1 Comment

for other later on ... Used the PL Python trigger in postgres to write to a queue. I then have a script that works with the queue. This was a better way to handle it then letting the DB script drive any real work.
2

You can probably use rule or trigger and start your shell script for whatever PL that supports it, but I think the better way is to use it for sending notification and monitor it from a separate process.

1 Comment

Yeah, one shell script per row just doesn't sound like a good idea.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.