我在Cygwin上运行Lighttpd。我有一个调用BASH脚本的Lua CGI脚本,该脚本调用notepad.exe。我的实际问题是运行一个C#应用程序,但我现在已经尝试使用记事本来简化这个问题。
当我调用CGI网页时,我得到错误: notepad.exe: command not fine,但当我从Cygwin shell运行BASH时,记事本运行得很好,没有错误。
当lighttpd运行时,看起来路径正在被清理。如何确保环境是相同的?
CGI (LUA):
#!/usr/bin/lua
cmd = "/opt/abc/scripts/test.sh"
local f = io.popen( cmd.." ; echo RC=$?" )
assert(f)
local str = f:read'*a'
f:close()
print ("Content-type: Text/html\n")
print ("<br><b>Output</b>: ", str)
print ("</body></html>")BASH:
#!/bin/sh
echo "Test.sh"
echo "<br>PATH<br> $PATH<hr>"
notepad.exe 2>&1发布于 2011-05-18 00:07:40
Lighttpd是由windows任务调度程序在系统启动时启动的,不需要用户登录。这意味着服务器是在标记为非交互的windows 'Session 0‘中启动的。More info on Windows Sessions
我的解决方案是将一个简单的批处理文件放入启动lighttpd的启动文件夹中。或者,我也可以创建一个cygwin服务,它会自动启动并确保选中了与桌面交互选项。
发布于 2011-04-22 10:41:15
你有没有试过用bash -l调用?还有--在脚本中设置路径有什么问题吗?
(没有现成的cygwin机器可以测试)
https://stackoverflow.com/questions/5749470
复制相似问题