您的位置:首页 > 科技 > 能源 > bt蚂蚁_东营会计信息网官网_网站搜索引擎优化的方法_互联网营销师考证多少钱

bt蚂蚁_东营会计信息网官网_网站搜索引擎优化的方法_互联网营销师考证多少钱

2024/9/24 3:19:27 来源:https://blog.csdn.net/xu710263124/article/details/142333092  浏览:    关键词:bt蚂蚁_东营会计信息网官网_网站搜索引擎优化的方法_互联网营销师考证多少钱
bt蚂蚁_东营会计信息网官网_网站搜索引擎优化的方法_互联网营销师考证多少钱

Shell篇之编写apache启动脚本

1. 脚本编写

vim apache_ctl.sh
#!/bin/bashfunction_start(){printf "Starting Apaache  ...\n"/opt/lanmp/httpd/bin/apachectl start
}function_stop(){printf "Stoping Apaache  ...\n"/opt/lanmp/httpd/bin/apachectl stop
}function_restart(){printf "restarting Apaache  ...\n"/opt/lanmp/httpd/bin/apachectl restart
}function_status(){apache_stat=0apache_tmpa=`ps -ef | grep http | grep root | grep -v grep | awk '{print $2}'`apache_tmpb=`cat /opt/lanmp/httpd/logs/httpd.pid`if [ `lsof -i:10068 | wc -l` -gt 0 ]; thenif [ `ps -ef | grep httpd | grep -v grep | wc -l` -gt 0 ]; thenif [[ $apache_tmpa -eq $apache_tmpb ]]; thenapache_stat=1fifi
fiif [ $apache_stat -eq 1 ]; thenecho "apache(pid $apache_tmpa) is runing!"
elif [ $apache_stat -eq 0 ]; thenecho "apache is not runing!"
fi
}if [ "$1" = "start" ]; thenfunction_start
elif [ "$1" = "stop" ]; thenfunction_stop
elif [ "$1" = "restart" ]; thenfunction_restart
elif [ "$1" = "status" ]; thenfunction_status 
elseprintf "Usage: automate {start|stop|restart|status} \n"
fi

2. 赋权

chmod +x apache_ctl.sh

3. 命令

./apache_ctl.sh start
./apache_ctl.sh status
./apache_ctl.sh restart 

版权声明:

本网仅为发布的内容提供存储空间,不对发表、转载的内容提供任何形式的保证。凡本网注明“来源:XXX网络”的作品,均转载自其它媒体,著作权归作者所有,商业转载请联系作者获得授权,非商业转载请注明出处。

我们尊重并感谢每一位作者,均已注明文章来源和作者。如因作品内容、版权或其它问题,请及时与我们联系,联系邮箱:809451989@qq.com,投稿邮箱:809451989@qq.com