[root@Client_Download_Source shell]# cat start.nginx.sh 
#!/bin/bash
while true
do
sleep 2
check=`netstat -ntlp|egrep "\<80\>"`

if [[ ${check} == "" ]]
then
    echo -n $(date +%F_%T)         >> /tmp/nginx.log
    /opt/nginx/sbin/nginx && sleep 2 && echo "nginx start ok" >>/tmp/nginx.log
else
echo -n $(date +%F_%T)  >> /tmp/nginx.log && sleep 1;echo " ngin is start" >> /tmp/nginx.log

fi


done

[root@Client_Download_Source shell]# 

 

 

[root@Client_Download_Source shell]# cat /etc/rc.local 
#!/bin/sh
#
# This script will be executed *after* all the other init scripts.
# You can put your own initialization stuff in here if you don't
# want to do the full Sys V style init stuff.

touch /var/lock/subsys/local
ulimit -SHn 102400
/opt/nginx/sbin/nginx
sh /opt/shell/start.nginx.sh &

 

相关文章:

  • 2021-10-05
  • 2021-08-15
  • 2022-03-08
  • 2021-05-21
  • 2022-01-21
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2021-05-18
  • 2021-06-15
  • 2021-12-28
  • 2021-09-13
  • 2021-08-14
相关资源
相似解决方案