服务器 Gind.cn

服务器问题集锦,包括 Linux(Ubuntu, Centos,Debian等)和Windows Server服务器

SSH在自动脚本调用时不工作

概要 :包含ssh的脚本在命令行中运行良好,但ssh部分在脚本被自动守护程序(apcupsd)调用时不起作用。 细节 :我有一个ESXi服务器,我有一个CentOS 6.5虚拟机,专门用于监控APC Backup UPS(通过USB)。 我正在使用APCUPSD来做到这一点。 理论上说,如果发生延迟断电,它将进入ESXi主机closures系统。 一切工作在连接到UPS和检测电源故障等方面,并在关机时调用脚本(在CentOS虚拟机上)。 我使用ssh-keygen等设置了密钥,因此我可以在不需要密码的情况下进入ESXi主机。 如果我从命令行手动运行脚本,它工作正常。 但是它不会在apcupsd自动调用。 特别是它是不工作的ssh命令(我的脚本中的其他行运行良好)。 我试着改变命令我正在运行一个简单的LS和redirect输出到一个文件(再次这个工作正常,当从命令行手动运行)。 当自动触发我的输出文件被创build,但它是零字节。 我已经尝试了许多不同的SSH选项,包括-i和-n。 我似乎无法得到任何详细的错误信息(例如与-v) 查看ESXi主机上的/var/log/auth.log,表明它甚至没有尝试build立连接。 我已经尝试了几件事情: /usr/bin/ssh -o StrictHostKeyChecking=no -x root@XXXX "ls" >output_file /usr/bin/ssh -n -i /root/.ssh/id)dsa root@XXXX "ls" >output_file ssh -n root@XXXX >output_file 如果我echo $? >output_file echo $? >output_file我得到一个126的返回码,我相信是CLI_ERR_NOT_AUTHORIZED授权错误:用户没有足够的权限来执行命令。 事情是我相信apcupsd将作为根运行,所以我会认为它会有必要的权限。 任何人都可以帮忙吗?

Nginx反向代理重新打包分块响应

我正在运行nginx / 1.1.19: # nginx -V nginx version: nginx/1.1.19 TLS SNI support enabled configure arguments: –prefix=/etc/nginx –conf-path=/etc/nginx/nginx.conf –error-log-path=/var/log/nginx/error.log –http-client-body-temp-path=/var/lib/nginx/body –http-fastcgi-temp-path=/var/lib/nginx/fastcgi –http-log-path=/var/log/nginx/access.log –http-proxy-temp-path=/var/lib/nginx/proxy –http-scgi-temp-path=/var/lib/nginx/scgi –http-uwsgi-temp-path=/var/lib/nginx/uwsgi –lock-path=/var/lock/nginx.lock –pid-path=/var/run/nginx.pid –with-debug –with-http_addition_module –with-http_dav_module –with-http_geoip_module –with-http_gzip_static_module –with-http_image_filter_module –with-http_realip_module –with-http_stub_status_module –with-http_ssl_module –with-http_sub_module –with-http_xslt_module –with-ipv6 –with-sha1=/usr/include/openssl –with-md5=/usr/include/openssl –with-mail –with-mail_ssl_module –add-module=/build/buildd/nginx-1.1.19/debian/modules/nginx-auth-pam –add-module=/build/buildd/nginx-1.1.19/debian/modules/nginx-echo –add-module=/build/buildd/nginx-1.1.19/debian/modules/nginx-upstream-fair –add-module=/build/buildd/nginx-1.1.19/debian/modules/nginx-dav-ext-module 我正在使用它来反向代理服务,可以stream数据作为分块的响应。 后端服务中的每个块都是一个有效的JSON文档,但是当通过nginx代理访问时,块被重新打包成'round'大小,如0x1000,0x2000,0x4000等。这使得块不再有效的JSON blob,每个块将在开始时具有一个文档的结尾,并在结尾处具有另一个文档的开头。 我的location块是这样configuration的: location / { proxy_pass http://backend; […]