记录一些小知识点,方便查阅
- 以jar方式启动的shell命令
#!/bin/sh
#当前sh目录
WORK_DIR=$(cd $(dirname $0); pwd)
# spring boot 要激活的配置
PROFILES=$2
# 执行程序的目录
PROJECT_DIR=$(cd "$WORK_DIR/.."; pwd)
JAR=$PROJECT_DIR/ProjectName-1.0.jar
# java 目录
JAVA_HOME=/usr/local/jdk1.8.0_261
CONSOLE_FILE=$PROJECT_DIR/logs/console.log
GC_LOG=$PROJECT_DIR/logs/gc.log
# PID文件位置,需要修改
PIDFILE=/var/run/ProjectName.pid
case "$1" in
start)
if [ -f $PIDFILE ]
then
echo "$PIDFILE exists, process is already running or crashed"
#elif [ "$PROFILES" = "" ]
#then
# echo "Please set profiles as second argument"
else
# echo "spring.profiles.active is $PROFILES"
echo "Starting ProjectName server..."
nohup $JAVA_HOME/bin/java -Xms4096m -Xmx4096m -XX:SurvivorRatio=8 -Xloggc:$GC_LOG -XX:+UseG1GC -jar -Dspring.profiles.active=$PROFILES $JAR >$CONSOLE_FILE 2>&1 & echo $! > $PIDFILE
tail -f $CONSOLE_FILE
fi
;;
stop)
if [ ! -f $PIDFILE ]
then
echo "$PIDFILE does not exist, process is not running"
else
PID=$(cat $PIDFILE)
echo "Stopping ..."
kill -9 $PID | rm -f $PIDFILE
while [ -x /proc/${PID} ]
do
echo "Waiting for ProjectName to shutdown ..."
sleep 1
done
echo "ProjectName stopped"
fi
;;
*)
echo "Please use start or stop as first argument"
;;
esac
- Word2007 VB API DOC.
https://docs.microsoft.com/en-us/previous-versions/office/developer/office-2007/bb213365(v=office.12) - 特殊字符的Unicode
https://www.cnblogs.com/lsgxeva/p/10120275.html - 捕获某个进程的网络请求
yum install strace
strace -p $PID -f -e trace=network -s 10000
- 压测工具
#-n访问1000次, -c并发10个
ab -c 1000 -n 10000 http://192.168.16.55:8081/demo/detail/find
wrk -c 100 -d 10 -t 12 http://xxx/xxx/177.html
- 监控网络客户连接数
netstat -n | grep tcp | grep 侦听端口 | wc -l
#每隔1秒执行一次
netstat -n -c | grep tcp | grep 侦听端口 | wc -l
- curl post
curl -H "Accept: application/json" -H "Content-type: application/json" -X POST -d '{"identphonenum":"xx","name":"bb"}' 'http://xxx.test.org/dopost'
- springboot 启动命令
#方式一
mvn spring-boot:run -Dspring-boot.run.profiles=test
#方式二
java -jar -Dspring.profiles.active=test target/project.jar
- 防火墙命令
# 查询端口是否开放
firewall-cmd --query-port=8080/tcp
# 开放80端口
firewall-cmd --permanent --add-port=80/tcp
# 移除端口
firewall-cmd --permanent --remove-port=8080/tcp
#重启防火墙(修改配置后要重启防火墙)
firewall-cmd --reload
# 参数解释
1、firwall-cmd:是Linux提供的操作firewall的一个工具;
2、--permanent:表示设置为持久;
3、--add-port:标识添加的端口;
firewall-cmd --list-all
systemctl status firewalld