求救
你好军哥想远程启动但是用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
set port
set username
set password
set remocommand
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 nginx有专门的脚本 /etc/init.d/nginx 负责状态管理 https://lnmp.org/faq/lnmp-status-manager.html 谢了军哥,搞好了。。。。。
页:
[1]