Shell 实践、常用脚本进阶
2018-01-15 20:51
513 查看
1.备份单个文件
#!/bin/bash #nginx的启动服务脚本 # chkconfig: - 85 15 # description: nginx is a World Wide Web server. It is used to serve pid="/usr/local/nginx/logs/nginx.pid" on="/usr/local/nginx/sbin/nginx" start () { if [ -f $pid ];then echo "ON! qi dong cheng gong!!!" else echo "YES! cheng gong!!!" #/bin/su - nginx -c "/usr/local/nginx/sbin/nginx $2 1>/dev/null 2>/dev/null" /usr/local/nginx/sbin/nginx fi } stop () { if [ -f $pid ];then echo "YES! yi guan bi!!!" killall nginx else echo "NO! yi guan bi!!!" fi } case "$1" in start) start ;; stop) stop ;; restart) stop sleep 3 start ;; exit) exit ;; *) echo $"Usage: $0 (start,stop,restart)" exit ;; esac exitView Code
相关文章推荐
- shell脚本中数组array常用技巧学习实践
- @shell脚本中数组array常用技巧学习实践@
- Shell 实践、常用脚本
- shell脚本中数组array常用技巧学习实践
- spring boot 以jar的方式启动常用shell脚本
- Shell 脚本进阶2
- Linux开发中常用shell脚本
- 我常用的主机监控Shell脚本
- 几个常用的shell脚本
- Shell脚本常用语句
- Shell脚本常用命令简介
- 常用的一些shell脚本(一)
- linux常用shell脚本
- 常用的几个shell脚本_2_查看日志
- shell脚本进阶
- Linux常用Shell脚本珍藏
- Java实践 — SSH远程执行Shell脚本(转)
- Java实践 — SSH远程执行Shell脚本
- 常用的shell脚本
- Redis进阶实践之十九 Redis如何使用lua脚本