gpt4 book ai didi

ruby - 瘦服务器自动重启脚本

转载 作者:行者123 更新时间:2023-12-04 18:52:19 28 4
gpt4 key购买 nike

我是 ubuntu 的新手,在 azure 上遇到一个问题,其中虚拟机由于 Microsoft 的维护而自动重新启动。

因此,我的应用程序出现故障。此外,他们(Windows)方面也没有确认何时重新启动/系统更新。

即使我启动瘦服务器,如何保持它对特定端口(即端口 3000、3001、3002、3003 等)打开。请告诉我。

我浏览了各种博客,并对 init.d 进行了更改,以使瘦服务器在重新启动时自动启动。

user: root
group: webuser
pid: tmp/pids/thin.pid
timeout: 30
wait: 30
log: log/thin.log
max_conns: 1024
require: []
environment: production
max_persistent_conns: 512
servers: 1
threaded: true
no-epoll: true
daemonize: true
socket: tmp/sockets/thin.sock
chdir: webuser/app
tag: hey aux

我已经尝试过上述方法,但失败了。

下面是我的 etc/init.d Thin 文件:-

# Do NOT "set -e"

DAEMON=/usr/bin/thin
SCRIPT_NAME=/etc/init.d/thin

# Exit if the package is not installed
[ -x "$DAEMON" ] || exit 0

run_action() {
ACTION="$1"

if [ -x /usr/bin/ruby1.8 ]; then
/usr/bin/ruby1.8 $DAEMON $ACTION --all /etc/thin1.8
fi

if [ -x /usr/bin/ruby1.9.1 ]; then
/usr/bin/ruby1.9.1 $DAEMON $ACTION --all /etc/thin1.9.1
fi

}

case "$1" in
start)
run_action start
;;
stop)
run_action stop
;;
restart|force-reload|reload)
run_action restart
;;
*)
echo "Usage: $SCRIPT_NAME {start|stop|restart}" >&2
exit 3
;;
esac

:

我不知道脚本是对还是错。但是代码似乎不起作用。谁能帮我解决这个问题吗?提前非常感谢

最佳答案

也许您可以使用chkconfig。使用以下命令检查thin是否on:

chkconfig | grep thin

如果不是(也许在你的情况下)添加它:

chkconfig thin on

关于ruby - 瘦服务器自动重启脚本,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26674103/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com