[ Index ] |
PHP Cross Reference of vtigercrm-6.1.0 |
[Summary view] [Print] [Text view]
1 To setup a new cron service 2 =========================== 3 4 1. Create <ServiceName>.service file, which has the following content at the beginning 5 6 <?php 7 8 require_once ('config.inc.php'); 9 10 /** Verify the script call is from trusted place. */ 11 global $application_unique_key; 12 if($_REQUEST['app_key'] != $application_unique_key) { 13 echo "Access denied!"; 14 exit; 15 } 16 17 /** 18 * Check if instance of this service is already running? 19 */ 20 $svcname = $_REQUEST['service']; 21 // We need to make sure the PIDfile name is unqique 22 $servicePIDFile = "logs/$svcname-service.pid"; 23 24 if(file_exists($servicePIDFile)) { 25 echo "Service $svcname already running! Check $servicePIDFile"; 26 exit; 27 } else { 28 $servicePIDFp = fopen($servicePIDFile, 'a'); 29 } 30 31 /** 32 * Turn-off PHP error reporting. 33 */ 34 try { error_reporting(0); } catch(Exception $e) { } 35 36 // ... REST OF YOUR CODE ... 37 38 // AT END 39 /** Close and remove the PID file. */ 40 if($servicePIDFp) { 41 fclose($servicePIDFp); 42 unlink($servicePIDFile); 43 } 44 45 ?> 46 47 ===================================================================================================================================== 48 49 2. Create <ServiceName>Cron.sh file which should have the following: 50 51 export VTIGERCRM_ROOTDIR=`dirname "$0"`/.. 52 export USE_PHP=php 53 54 cd $VTIGERCRM_ROOTDIR 55 56 $USE_PHP -f vtigercron.php service="<ServiceName>" <param>="<value>" 57 58 ===================================================================================================================================== 59 60 3. Create <ServiceName>Cron.bat file which should have the following: 61 62 @echo off 63 64 set VTIGERCRM_ROOTDIR="C:\Program Files\vtigercrm5\apache\htdocs\vtigerCRM" 65 set PHP_EXE="C:\Program Files\vtigercrm5\php\php.exe" 66 67 cd /D %VTIGERCRM_ROOTDIR% 68 69 %PHP_EXE% -f vtigercron.php service="<ServiceName>" <param>="<value>" 70 =====================================================================================================================================
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
Generated: Fri Nov 28 20:08:37 2014 | Cross-referenced by PHPXref 0.7.1 |