import os
import shutil
+import stat
from tools import process
from config import Conf
from exceptions import ScriptNotFound, ConflictInScriptName, UnsupportedScript
class Scripts(object):
- _supported = ['php']
+ _supported = ['php', 'sh']
_dirs = None
_list = None
cmd = '%s %s' % (C.get('php'), dest)
result = process(cmd, cwd=path, **cmdkwargs)
os.remove(dest)
+ elif cli.endswith('.sh'):
+ dest = os.path.join(path, 'mdkscriptrun.sh')
+ shutil.copyfile(cli, dest)
+ os.chmod(dest, stat.S_IRUSR | stat.S_IXUSR)
+
+ cmd = '%s' % (dest)
+ result = process(cmd, cwd=path, **cmdkwargs)
+ os.remove(dest)
else:
raise UnsupportedScript('Script not supported')
PHP scripts will be executed from the web directory of an instance. They will be executed as any other CLI script.
+### Shell
+
+Shell scripts will be executed from the web directory of an instance. They will be made executable and run on their own. If you need to access information about the instance from within the shell script, retrieve it using `mdk info`.
+
Directories
-----------