Task (Introduction)
A task is a named construct which defines a certain job that should be performed by nnCron. A task defines both the operations to be performed (such as starting programs, operations with files, displaying onscreen messages etc.) and conditions under which these operations should be performed (time, absence or presence of specified files, absence or presence of a disk in a drive etc).
Each task is assigned a unique name which identifies the task and facilitates working with it. A task name should not contain any blank spaces.
As explained in section about the nnCron extended mode, each task starts with the following construct:
#( <task_name>
When crontab parser encounters this sequence, it immediately switches to extended mode. Task name length should not exceed 255 characters and may contain any alphanumeric letters. To mark the end of task, the following sequence is used:
)#
It switches the crontab parser back to classic mode.
A comment can be inserted anywhere in a task with the help of backslash character (\ ). In Forth, backslash means that any text till the end of this line should be treated as a comment (it works just like // (double slash) in C++ or JavaScript). Please don't omit placing a blank space after the comment symbol for it is one of the nnCron's key words.
Example:
#( first_task \ this is my first task )#
This is an absolutely correct task as far as syntax is concerned. Its only fault is that it is useless in terms of functionality, because the body of first_task only contains a comment line.
Now, how a fully functional task would look? What would it consist of?
First of all, a task should contain a section defining the actions which should be performed by this task. Start of such a section is marked off with keyword Action:.
Example:
#( first_task \ this is my first task Action: \ action \ playing a sound file PLAY-SOUND: c:\winnt\media\chimes.wav )#
Section Action: can be preceded by other task components (in any desired order):
In a most generic form, a typical task would look this way:
#( task_name [\ comment to the end of line] [options] [authorization] [time specifiers (Time:)] [event specifiers] [conditions for task execution (Rule:)] actions (Action:) \ ... performing some useful actions )#
Here is a slightly enhanced version of our first task. We have added option NoLog (so that task's execution would not be recorded in nnCron's log file) and a time specifier Time: */15 * * * 1-5 * (so that the tasks is executed each 15 minutes on weekdays):
#( first_task \ this is my first task NoLog \ option Time: */15 * * * 1-5 * \ time specifier Action: \ action \ playing a sound file PLAY-SOUND: c:\winnt\media\chimes.wav )#
A detailed discussion of all questions having to do with conditions and methods of starting a task can be found in section Starting a Task.