mn8 Language Reference | Index    

Cron

SUMMARY: NO ATTRIBUTES  ELEMENTS SUMMARY  NO CONSTRUCTORS  NO OPERATORS  METHODS SUMMARYDETAIL: NO ATTRIBUTES  ELEMENT DETAILS  NO CONSTRUCTORS  NO OPERATORS  METHOD DETAILS

Description

With this concept can you create a crontab and handle the Scheduler to schedule jour jobs. Into the crontab can you add Unix like crons. The cron have the following elements: min, hour, dayOfMonth, month, dayOfWeek. If you want to use a days of month put "*" in the place of dayOfWeek, and you want to use days of week put "*" in the place of dayOfMonth.

A structure of one cron element can be:

The values of elements:

Usage

      # The cron is Singleton, you have only one instance on your terminal
      $y=Cron.getInstance

      # Every Monday on 0.10, 6.10, 12.10, 18.10 will execute the "Google ..." script
      Cron.addTask("10 0-23/6 * * 1", "Google rsearch Antal Attila atech")

      # Every 20th day of month on 14.30  will execute the "Google ..." script
      # and assigns the returned task id to $t (is Integer)
      $t = Cron.addTask("30 14 20 * *", "Google rsearch Gnome 2.0  distribution")

      # looking after my cron tasks
      print $y.toXML

      # getting the tasks into the series
      $tasks = Cron.getTasks

      # Ugly task with id=1 I remove it
      Cron.removeTask(1)

      # How many tasks I have?
      print "" + Cron.getTasks@length

      # Be happy I starting the scheduler
      Cron.start

      # The system is hanging up and holds the scheduler to work
      System.pause(0)

      # Is something working bad or need to shut down the scheduler
      Cron.stop
  

Version: 0.1
Authors:Antal Attila
Inherits: Concept

Element List

 task TYPEOF Series LABEL "task"
top

Method List

static IntegeraddTask (String $timeString, String $task)
static CrongetInstance
static SeriesgetTasks
static removeTask (Integer $taskId)
static start
static stop
top
Methods inherited from: Concept
cloneConcept, extendsConcept, fromXML, getAllInheritedConcepts, getConceptAttribute, getConceptAttributeField, getConceptAttributeFields, getConceptAttributes, getConceptConstructors, getConceptElement, getConceptElementField, getConceptElementFields, getConceptElements, getConceptLabel, getConceptMethod, getConceptMethods, getConceptOperators, getConceptType, getConceptsAtPath, getErrorHandler, getInheritedConcepts, hasConceptAttribute, hasConceptElement, hasConceptMethod, hasPath, isHidden, loadContent, setConceptLabel, setErrorHandler, setHidden, setShowEmpty, showEmpty, toTXT, toXML

Detailed Element Info

task

Label:task
Type:Series
Is Static:false
Is Hidden:false
Is Multi:false
Show Empty:true

Task element to hold informations with its attributes

top

Detailed Method Info

static addTask (String $timeString, String $task)
Parameters:
$timeString :Cron string
$task :Execution string in order by ConceptName followed by it self attributes
Returns: Integer

Adding task into your tasks

top
static getInstance
Returns: Cron

The cron concept is Singleton, with this method you can get an instance

top
static getTasks
Returns: Series

Returns all the tasks

top
static removeTask (Integer $taskId)
Parameters:
$taskId :Task id, what returns the addTask method

Remove the specified task

top
static start

Starting the scheduler

top
static stop

Stops the scheduler

top