123
#!/bin/bash
# 设置参数和路径
SECRET_KEY="liberty carbon thing glass unlock crucial today report lemon arm orient miss deputy despair delay faint razor rural budget feature rebuild always dust gun"
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
while true; do
# 判断进程是否存在
if pgrep -f "start\.sh" >/dev/null 2>&1; then
echo "The script is running."
else
echo "The script is not running. Restarting in 5 minutes..."
sleep 300 # 等待 5 分钟
cd "$SCRIPT_DIR" && \
nohup expect -c "
spawn ./tower start
expect \"Enter your oL mnemonic:\"
send \"$SECRET_KEY\\n\"
interact
" >> /path/to/logfile.log 2>&1 &
fi
sleep 60 # 每隔 1 分钟检查一次进程状态
done
技术是没有终点的,也是学不完的,最重要的是活着、不秃。 学习看书还是看视频,都不重要,重要的是学会,欢迎关注,我们的目标---不秃。
---更多运维开发交流及软件包免费获取请加V: Linuxlaowang