Solved

Triggering a cron job with Mysql

Posted on 2014-01-15
4
345 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 24

Assisted Solution

by:Tomas Helgi Johannsson
Tomas Helgi Johannsson earned 100 total points
ID: 39784719
0
 
LVL 34

Accepted Solution

by:
Dan Craciun earned 300 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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

As a database administrator, you may need to audit your table(s) to determine whether the data types are optimal for your real-world data needs.  This Article is intended to be a resource for such a task. Preface The other day, I was involved …
Introduction Since I wrote the original article about Handling Date and Time in PHP and MySQL (http://www.experts-exchange.com/articles/201/Handling-Date-and-Time-in-PHP-and-MySQL.html) several years ago, it seemed like now was a good time to updat…
Learn several ways to interact with files and get file information from the bash shell. ls lists the contents of a directory: Using the -a flag displays hidden files: Using the -l flag formats the output in a long list: The file command gives us mor…
Learn how to navigate the file tree with the shell. Use pwd to print the current working directory: Use ls to list a directory's contents: Use cd to change to a new directory: Use wildcards instead of typing out long directory names: Use ../ to move…

708 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

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now