I'm in the beginning stages of hacking together code that syncs two completely different pieces of software/webware. I'm looking for a way to run a SQL query and output the results to a text file. I'd like this information to be updated daily so I'm leaning towards a cron job.
My current line of thought is to just write a script that logs into the database(phpBB) run the query (All users that have X number of posts) and then export that list of users to a text file.
My question/s:
-
Do I have to worry about putting the database username/password into this cron script?
-
Is there another more efficient way for me to get this information from the database without logging into MySQL?
-
Is Cron jobs appropriate for retrieving information from a database?
-
Is there any MySQL specific cron/scripting issues I need to be aware of while programing this.
Please keep in mind that I will be using linux to code and execute this script and the MySQL server is hosted on a unix machine.
Best Answer
After talking to someone more knowledgeable then me I have came up with the following answers to my original questions.
TLDR; Cron should be fine for what your doing but don't write a bash script, write a PHP script instead, it's better.
If anyone can answer the "Why" PHP is better then Bash Scripting in this scenario feel free to leave a post or comment.