OPH_SCRIPT

Description

Type

General.

Behaviour

It executes a bash script.

The script can eventually process some environmental variables passed by the operator:

  • OPH_SCRIPT_DATA_PATH : points to base folder of data repository on server (if available)
  • OPH_SCRIPT_SESSION_PATH : points to oph_web_server_location/sessions/session_code/export/misc
  • OPH_SCRIPT_SESSION_URL : points to oph_web_server/sessions/session_code/export/misc
  • OPH_SCRIPT_SESSION_CODE : is the session_code
  • OPH_SCRIPT_WORKFLOW_ID : is the workflow identifier
  • OPH_SCRIPT_MARKER_ID : is the marker identifier associated with the job

Parameters

  • script: name of the script to be executed; by default no operation is performed. The script has to be registered at server side (see admin configuration).
  • args: list of pipe-separated arguments to be passed to the script.
  • stdout: file where screen output (stdout) will be redirected (appended); set to “stdout” for no redirection.
  • stderr: file where errors (stderr) will be redirected (appended); set to “stderr” for no redirection.
  • list : get the available scripts (for additional scripts refer to admin configuration).

System parameters

  • exec_mode: operator execution mode. Possible values are async (default) for asynchronous mode, sync for synchronous mode with json-compliant output.

  • ncores: number of parallel processes to be used (min. 1). This operator is not parallel, so the only possible value is 1.

  • sessionid: session identifier used server-side to manage sessions and jobs. Usually, users don’t need to use/modify it, except when it is necessary to create a new session or switch to another one.

  • objkey_filter: filter on the output of the operator written to file:

    • default=all => no filter
    • none => no output
    • script => shows the output of the command or the list of registered scripts
    • script_url => show the URL where the command could save some data
    • script_returncode => show the return code of the command.

Examples

Execute the script “test var1 var2” without redirecting stdout and stderr:

[OPH_TERM] >>  oph_script script=test;args=var1|var2;

Arguments

Argument name Type Mandatory Values Default Min/Max-value
script “string” “no”   ”:”  
args “string” “no”   ” “  
stdout “string” “no”   “stdout”  
stderr “string” “no”   “stderr”  
list “string” “no” “yes|no” “no”  
exec_mode “string” “no” “async|sync” “async”  
sessionid “string” “no”   “null”  
ncores “int” “no”   “1” “1” / “1”
objkey_filter “string” “no” “all|none|script|script_url|script_returncode” “all”