Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Triggering a cron job with Mysql

Posted on 2014-01-15
4
Medium Priority
?
395 Views
Last Modified: 2014-01-17
Hello, can someone let me know how I can trigger a cron job everytime a record is added in one of my tables. Each time a record is added to this table a service running on my Ubuntu machine has to be given a reload command. Can someone let me know how I can do this? Thank you.

A
0
Comment
Question by:aej1973
4 Comments
 
LVL 26

Assisted Solution

by:Tomas Helgi Johannsson
Tomas Helgi Johannsson earned 400 total points
ID: 39784719
0
 
LVL 35

Accepted Solution

by:
Dan Craciun earned 1200 total points
ID: 39787638
If you have multiple users accessing your MySQL db, I'd advise against using lib_mysqludf_sys, for security reasons: they don't need EXECUTE rights to execute UDF scripts.

Just use a script to search (once every few minutes) for COUNT(*) to see if you have inserts.
You can use the language of your choice for that (php, python, bash etc).

HTH,
Dan
0
 
LVL 6

Expert Comment

by:Mahesh Bhutkar
ID: 39788357
Agree with Dan, rather than giving that task on DB, You can write a cron job which check if any new record added inside table which is not processed & then run the process..
0
 

Author Comment

by:aej1973
ID: 39789092
I agree too, thank you.
0

Featured Post

Ask an Anonymous Question!

Don't feel intimidated by what you don't know. Ask your question anonymously. It's easy! Learn more and upgrade.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Backups and Disaster RecoveryIn this post, we’ll look at strategies for backups and disaster recovery.
Measuring Server's processing rate with a simple powershell command. The differences in processing rate also was recorded in different use-cases, when a server in free and busy states.
The viewer will learn how to count occurrences of each item in an array.
Connecting to an Amazon Linux EC2 Instance from Windows Using PuTTY.
Suggested Courses

782 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question