[FX.php List] Crontab to run php script?

Anders Monsen andersm at alamark.com
Mon Jun 7 07:53:51 MDT 2010


Here's another reference page that has more information.

http://www.notesbit.com/index.php/scripts-unix/crontab-quick-complete-reference-setting-up-cronjobs-in-unix-and-linux/

I have relied on this line to change the editor:
----->export EDITOR=vi ;to specify a editor to open crontab file.
in which case I instead use "export EDITOR=pico;" since I was not raised on vi.

This site also list the option to remove your crontab, and has several other examples on what each setting does. I think it's geared more toward Lunix, but most of the commands and options should also work on the Mac.

Regards,
Anders


On Jun7, 2010, at 8:42 AM, Anders Monsen wrote:

> 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
>> 
>> 
> 
> _______________________________________________
> FX.php_List mailing list
> FX.php_List at mail.iviking.org
> http://www.iviking.org/mailman/listinfo/fx.php_list
> 
> 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.iviking.org/pipermail/fx.php_list/attachments/20100607/a973ce60/attachment-0001.html


More information about the FX.php_List mailing list