This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# 脚本文件:/root/monitor_incusd_top.sh | |
# 功能:每分钟检查incusd进程的CPU占用率(使用top采样),如果连续3分钟超过80%,则重启服务 | |
LOG_FILE="/root/incusd_monitor.log" | |
COUNTER_FILE="/tmp/incusd_high_cpu_counter" | |
if [ ! -f "$COUNTER_FILE" ]; then | |
echo "0" > "$COUNTER_FILE" | |
fi |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from tqdm import tqdm | |
def score_number(num_str): | |
""" | |
对6位数字字符串进行评分: | |
1. 相邻重复位数:每遇到相邻相同的数字,得分为重复个数的平方 | |
2. 数字6、8、9:每出现一个加0.5分 | |
3. 不同数字数量:奖励为 6 - (不同数字的数量),乘以0.5 |