Task Options



Also

Connects specifiers Time: and Watch* with logical OR operator (by default, they are treated as combined with logical AND).

Example:

#( test-mailbox
\this task will be executed each hour or when the user presses "Alt-Ctrl+F12"
Time: 0 * * * * *
Also
WatchHotKey: @^{F12}
Rule: POP3-CHECK: "hostname" "pop3user" "password"    
Action:
    START-APP: e:\win\the bat!\thebat.exe /CHECKALL
)#

AsLoggedUser

This option tells nnCron to execute a task as a currently logged user. A task with this option can be executed only if there is a user who is authorized (logged) on this system.

Example:

#( interactive-job
AsLoggedUser
Time: 0 10 * * * *
Action:
    START-APP: c:\msoffice\winword.exe
)#

Use this option when nnCron is started as a system service (using System account). Don't use AsLoggedUser if you are running nnCron not as a system service, but as a regular application (see also Starting and Stopping nnCron).


HyperActive

A task with this option will be executed not only in normal mode, but in suspended mode as well.

Example:

#( test_hyperactive
HyperActive
Time: */5
Action:
    MSG: "Running in normal and suspended mode!"
)#

LoadProfile

This option is used to load user profile when launching processes (START-APP:, START-APPW:).
When performing task authorization, use this option for applications which require user profile (Outlook Express, The Bat!, Internet Explorer etc.)


NoActive

Deactivates the task
This option is also used in tasks which are intended to be started manually.


NoDel

This word tells nnCron not to remove from crontab file a task containing option RunOnce.
If a task contains both RunOnce and NoDel, it will be executed each time the crontab is reloaded.

Example:

#( every_crontab_reload
\ the task is executed on each reloading of crontab
RunOnce NoDel
Action:
    TMSG: "Crontab was reloaded!" 3
)#


NoLog

This option forbids to make records about execution of the task in a log file.
It is convenient to use this option in tasks which are triggered too often or with "secret" tasks which shouldn't be disclosed by record in a log file.


NoRunAs

Cancels authorization for this particular task if nnCron is set to run all tasks as as specified user (variable RunAsDefaultUser in nncron.ini).


OnceAHour
OnceADay
OnceAWeek
OnceAMonth

These options tell nnCron to run a task only once during an hour, day, week or month, respectively.

Example:

#( daily-task
\ the task is executed only once a day at system startup Time: START-TIME OnceADay Action: START-APP: backup.bat )#

No matter how many time a computer is going to be reloaded during a day, the above task will be executed only once. You can also set time limits, e.g.:

Time: * 12-16 * * * *
OnceADay

This task will be executed once on any given day, if the computer is working between 12:00 and 16:59. (And it will be started only once, even if the computer is reloaded. You cannot achieve the same result by using option RunOnce).

Information about the "worked-out" programs is recorded in file etc\once.txt nnCron's installed directory.
Sometimes it may be necessary to cancel option OnceA* in the task itself, e.g. so that time count is started anew after rebooting the system. For this purpose, you can use words CANCEL or CLEAR-ONCE, which removes the effect of OnceA* option from the current task.

Example:

#( test_clear_once
Time: START-TIME
OnceADay
Action:
    START-APP: backup.bat
    \ clearing 'OnceA*' option if specified file exists
    FILE-EXIST: "c:\more_backups.sem"
    IF CLEAR-ONCE THEN
)#

RunMissed
RunMissed: <hh:mm|days>

Sometimes tasks may have been missed because nnCron was not running. RunMissed option tells nnCron to run missed task 'at the first opportunity' - at the top of the first minute after nnCron startup. Missed tasks handling concept is described in more details in corresponding chapter.

Example:

#( test_missed
\ the task will start at the specified time or
\ at the top of the first minute after nnCron startup
\ (if nnCron was not running at 12:00)
RunMissed 
Time: 0 12 16 5 * 2003
Action:
    \ ...
)#

The 'extended' option RunMissed: <hh:mm|days> allows you to specify maximum waiting time (in hours and minutes) that may elapse since this task was sheduled to run for the last time. The missed task will not be launched if specified waiting time value is smaller than the actual time elapsed since this task was sheduled to run for the last time.

Example:

#( test_missed1
\ the task will start at the specified time or
\ at the top of the first minute after nnCron startup
\ (if nnCron was not running at 12:00 and maximum 
\ waiting time do not exceeds 3 hours and 30 minutes)
RunMissed: 03:30
Time: 0 12
Action:
    \ ...
)#

#( test_missed2
\ the task will start at the specified time or
\ at the top of the first minute after nnCron startup
\ (if nnCron was not running at sunday, 12:00 and 
\ maximum waiting time do not exceeds 3 days)
RunMissed: 3
Time: 0 12 * * 7
Action:
    \ ...
)#

Note, please, that you can use RunMissed: 0 syntax to disable missed tasks handling.

When you are using plain RunMissed option (instead of extended RunMissed: <hh:mm|days>) the value of nncron.ini variable DefaultRunMissedTime: is used as RunMissed argument (360 hours or 15 days).

You can manage missed tasks handling using nnCron GUI: checkboxes to turn RunMissed option on/off and input fields to enter maximum waiting time are available in New Task, New Reminder

and Edit Task dialog boxes.

See also: RunMissed?


RunOnce

A task with this option will only be executed once, after which it will be deleted from the crontab file.
Deleted tasks are automatically saved by the program in a special inactive crontab file deleted.tab which is located in nnCron's installed directory.
This option is mainly used in reminders (see Reminder:).


SingleInstance

This option prevents simultaneous execution of two or more instances of the same task. While a task with SingleInstance option is being executed, no other instance of the same task cannot be started, and any attempt to start it will be suppressed.

In order to prevent a simultaneous execution of several different tasks (and two or more instances of the same task as well), one can use words GET è RELEASE. GET takes hold of a specified semaphore, and RELEASE releases it. These words use address of a variable (which is left on the stack after the variable has been used in the task) as their parameter. The succeeding tasks will be started, but they will be actually executed only after the preceding task releases the semaphore.

Example:

#( test_task1
\ Messages "task1" and "task2" will never appear at the same time.
VARIABLE SEM1
Action:
    SEM1 GET
    MSG: "task1"
    SEM1 RELEASE
)#

#( test_task2
Action:
    SEM1 GET
    MSG: "task2"
    SEM1 RELEASE
)#