DokuWiki

It's better when it's simple

User Tools

Site Tools


plugin:runcommand

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
plugin:runcommand [2014-03-31 22:55] – [Installation] 87.11.58.31plugin:runcommand [2020-09-22 17:59] (current) – [Bugs] tomcat
Line 1: Line 1:
-====== runcommand plugin ======+====== runcommand Plugin ======
  
 ---- plugin ---- ---- plugin ----
-description: Execute a program on the fly and show its output.+description: Execute a program on the fly and show its output
 author     : Alessandro Celli author     : Alessandro Celli
 email      : aelsantex[at]gmail.com email      : aelsantex[at]gmail.com
 type       : Syntax type       : Syntax
-lastupdate : 2014-03-31 +lastupdate : 2014-04-01 
-compatible : Binky+compatible : Binky, !Hogfather, Greebo
 depends    :  depends    : 
 conflicts  conflicts 
Line 17: Line 17:
  
 ---- ----
 +
 +===== 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 ===== ===== News =====
Line 26: Line 35:
 ==== Plugin Installation ==== ==== Plugin Installation ====
  
-Download and install the plugin using the Plugin Manager using the URL given above+Download and install the plugin using the [[plugin:extension|Extension Manager]]
  
-If you want install manually follow this procedure:+Alternatively, refer to [[:Plugins]] on how to install plugins manually. If you want install manually follow this procedure:
  
   - Download the zip file from github: [[https://github.com/aelsantex/runcommand/archive/master.zip]].   - Download the zip file from github: [[https://github.com/aelsantex/runcommand/archive/master.zip]].
Line 39: Line 48:
  
 Create a directory under DOKUWIKI_ROOT folder and set it into **script_dir** field of runcommand section under wiki configuration page.  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. +As default, I choose to set DOKUWIKI_ROOT/data/scripts directory. See [[#configuration|configuration]] for more details.
 ===== Syntax ===== ===== Syntax =====
  
Line 71: Line 79:
   }   }
      
-===== Old Release ===== 
  
-**ATTENTION** 
  
-Below you can find the reference for the old version of runcommand. I keep it for a limited time only for compatibility with old version of dokuwiki.  +==== How to use ====
- +
- +
-==== 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.) +
- +
- +
- +
-===== Download and Installation ===== +
- +
-It's quite easy:  +
-  * download this [[https://sites.google.com/site/aesantex/runcommand.zip?attredirects=0|archive]] and unpack it in the /lib/plugins directory of your wiki or use the plugin manager page from admin menu (URL: https://sites.google.com/site/aesantex/runcommand.zip?attredirects=0). +
-   +
-  * Create directory **scripts** under wiki installation and set it into script_dir field of runcommand section under wiki configuration page. As the default, I choose to put dir under //DOKUWIKI_ROOT/data/scripts//. See [[#configuration|configuration]] for more details. +
-===== How to use =====+
  
 Syntax is simple: Syntax is simple:
Line 102: Line 90:
 //runButtonText|<run button label>// \\ //runButtonText|<run button label>// \\
 //cancelButtonText|{ <cancel button label> | none }// \\ //cancelButtonText|{ <cancel button label> | none }// \\
-//<arg-1 label>//**|**//<arg type>//**=**//<arg value>// \\+//<arg1 name>//**|**//<arg1 label>//**|**[//newline//]**|**<arg1 type>=//<argument options 1>// \\
 ... \\ ... \\
-//<arg-n label>//**|**//<arg type>//**=**//<arg value>// \\+//<argN name>//**|**//<argN label>//**|**[//newline//]**|**<argN type>=//<argument options N>// \\
 **</runcommand>** \\ **</runcommand>** \\
 +
  
 //**Where:**// //**Where:**//
  
-  * **<command>**: The command invocation. You can use the same syntax used into a CLI interface to run the program. You can pass some arguments and keep argument values from runcommand arguments. Keep in mind that the arguments are referred by its label preceded by dollar char (**$**) and the space substituted with underscore (see next example, refer **$arg_1** into command, it matches with //<arg-1 label>// **arg 1**). See [[#configuration|configuration]] for security details.+  * **<command>**: The command invocation. You can use the same syntax used into a CLI interface to run the program. You can pass some arguments and keep argument values from runcommand arguments. The arguments are referred by the arg name preceded by dollar char (**$**). No space are accepted in the arg name\\ 
 +See [[#configuration|configuration]] for security details.
  
   * **<output type>**: One of the next values:   * **<output type>**: One of the next values:
Line 117: Line 107:
     * **choice**: The user may choose one of the previous formats from a select field.     * **choice**: The user may choose one of the previous formats from a select field.
  
-  * **<arg-X label>**: The label is printed before the argument field and the name of the argument for it is used as the command argument.+  * **<arg-X name>**: It is used as the command argument name preceded by dollar char (**$**). 
 + 
 +  * **<arg-X label>**: The label is printed before the argument field.
  
   * **<arg type>**: One of the next values:   * **<arg type>**: One of the next values:
Line 123: Line 115:
     * **hidden**: Generate a hidden field. If you use a hidden field, the label isn't printed.     * **hidden**: Generate a hidden field. If you use a hidden field, the label isn't printed.
     * **list**: Generate a selectable list of values.     * **list**: Generate a selectable list of values.
 +    * **autocomplete**: Generate an autocomplete text field.
 +    * **slider**: Generate a slider with given minimum and maximum value.
 +    * **spinner**: Generate a spinner field with the given minimum and maximum value.
 +    * **date**: Generate a date field; the uses may be specify the date format.
  
-  * **<arg value>**: The default value for text and an hidden fieldThe list of available value for a list. If you use a list you must respect this syntax: \\ **list=**//<item 1>//**:**//label 1//**;**//<item N>//**:**//<label N>// \\ Where: +  * **<argument options X>**: Is specific for all field type. 
-    * **<item X>**: Is the value given by the list as argument+    * **hidden**: Fixed value associated to this argument. 
-    * **<label X>**: Is the label that the user sees in the list.+    * **text**: The default value for this text field 
 +    * **list**: The list of available values for a list field. 
 +    * **autocomplete**: The list of autocomplete value for this text field. 
 +    * **slider**: Require the minimum, maximum, default value and step value. 
 +    * **spinner**: Require the minimum, maximum and default value. 
 +    * **date**: May be specified the date output format.
  
  
-//**Example:**//+==== Example ====
  
 In this example, I use the printf command to show the values of arguments. In this example, I use the printf command to show the values of arguments.
  
   <runcommand>   <runcommand>
-  command|printf "==== Test ====\n\n__Result__\n\n  * arg1=**$arg_1**\n  * arg2=//$arg_2//\n  * arg3=$arg_3\n\n <note>Work</note>+  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------- 
-  cancelButtonText|{ <cancel button label> none } +  outputType|choice 
-  arg 1|text=argument 1 +  runButtonText|Esegui  
-  arg 2|hidden=argument 2 +  cancelButtonText|Cancella 
-  arg 3|list=item 1:value 1;item 2:value 2;item 3:value 3;default:item 2+  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>   </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+{{https://raw.githubusercontent.com/aelsantex/public_images/master/runcommand_example1.png}} 
 + 
 +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>   <runcommand>
-  command|printf "==== Test ====\n\n__Result__\n\n  * arg1=**$arg_1**\n  * arg2=//$arg_2//\n  * arg3=$arg_3\n\n <note>Work</note>+  command|sleep 1 ; printf "==== Test ====\\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------- 
-  runButtonText|Test Me +  outputType|choice 
-  cancelButtonText|none +  runButtonText|Esegui  
-  outputType|wiki +  cancelButtonText|Cancella 
-  arg 1|text=argomento 1 +  arg_text|Test text|newline|text=default text 
-  arg 2|text=argomento 2 +  arg_list|Test list||list=item 1:List item1;item 2:List item2;item 3:List item3; 
-  arg 3|list=item 1:value 1;item 2:value 2;item 3:value 3;default:item 2+  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>   </runcommand>
  
- +{{https://raw.githubusercontent.com/aelsantex/public_images/master/runcommand_example2.png}}
-== Runcommand before command execution == +
- +
-{{http://aelsantex.googlepages.com/runcommand1.jpeg|}} +
- +
-== Runcommand after command execution == +
- +
-{{http://aelsantex.googlepages.com/runcommand2.jpeg|}}+
  
 ===== Configuration =====  ===== Configuration ===== 
  
-From wiki configuration's page you find five fields dedicated to runcommand.+From wiki configuration's page you find four fields dedicated to runcommand.
  
   * **safe_scripts**: If this is checked, the program must be in the //script_dir// directory. I suggest to keep it checked for security reason. Think about an **rm -rf /** command.... 8-o   * **safe_scripts**: If this is checked, the program must be in the //script_dir// directory. I suggest to keep it checked for security reason. Think about an **rm -rf /** command.... 8-o
  
-  * **script_dir**: specify the directory where the programs are located. As a convention, I suggest using folder scripts under **DOKUWIKI_ROOT/data** directory.+  * **script_dir**: specify the directory where the programs are located. As a convention, I suggest using folder **scripts** under **DOKUWIKI_ROOT/data** directory.
  
-  * **syntax_debug**: Enable the debug (you can choice 4 level of debug) of syntax page.+  * **debug_level**: Enable the debug of syntax page. 0 No debug, 3 max debug.
  
-  * **postaction_debug**: Enable the debug (you can choice 4 level of debug) of postaction page. May be help for debug external command execution +  * **rc_default_dateformat**: Specify the default date format for the date field.
- +
-  * **debug_log**: File,with full path, where write the debug messages.+
  
 ===== Languages support =====  ===== Languages support ===== 
  
-Actually, runcommand supports only Italian and English languages. I'm really happy if anyone could contribute to the translation in other languages... ;)+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 =====  ===== Bugs ===== 
Line 184: Line 187:
 Write here if you find a bug. Write here if you find a bug.
  
-Some points to consider: +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.
-  * <del>Hard coded path in ''postaction.php''</del> FIXED ! +
-  * If you are using RewriteRules in Apache, or some other settings that convert slashes into underscores, the postaction.php scrip may not get called. -> Yes, but is necessary to use the space into label, a possible solution may be dissociate the label from the name of the argument, but this choice increase the difficult of plugin syntax. +
-  * Ensure that CSS and JavaScript compression is off when using jQuery. +
- +
- -- Chris Usher+
 ===== Discussion =====  ===== Discussion ===== 
  
-  * --- //[[emauvaisfr@yahoo.fr|Etienne M.]] 25/03/2009 11:27// Hi! Not sure I will use your plugin, but here are the french language files: +<nowiki
-    * **fr/lang.php**<code php+Hi, I can't get this plugin to work.  
-<?php +I've created the /data/scripts directory and generated a listfiles.sh file (chmod 755) 
-/** +Even the example code doesn't workIt keeps showing the "Please Wait..." gif
- * French language file +Any ideas? 
- * +</nowiki>
- * @author     Alessandro Celli <aelsantex@gmail.com> +
- * @author     Etienne M. <emauvaisfr@yahoo.fr> +
- */ +
- +
-// custom language strings for the plugin +
- +
-$lang['btn_submit'  = 'Ex&eacute;cuter'; +
-$lang['btn_reset'  = 'Effacer'; +
-$lang['lbl_outputFormat'] = 'Format de sortie '; +
-$lang['fld_text'] = 'Texte'; +
-$lang['fld_wiki'] = 'Wiki'; +
-$lang['fld_html'] = 'Html'; +
-$lang['msg_wrongsyntax'] = 'Mauvaise syntaxe pour le plugin runcommand.'; +
-</code> +
-    * **fr/settings.php**<code php> +
-<?php +
-/** +
- * French language file +
- +
- * @author Alessandro Celli <aelsantex@gmail.com> +
- * @author     Etienne M. <emauvaisfr@yahoo.fr> +
- */ +
- +
-// for the configuration manager +
- +
-$lang['safe_scripts'] = 'N\'ex&eacute;cuter que les scripts pr&eacute;sents dans le dossier des scripts autoris&eacute;s.'; +
-$lang['script_dir' = 'Dossier qui contient les scripts autoris&eacute;s (&agrave; partir de la racine du dokuwiki).'; +
-</code> +
- +
-Hi Etienne, many thanks, I have included your translation but now I have introduced other 3 parametersCan you help me to translate that? +
- +
-  * --- //Mailgifson// +
- +
-Can you give a simple script to test? +
-\\ I can not use this plug-in :S +
- +
-Ok, a little example for linux/unix users.. +
-Save the follow script into //scripts// directory as **printf** with execution permissions (rwxr--r--) and try to use given examples: +
- +
-<file bash printf> +
-#!/bin/bash +
- printf "$*\n" +
-</file> +
- +
-Hello!  Thanks for the plugin: it's been quite useful!  I'd like to upgrade it, but the download link is broken :(+
  
-    * --- //Anonymous 31/07/2013 17:46// Hello, good plugin, but it conflicts with [[plugin:searchtablejs|searchtablejs plugin]] in Weatherwax release 
-    * I do some tests with this plugin for the next release. 
  
-    * --- //Fravadona 09/09/2013 16:01// HelloI can't get it work with WeatherWax; it gives me a syntax error with your examplesDo I need to install JQuery which is obsolete on the actual version of Dokuwiki ? +<nowiki> 
-    * I'm sorry, new version of plugins fix this problem, please wait for it! +Same problem heredid all the above steps and getting 'Please wait...' and then nothing. 
-    *  +</nowiki>
-In Windows 7 Plugin to work, you must create the folder c:\tmp+
plugin/runcommand.1396299307.txt.gz · Last modified: 2014-03-31 22:55 by 87.11.58.31

Except where otherwise noted, content on this wiki is licensed under the following license: CC Attribution-Share Alike 4.0 International
CC Attribution-Share Alike 4.0 International Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki