Replies: 2 comments 3 replies
-
已将该 issue 转为 discussion,看看是否有其他社区用户遇到类似问题,一起讨论解决。
|
Beta Was this translation helpful? Give feedback.
3 replies
-
用AI写了一个脚本,1分钟检测一次 #!/bin/bash
# 定义端口号和服务名称
PORT=1890
SERVICE_NAME="1panel"
# 检查端口是否在监听
check_port() {
netstat -tuln | grep ":$PORT " > /dev/null
return $?
}
# 重启服务
restart_service() {
echo "端口 $PORT 未被监听,正在重启 $SERVICE_NAME 服务..."
systemctl restart $SERVICE_NAME
echo "$SERVICE_NAME 服务已重启。"
}
# 主逻辑
if check_port; then
echo "端口 $PORT 正在监听,无需操作。"
else
restart_service
fi |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Contact Information
No response
1Panel Version
v1.10.21-lts
Problem Description
开机后,服务运行中,但是没有端口,浏览器访问也没有
Steps to Reproduce
重启服务后,端口开放,可访问
The expected correct result
No response
Related log output
没有异常日志信息
No response
Additional Information
No response
Beta Was this translation helpful? Give feedback.
All reactions