NaviServer - programmable web server

[ Main Table Of Contents | Table Of Contents | Keyword Index ]

# ns_schedule_proc(n) 4.99.8 naviserver "NaviServer Built-in Commands"

## Name

ns_schedule_proc - Schedule a script to run after a certain number of seconds

## Table Of Contents

## Synopsis

- ns_schedule_proc ?-once? ?-thread? interval script
- ns_unschedule_proc id

## Description

This command schedules a script to be run after a certain number of seconds. Returns the ID of the newly scheduled script. If -once is specified, then the script is run once and then unscheduled, otherwise it will continue to run every interval seconds. If -thread is specified, then the script will be run in its own thread, otherwise it will run in the scheduler's thread. If the script is long-running, this may interfere with the running of other scheduled scripts, so long-running scripts should be run in their own threads.

ns_unschedule_proc command unschedules a previous scheduled script. NOTE: Current behavior is to silently return without error if the id doesn't represent a currently scheduled ID.

## COMMANDS

ns_schedule_proc ?-once? ?-thread? interval script
ns_unschedule_proc id

## EXAMPLES

       % set id [[ns_schedule_proc -once 60 { ns_log notice "this should run in 60 seconds" }]]
       123

       % ns_unschedule_proc $id

## See Also

nsd

## Keywords

ns_after, ns_info, ns_pause, ns_resume, ns_schedule_daily, ns_schedule_weekly, ns_unschedule_proc, scheduled