[FX.php List] Crontab to run php script?
Anders Monsen
andersm at alamark.com
Mon Jun 7 07:42:52 MDT 2010
Jonathan,
Set up a crontab file by typing "crontab -e"
You can review any current file if you have one with "crontab -l" ( lower case L, if I remember correctly).
Yes, you can point to the existing path of your file, although depending on what it does, you may run into permissions issues. I used to run several cron jobs just as you describe, calling php files from various locations. Make sure the file is executable. You include the full path in the cron, and as long as the file is executable then leaving it in the same web folder should work. You can test this by creating a mail script in a PHP file or an insert into do action, setting this up in the cron, and letting it run. You can also navigate to the folder and type ./filename.php and if it's executable the script should run in the cron.
I would recommend reading up on what each column of the cron does, ie. month, day, hour minute, etc.
Also, much depends on your current command line editor. I believe on the Mac it defaults to "vi" for some reason. I prefer pico or nano, as there are few commands to remember. Depending on which editor you prefer, there are ways to set the default.
Again, there are better descriptions out there via Google than what I can pull up from my memory, so I recommend a Google search. This one, for example:
http://benr75.com/pages/using_crontab_mac_os_x_unix_linux
Regards,
Anders
On Jun4, 2010, at 9:42 PM, Jonathan Schwartz wrote:
> Hi Folks,
>
> I need to create a Crontab in OS X Server to run a php script. The script performs sales order post processing instead of doing it during order entry. This allows sales reps to be more efficient.
>
> The question is whether I can I leave the script, which calls other scripts, in the existing web folder. On OS X Server, that is /Library/WebSerber/Documents/TheWebFolder.
>
> Moving along, I'm struggling with how to create the crontab to call the script.
>
> Any experienced crontab jockeys out there?
>
> Jonathan
> --
> Jonathan Schwartz
> Exit 445 Group
> jonathan at exit445.com
> http://www.exit445.com
> 415-370-5011
> _______________________________________________
> FX.php_List mailing list
> FX.php_List at mail.iviking.org
> http://www.iviking.org/mailman/listinfo/fx.php_list
>
>
More information about the FX.php_List
mailing list