随笔分类 - linux xxx.sh
java程序执行脚本
摘要:nohup java -Dserver.port=8087 -Dspring.config.location=application-generic.yml -jar ${APP_HOME}/${APP_NAME} >/dev/null 2>&1 #-Dserver.port为指定端口启动 #-Ds
阅读全文
摘要:APP_HOME=/home/sxylz/ggfw APP_NAME=$1# 使用说明,用来提示输入参数usage() { #Usage[可选内容] echo "Usage: sh boot [APP_NAME] [start|stop|restart|status]" exit 1} # 检查程序
阅读全文
摘要:美元符加字符串bai是引用变量值,而美元符加数字表示命du令行参数。比如:zhibash$ ./hello.sh build test 脚本中$0的值就是dao./hello.sh,$1的值是build,$2的值是test。 bash$ list.sh -sh --debug /home/user脚
阅读全文
摘要:if [ $? -eq 0 ]该语句是什么含义?$0: shell或shell脚本的名字$*:以一对双引号给出参数列表$@:将各个参数分别加双引号返回$#:参数的个数$_:代表上一个命令的最后一个参数$$:代表所在命令的PID$!:代表最后执行的后台命令的PID$?:代表上一个命令执行后的退出状态
阅读全文
摘要:-z "${pid}"判断pid是否存在 -z 空串
阅读全文
摘要:解析 pid=ps -ef | grep $APP_NAME | grep -v grep | awk '{print $2}'ps -ef 显示所有进程参考 -ef 和aux的区别 -ef 和 aux-ef 不截断commandaux 显示cpu和内存使用率| 管道符左边的输出作为右边的输入gre
阅读全文
摘要:test.sh #!/bin/sh while : do run1=$(ps -ef |grep 'sxnx-sms-8081' |grep -v "grep") if [ "$run1" ] ; then echo "The sxnx-sms-8081 service is alive!" els
阅读全文
摘要:test.sh #!/bin/sh while : do run1=$(ps -ef |grep 'sxnx-sms-8081' |grep -v "grep") run2=$(ps -ef |grep 'sxnx-sms-8082' |grep -v "grep") run3=$(ps -ef |
阅读全文