VPS侦探论坛

 找回密码
 注册
查看: 2748|回复: 2

求救

[复制链接]
发表于 2017-3-1 11:17:53 | 显示全部楼层 |阅读模式

你好军哥想远程启动但是用ssh后发现nginx进程没有起来,请问怎么远程启动nginx啊?用ssh的方式的话
我现在的格式是
/usr/bin/expect /opt/tools/bin/expect/autossh 192.168.0.188 40023 root abcd1234a/ '/bin/sh /usr/local/nginx/conf/restart.sh restart'

expect 脚本

#!/usr/bin/expect -d
set ip [lindex $argv 0]
set port [lindex $argv 1]
set username [lindex $argv 2]
set password [lindex $argv 3]
set remocommand [lindex $argv 4]
set timeout -1
spawn /usr/bin/ssh -p $port $username@$ip "$remocommand"
expect {
"*yes/no" { send "yes\r"; exp_continue}
"*password:" { send "$password\r" }
}
interact


restart脚本

#!/bin/bash
action=$1
chown -R www:www /home/wwwroot/moviecms
kill -9 $(ps -ef|grep nginx|awk '{print $2}')
lnmp $1

#!/bin/bash
action=$1
chown -R www:www /home/wwwroot/moviecms
chown -R www:www /home/wwwroot/movietest/
kill -9 $(ps -ef|grep nginx|awk '{print $2}')
lnmp $1
美国VPS推荐: 遨游主机LinodeLOCVPS主机云搬瓦工80VPSVultr美国VPS主机中国VPS推荐: 阿里云腾讯云。LNMP付费服务(代装/问题排查)QQ 503228080
发表于 2017-3-1 19:23:26 | 显示全部楼层


nginx有专门的脚本 /etc/init.d/nginx 负责状态管理 https://lnmp.org/faq/lnmp-status-manager.html
Linux下Nginx+MySQL+PHP自动安装工具:https://lnmp.org
 楼主| 发表于 2017-3-2 17:21:34 | 显示全部楼层

谢了军哥,搞好了。。。。。
美国VPS推荐: 遨游主机LinodeLOCVPS主机云搬瓦工80VPSVultr美国VPS主机中国VPS推荐: 阿里云腾讯云。LNMP付费服务(代装/问题排查)QQ 503228080
您需要登录后才可以回帖 登录 | 注册

本版积分规则

小黑屋|手机版|Archiver|VPS侦探 ( 鲁ICP备16040043号-1 )

GMT+8, 2024-9-27 17:33 , Processed in 0.025760 second(s), 16 queries .

Powered by Discuz! X3.4

© 2001-2023 Discuz! Team.

快速回复 返回顶部 返回列表