Table of Contents

runcommand Plugin

Compatible with DokuWiki

  • 2024-02-06 "Kaos" unknown
  • 2023-04-04 "Jack Jackrum" unknown
  • 2022-07-31 "Igor" unknown
  • 2020-07-29 "Hogfather" no

plugin Execute a program on the fly and show its output

Last updated on
2014-04-01
Provides
Syntax
Repository
Source

Tagged with command, jquery, program

Description

This plugin executes a program on the fly and shows its output.

You can use it to generate reports from the system or to execute some administration steps.

For example, I use it to collect information from my enterprise servers (free space on disks, hardware status, etc.)

News

Installation

Plugin Installation

Download and install the plugin using the Extension Manager.

Alternatively, refer to Plugins on how to install plugins manually. If you want install manually follow this procedure:

  1. Copy the master.zip file into Dokuwiki plugins dir.
  2. unzip master.zip
  3. rename the extracted folder from runcommand-master to runcommand.
  4. give the right permission (755 on linux) and owner (maybe www-data on linux).

Script directory

Create a directory under DOKUWIKI_ROOT folder and set it into script_dir field of runcommand section under wiki configuration page. As default, I choose to set DOKUWIKI_ROOT/data/scripts directory. See configuration for more details.

Syntax

To fix some old limits and to give a most pratical support with new objects I broke the compatibility with the old syntax.

This is the new grammar for runcommand plugin:

Grammar

<runcommand>
command|<command> 
outputType|{ choice | text | wiki | html | binary }
runButtonText|<run button label> 
cancelButtonText|{ <cancel button label> | none } 
[ <arg1 name>|<arg1 label>|<<flags>>|<<arguments>> ] 
...
[ <argN name>|<argN label>|<<flags>>|<<arguments>> ] 
</runcommand> 

<<flags>> ::= [ newline ] [ , <<flags>> ]

<<arguments>> ::= {
  hidden=<fixed value> |
  list=<item 1 (default)>:<label 1>;[<item N>:<label N>;] |
  text=<default value> |
  autocomplete=<item 1>;[<item N>;] |
  slider=min:<min value>;max:<max value>;value:<default value>;step:<step value>; |
  spinner=min:<min value>;max:<max value>;value:<default value>; |
  date=[format:<date format>] |
}

How to use

Syntax is simple:

<runcommand>
command|<command>
outputType|<output type>
runButtonText|<run button label>
cancelButtonText|{ <cancel button label> | none }
<arg1 name>|<arg1 label>|[newline]|<arg1 type>=<argument options 1>

<argN name>|<argN label>|[newline]|<argN type>=<argument options N>
</runcommand>

Where:

See configuration for security details.

Example

In this example, I use the printf command to show the values of arguments.

<runcommand>
command|printf "==== $arg_text ====\\n  * valorelista: $arg_list \\n  * Autocomp: $arg_autocomp \\n  * arg_slider: ** $arg_slider ** \\n  * Spinner: $arg_spinner \\n  * Data: $arg_date \\n------- "
outputType|choice
runButtonText|Esegui 
cancelButtonText|Cancella
arg_text|Test text|newline|text=default text
arg_list|Test list|newline|list=item 1:List item1;item 2:List item2;item 3:List item3;
arg_autocomp|Test autocomplete|newline|autocomplete=ActionScript;Apple Script;Asp;BASIC;C;C++;Clojure;COBOL;ColdFusion;Erlang;Fortran;Groovy;Haskell;Java;Java script;Lisp;Perl;PHP;Python;Ruby;Scala;Scheme;
arg_slider|Test slider|newline|slider=min:0;max:100;value:30;step:10;
arg_spinner|Test spinner|newline|spinner=min:0;max:20;value:7; 
arg_date|Test date|newline|date=format:mm dd yy
</runcommand>

In this example I use the printf command to show the values of arguments without display the cancel button and with custom label for run button. The fields are not on newline.

<runcommand>
command|sleep 1 ; printf "==== Test 2 ====\\n==== $arg_text ====\\n  * valorelista: $arg_list \\n  * Autocomp: $arg_autocomp \\n  * arg_slider: ** $arg_slider ** \\n  * Spinner: $arg_spinner \\n  * Data: $arg_date \\n------- "
outputType|choice
runButtonText|Esegui 
cancelButtonText|Cancella
arg_text|Test text|newline|text=default text
arg_list|Test list||list=item 1:List item1;item 2:List item2;item 3:List item3;
arg_autocomp|Test autocomplete||autocomplete=ActionScript;Apple Script;Asp;BASIC;C;C++;Clojure;COBOL;ColdFusion;Erlang;Fortran;Groovy;Haskell;Java;Java script;Lisp;Perl;PHP;Python;Ruby;Scala;Scheme;
arg_slider|Test slider|newline|slider=min:0;max:100;value:30;step:10;
arg_spinner|Test spinner||spinner=min:0;max:20;value:7; 
arg_date|Test date||date=
</runcommand>

Configuration

From wiki configuration's page you find four fields dedicated to runcommand.

Languages support

Actually, runcommand supports only Italian and English languages and partially French. I'm really happy if anyone could contribute to the translation in other languages… ;)

Bugs

Write here if you find a bug.

2020.09.22 This Plugin stopped working with the release of the Dokuwiki “Hogfather” release. If this plugin is active with “Hogfather”, there will be a blank screen appearing.

Discussion

Hi, I can't get this plugin to work. I've created the /data/scripts directory and generated a listfiles.sh file (chmod 755) Even the example code doesn't work. It keeps showing the "Please Wait..." gif. Any ideas?

Same problem here, did all the above steps and getting 'Please wait...' and then nothing.