ad_schedule_proc (public)

 ad_schedule_proc [ -thread thread ] [ -once once ] [ -debug debug ] \
    [ -all_servers all_servers ] [ -schedule_proc schedule_proc ] \
    interval proc [ args... ]

Defined in packages/acs-tcl/tcl/utilities-procs.tcl

Replacement for ns_schedule_proc and friends, allowing us to track what's going on. Can be monitored via /admin/monitoring/schedule-procs.tcl. The procedure defaults to run on only the canonical server unless the all_servers flag is set to true.

Switches:
-thread (optional, defaults to "t")
t/f If true run scheduled proc in its own thread. Note that when scheduled procs executed in the main thread these procs can delay processing of other scheduled procs for a potentially long time, no other jobs will be scheduled. If scheduled procs should be running at certain times, it is highly recommended to run all scheduled procs in separate (job execution) thread and use the main scheduled thread mainly for scheduling.
-once (optional, defaults to "f")
t/f. If true only run the scheduled proc once
-debug (optional, defaults to "f")
t/f If true log debugging information
-all_servers (optional, defaults to "f")
If true run on all servers in a cluster
-schedule_proc (optional)
ns_schedule_daily, ns_schedule_weekly or blank
Parameters:
interval (required)
If schedule_proc is empty, the interval to run the proc in seconds, otherwise a list of interval arguments to pass to ns_schedule_daily or ns_schedule_weekly
proc (required)
The proc to schedule

Partial Call Graph (max 5 caller/called nodes):
%3 test_ad_schedule_proc ad_schedule_proc (test acs-tcl) ad_schedule_proc ad_schedule_proc test_ad_schedule_proc->ad_schedule_proc ad_canonical_server_p ad_canonical_server_p (private) ad_schedule_proc->ad_canonical_server_p server_cluster_enabled_p server_cluster_enabled_p (public) ad_schedule_proc->server_cluster_enabled_p packages/acs-admin/tcl/acs-admin-init.tcl packages/acs-admin/ tcl/acs-admin-init.tcl packages/acs-admin/tcl/acs-admin-init.tcl->ad_schedule_proc packages/acs-admin/tcl/apm-admin-init.tcl packages/acs-admin/ tcl/apm-admin-init.tcl packages/acs-admin/tcl/apm-admin-init.tcl->ad_schedule_proc packages/acs-admin/www/server-restart.tcl packages/acs-admin/ www/server-restart.tcl packages/acs-admin/www/server-restart.tcl->ad_schedule_proc packages/acs-api-browser/tcl/api-doc-init.tcl packages/acs-api-browser/ tcl/api-doc-init.tcl packages/acs-api-browser/tcl/api-doc-init.tcl->ad_schedule_proc packages/acs-authentication/tcl/sync-init.tcl packages/acs-authentication/ tcl/sync-init.tcl packages/acs-authentication/tcl/sync-init.tcl->ad_schedule_proc

Testcases:
ad_schedule_proc
Source code:
    #
    # Don't schedule a proc to run if
    # - we have enabled server clustering,
    # - and we're not the canonical server,
    # - and the procedure was not requested to run on all servers.
    #
    if { [server_cluster_enabled_p] && ![ad_canonical_server_p] && $all_servers == "f" } {
        return
    }

    set proc_info [list $thread $once $interval $proc $args [ns_time] 0 $debug]
    ns_log debug "Scheduling proc $proc"

    # Add to the list of scheduled procedures, for monitoring.
    nsv_lappend ad_procs . $proc_info

    set my_args [list]
    if { $thread == "t" } {
        lappend my_args "-thread"
    }
    if { $once == "t" } {
        lappend my_args "-once"
    }

    # Schedule the wrapper procedure (ad_run_scheduled_proc).

    if { $schedule_proc eq "" } {
        ns_schedule_proc {*}$my_args {*}$interval ad_run_scheduled_proc [list $proc_info]
    } else {
        $schedule_proc {*}$my_args {*}$interval ad_run_scheduled_proc [list $proc_info]
    }
XQL Not present:
PostgreSQL, Oracle
Generic XQL file:
packages/acs-tcl/tcl/utilities-procs.xql

[ hide source ] | [ make this the default ]
Show another procedure: