Synchronet v3.19b-Win32 (install) has been released (Jan-2022).

You can donate to the Synchronet project using PayPal.

This is an old revision of the document!


JSexec

JSexec may be used to execute some Synchronet JavaScript files (e.g. *.js, *.ssjs) externally from Synchronet.

Uses

  • Persistent execution of static services (e.g. ircd) independent of Synchronet
  • Background execution of timed events (e.g. newslink)
  • Command-line execution of sysop functions (e.g. makeguest)
  • CGI generated dynamic HTML

Independence

A Synchronet installation is required for JSexec to function, though JSexec will execute scripts successfully even when Synchronet is not running.

Command Line

usage: jsexec [-opts] [path]module[.js] [args]

available opts:

        -c<ctrl_dir>   specify path to Synchronet CTRL directory
        -m<bytes>      set maximum heap size (default=8388608 bytes)
        -s<bytes>      set context stack size (default=16384 bytes)
        -S<bytes>      set thread stack limit (default=262144, 0=unlimited)
        -b<limit>      set branch limit (default=99999999, 0=unlimited)
        -y<interval>   set yield interval (default=10000, 0=never)
        -g<interval>   set garbage collection interval (default=100, 0=never)
        -h[hostname]   use local or specified host name (instead of SCFG value)
        -u<mask>       set file creation permissions mask (in octal)
        -L<level>      set log level (default=7)
        -E<level>      set error log level threshold (default=4)
        -i<path_list>  set load() comma-sep search path list (default="load")
        -f             use non-buffered stream for console messages
        -a             append instead of overwriting message output files
        -e<filename>   send error messages to file in addition to stderr
        -o<filename>   send console messages to file instead of stdout
        -n             send status messages to NUL instead of stderr
        -q             send console messages to NUL instead of stdout
        -v             display version details and exit
        -x             disable auto-termination on local abort signal
        -l             loop until intentionally terminated
        -p             wait for keypress (pause) on exit
        -!             wait for keypress (pause) on error

Module

The module argument is optional if the standard input stream (stdin) is not a console (tty), allowing for shebang support on Unix-like operating systems.

Additional Properties

Additional properties available to JavaScript scripts running from JSexec:

Property Type Description
jsexec_revision stringCVS revision of JSexec (example: "1.135")
jsexec_revision_detail string Verbose details about the JSexec build (example: "JSexec 1.136 Debug Compiled Mar 15 2010 11:13:53 with GCC 3.4.2")
env string[] Associative array of system environment variables (example: env["shell"]="/bin/bash")

conio

JSexec includes an instance of a special Console Input/Output class called conio.

FIXME

uifc

JSexec includes an instance of a special User Interface class called uifc.

FIXME

shebang

JSexec for non-Windows platforms will ignore the first line of the interpreted script if it begins with #!, allowing for a shebang (Unix) style script file where the first line of the script is something like:

#!/sbbs/exec/jsexec -c/sbbs/ctrl

This allows JSexec scripts to be executed easily via CGI as well as other command-line conveniences on Unix-like operating systems.

See Also