新建脚本文件:
vim start_server.sh
输入脚本内容:
cd /usr/tomcat/tomcat7/apache-tomcat-7.0.72/bin
./startup.sh
cd /usr/local/nginx/sbin
./nginx
echo "Servers started."
:wq,保存并推出
赋予脚本文件为可执行:
chmod +x start_server.sh
执行:
./start_server.sh
注:需要切换至root用户