Question

I am testing an application in MAMP and would like to add a cron job, or as I am on a mac the job through is run through launchctl. My cron is a php file that runs a database query. Naturally the php file and mysql db are in separate directories. Where should I change my working directory to such that the cron will query the database? FYI, I have a standard installation /Applications/MAMP/...

Many thanks.

Was it helpful?

Solution

My mistake above was that I was trying to point to the database's directory, when the php file had already handled that for me. Running the program was as simple as running the following code:

php -q /path/to/my/doc.php

I found it was easiest to manage launchtl through a $5-$10 program called lingon. Highly recommended if you are considering managing multiple crons at a time. Otherwise, if you want to stick to the command line, this is a good tutorial.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top