PHP Classes

File: crontabs/ExampleCronJob2/.classes/example-cron-job1.class.php

Recommend this page to a friend!
  Classes of Bijaya Kumar Behera  >  PHP Cron Job Runner  >  crontabs/ExampleCronJob2/.classes/example-cron-job1.class.php  >  Download  
File: crontabs/ExampleCronJob2/.classes/example-cron-job1.class.php
Role: Example script
Content type: text/plain
Description: Example script
Class: PHP Cron Job Runner
Start and stop tasks in the background
Author: By
Last change:
Date: 6 years ago
Size: 768 bytes
 

Contents

Class file image Download
<?php
//
require_once( CRON_CLASS_DIR . 'cron_runner_class.php' );
require_once(
CRON_CLASS_DIR . 'cron_service_class.php' );
class
exampleCronJob1CronService extends cronService implements iCronRunner
{
    public function
onValidate(){
        return
"";
    }
    public function
onFail($status,$msg) {
    }
    public function
onStart() {
       
$this->writeToLog("Starting ....");
       
$start = time();
       
$i = 1 ;
        do
        {
           
$this->writeToStatus("Process $i .");
           
// Do somestuff
           
sleep(1);
        }while(
time() - $start < 60 );

       
$this->writeToLog("Process completed.");
        return
ture; // Mean sucessfully cron job ended
   
}
    public function
onStop($status, $msg ) {
    }
    public function
onReceive($command, $argv = array(), $params = array() ) {
    }
}
?>

For more information send a message to info at phpclasses dot org.