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:
- - single number (eg.12), sets a concrete value
- - coma-separated list of numbers (eg.2, 7, 10, 25), sets each of these values.
- - interval of numbers (eg.3-7), sets a every value of this interval.
- - "*", sets a all values for attribute.
- - any interval or "*" followed by slash and a number eg.*/3 or 4-8/2,
the number after the slash make the step of the interval.
The values of elements:
- - minutes: 0-59
- - hours: 0-23
- - dayOfMonth: 1-31
- - month: 1-12
- - dayOfWeek: 0-7 (0 and 7 is Sunday)
# 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
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 |
|
Label: | task |
Type: | Series |
Is Static: | false |
Is Hidden: | false |
Is Multi: | false |
Show Empty: | true |
Task element to hold informations with its attributes
Parameters: |
$timeString : | Cron string |
$task : | Execution string in order by ConceptName followed by it self attributes |
|
Adding task into your tasks
The cron concept is Singleton, with this method you can get an instance
Returns all the tasks
Parameters: |
$taskId : | Task id, what returns the addTask method |
|
Remove the specified task
Starting the scheduler
Stops the scheduler