常用脚本for 循环,和nginx的启动
1)for循环示例
[root@game updata]# cat pvzgame_jar.sh #!/bin/bash SERVERS=( pvzgame_quick_001 pvzgame_quick_002 ) for var in ${SERVERS[@]} do mv /opt/htdocs/$var/${var}.jar /opt/htdocs/$var/${var}.jar.bak.2019.5.22 cp /root/updata/game_pvz_17-39.jar /opt/htdocs/$var/${var}.jar echo "文件更新完成:"$var done
2)nginx启动脚本示例
#!/bin/bash # [ -e $PID ] -e 存在 PROCESS=/usr/local/nginx/sbin/nginx PID=/var/run/nginx.pid start(){ if [ -e $PID ];then echo -e "