setting up linux cronjobs

View previous topic View next topic Go down

setting up linux cronjobs

Post by jamied_uk on Sun 5 May 2013 - 7:44

in command line (shell terminal)

type following

Code:
crontab -e


edit and exit and save!
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Running php scripts using crontab examples for locallay executable php files

Code:
*/5 * * * * php -f /var/www/html/cj/email1.php >/dev/null 2>&1


~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~



now includes line make sure it is like this example

include("/host/web_server/www/php_includes/file_to_include.php");


~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
To run a php script from a cli
Now inside the php file you can add this to the top of the line
#!/usr/bin/php5



~~~~~~~~~~~~~~~
Remote cronjob examples

*/5 * * * * php -f http://www.yourserver.com/cj/email1.php >/dev/null 2>&1


The following has code at the end to stop any email on cronjobs

>/dev/null 2>&1
avatar
jamied_uk
Admin

Posts : 2293
Join date : 2010-05-09
Age : 34
Location : UK

http://address-shortner.co.uk

Back to top Go down

View previous topic View next topic Back to top

- Similar topics

 
Permissions in this forum:
You cannot reply to topics in this forum