Help:Extension/ScriptFunctions

From Metabolomics.JP
(Difference between revisions)
Jump to: navigation, search
Line 7: Line 7:
 
__TOC__
 
__TOC__
  
外部スクリプトを使えるようにするextensionです。
+
Extension to use an external scripting language, Lua.
現在使えるのはluaのみです。
+
  
luaが無限ループに陥った場合などの対処として、script_monitoring.shをcrondで実行し、10秒以上実行されているluaプログラムを停止(kill)します。
+
Since an infinite loop can be achieved by Lua, script_monitoring.sh run by crond will kill all Lua processes running longer than 10 seconds.
  
またセキュリティのため、io、debug、package、osには実行時にnilが代入され、「dofile」という文字がソースに含まれている場合、プログラムは停止します。
+
For security, Lua's io, debug, package, os library are nullified. Also, the program halts when it finds 'dofile'.
  
 
== Requirements ==
 
== Requirements ==
Line 31: Line 30:
 
== Installtion ==
 
== Installtion ==
 
<ol>
 
<ol>
  <li>Download source and rename to ScriptFunctions.php and script_monitoring.sh.</li>
+
  <li>Download the source code and rename it to ScriptFunctions.php and script_monitoring.sh.</li>
  <li>Put in extensions/ directory.</li>
+
  <li>Place it in the extensions/ directory.</li>
  <li>Insert follow line to LocalSettings.php
+
  <li>Insert the follow lines to LocalSettings.php
 
  <pre>require_once( "$IP/extensions/ScritFunctions.php" );
 
  <pre>require_once( "$IP/extensions/ScritFunctions.php" );
 
$egLuaPath = "path to directory which in lua binary";
 
$egLuaPath = "path to directory which in lua binary";
 
$egTmpPath = "path to tmp directory"; ( default: "/tmp" )</pre>
 
$egTmpPath = "path to tmp directory"; ( default: "/tmp" )</pre>
$egLuaPathを定義しなかった場合、プログラムは実行されません。<br>
+
$egLuaPath is required.<br>
$egTmpPathはluaプログラムを一時的に保存する場所です。</li>
+
$egTmpPath is a temporary place to save Lua programs.</li>
 
  <li>Put in any direcotry.( ideal: /etc/cron.d/ )</li>
 
  <li>Put in any direcotry.( ideal: /etc/cron.d/ )</li>
 
  <li>Insert follow line to /etc/crontab
 
  <li>Insert follow line to /etc/crontab
Line 45: Line 44:
  
 
== Function ==
 
== Function ==
# [[Doc:Extensions#.7B.7B.23lua:program.7Carg.7D.7D|lua]]
+
# [[Help:Extensions#.7B.7B.23lua:program.7Carg.7D.7D|lua]]

Revision as of 23:38, 20 September 2008

Extension Information
Implementation
Description
Author(s)K, Suwa
Version0.1
MediaWiki1.11.1
License
Hooks used
Token type

Contents


Extension to use an external scripting language, Lua.

Since an infinite loop can be achieved by Lua, script_monitoring.sh run by crond will kill all Lua processes running longer than 10 seconds.

For security, Lua's io, debug, package, os library are nullified. Also, the program halts when it finds 'dofile'.

Requirements

lua

Download

versionsourcesize
0.1(September 11,2008)ScriptFunctions.phps


versionsourcesize
0.1(September 11,2008)script_monitoring.sh

Installtion

  1. Download the source code and rename it to ScriptFunctions.php and script_monitoring.sh.
  2. Place it in the extensions/ directory.
  3. Insert the follow lines to LocalSettings.php
    require_once( "$IP/extensions/ScritFunctions.php" );
    $egLuaPath = "path to directory which in lua binary";
    $egTmpPath = "path to tmp directory"; ( default: "/tmp" )

    $egLuaPath is required.

    $egTmpPath is a temporary place to save Lua programs.
  4. Put in any direcotry.( ideal: /etc/cron.d/ )
  5. Insert follow line to /etc/crontab
    * * * * * root /etc/cron.d/lua_monitoring.sh

Function

  1. lua
Personal tools
Namespaces

Variants
Actions
Navigation
metabolites
Toolbox