NaviServer - programmable web server

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

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

## Name

ns_after - Execute a command after a time delay

## Table Of Contents

## Synopsis

- ns_after seconds script

## Description

This command executes a script in the background after a number of seconds time delay. It does this by scheduling a one-shot event in the scheduler. Uncaught script errors will go to the server log. It returns an ID which can be used to unschedule the execution of the script (if seconds hasn't elapsed) using ns_unschedule_proc.

The script when executed will run in the scheduler thread. If the script is long-running, this may interfere with the execution of other scheduled scripts, in which case ns_schedule_proc should be used instead of ns_after.

## COMMANDS

ns_after seconds script

## EXAMPLES

       % ns_after 5 { ns_log notice "ns_after script executed" }
       123

## See Also

nsd

## Keywords

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