Share your knowledge at the LQ Wiki.
Go Back > Forums > Non-*NIX Forums > Programming
User Name
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.


  Search this Thread
Old 03-17-2009, 07:50 PM   #1
LQ Newbie
Registered: Feb 2009
Posts: 15

Rep: Reputation: 0
Getting Shell Script to Execute IF new row in Postgres SQL is added? (PHP)

Firstly, I do not want to use cron. I want it to be instantaneous.

I am working on a web server where the hosts turned-on safe mode and turned off a-lot of the functions for PHP (including exec) in order to secure their servers. Outside of that, I do have access to chroot and can pretty much do anything on the server.

I want to use ImageMagick to create dynamic images based on form data.

I was trying to find a work-around with PHP where I can still use ImageMagick (a shell-based imagining program) by causing SQL to execute a shell script after the form data is saved to a table. Is there anyway it could cause a flag to automatically run a shell script when someone adds a new row to a certain table.

It has to be instantaneous, more or less, so that the user isn't sitting there waiting for a minute for cron to catch any changes to the database. Thanks
Old 03-18-2009, 12:45 AM   #2
Senior Member
Registered: Nov 2005
Location: Hanoi
Distribution: Fedora 13, Ubuntu 10.04
Posts: 2,379

Rep: Reputation: 148Reputation: 148
I assume that safe mode is on and the safe_mode_exec_dir is set, limiting system programs that can be executed to just that directory. Can you put your script in that directory?

I'm not certain if PostgreSQL can run a system command but if it can then you can do it from a trigger.


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Not able to execute Oracle Sql command in shell script Ranvijaidba Programming 3 10-23-2008 03:45 PM
Shell script to parse csv-like output, row by row utahnix Linux - General 8 12-08-2007 05:03 AM
Execute a php or sql script by button click stranger_6_7 Linux - General 3 02-02-2007 08:24 PM
Execute shell script using php on linux vj123 Programming 2 02-21-2006 12:41 AM
PHP -- How to execute a shell script from PHP using FTP functions?? zoonalex Programming 3 07-29-2004 11:51 AM > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 10:31 AM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration