Count the number of redis connections
echo 'client list' | /apps/svr/redis/bin/redis-cli -h 127.0.0.1 -p 6379 |awk '{print $1}' | awk -F '[=,:]' '{print $2}' | sort -n | uniq -c |sort -nr
nginx log split script
#!/bin/bash # This script run at 00:00 # The Nginx logs path logs_path="/usr/local/nginx/logs/" cd $logs_path for logfile in `ls *.log` do mv ${logs_path}${logfile} ${logs_path}$(date -d "yesterday" +"%Y%m%d_")${logfile} done kill -USR1 `cat /usr/local/nginx/nginx.pid` tar czvf $(date -d "yesterday" +"%Y%m%d")_log.tar.gz $(date -d "yesterday" +"%Y%m%d_")*.log # 打包压缩日志 rm -f $(date -d "yesterday" +"%Y%m%d_")*.log # Delete compressed source files
Open mysql general log
show global variables like "%genera%"; set global general_log=on;
MySQL client common commands
Record operation log\T \T /tmp/sql.log
\sView the status information of the current connection