centos mono 自动关闭问题

来源:互联网 发布:快车软件下载 编辑:程序博客网 时间:2024/05/21 17:52


安装上mono时就想到如果mono进程挂掉了怎么办(http://blog.csdn.net/gold2008/article/details/8228690),没想到网站没过多久,就提示 502 bad gateway错误, ps aux 看了下,mono进程不见了。写个sh,每分钟执行一次检查进程是否存在,不存在就启动:


#!/bin/bashif [ `ps -fe | grep "/fastcgi-mono-server4.exe" | grep -v "grep" | wc -l` = "0" ]; then  /opt/mono/bin/mono /opt/mono/lib/mono/4.0/fastcgi-mono-server4.exe /applications=/:/home/www/目录 /socket=tcp:127.0.0.1:9000 &fi;

然后killall mono, 计划任务启动mono后,浏览器打开aspx文件,提示错误:

Server Error in '/' Application


Description: An application error occurred on the server. The current custom error settings for this application prevent the details of the application error from being viewed remotely (for security reasons). It could, however, be viewed by browsers running on the local server machine.

Details: To enable the details of this specific error message to be viewable on remote machines, please create a <customErrors> tag within a "web.config" configuration file located in the root directory of the current web application. This <customErrors> tag should then have its "mode" attribute set to "Off".

<!-- Web.Config Configuration File --><configuration>    <system.web>        <customErrors mode="Off"/>    </system.web></configuration>

Notes: The current error page you are seeing can be replaced by a custom error page by modifying the "defaultRedirect" attribute of the application's <customErrors> configuration tag to point to a custom error page URL.

<!-- Web.Config Configuration File --><configuration>    <system.web>        <customErrors mode="RemoteOnly" defaultRedirect="mycustompage.htm"/>    </system.web></configuration>

==========================================

对比分析从shell命令行启动跟cron启动有什么区别? 应该是环境变量的问题,多次测试后,找到解决办法:

#!/bin/bashif [ `ps -fe | grep "/fastcgi-mono-server4.exe" | grep -v "grep" | wc -l` = "0" ]; thenPATH=$PATH:$HOME/binexport PATHunset USERNAMEexport PKG_CONFIG_PATH=/opt/mono/lib/pkgconfig:export LD_LIBRARY_PATH=/opt/mono/lib:export PATH=/opt/mono/bin:/usr/kerberos/sbin:/usr/kerberos/bin:/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/root/bin/opt/mono/bin/mono /opt/mono/lib/mono/4.0/fastcgi-mono-server4.exe /applications=/:/home/www/目录 /socket=tcp:127.0.0.1:9000 &echo "start" >> /home/mono.txtfi;