服务设置自动重启
使用systemctl管理服务,如kibana
设置自动重启的参数 StartLimitIntervalSec=0 Restart=always
RestartSec=1
#vim /etc/systemd/system/kibana.service
[Unit]
Description=Kibana
[Service]
Type=simple
User=kibana
Group=kibana
# Load env vars from /etc/default/ and /etc/sysconfig/ if they exist.
# Prefixing the path with '-' makes it try to load, but if the file doesn't
# exist, it continues onward.
EnvironmentFile=-/etc/default/kibana
EnvironmentFile=-/etc/sysconfig/kibana
ExecStart=/usr/share/kibana/bin/kibana "-c /etc/kibana/kibana.yml"
Restart=always
StartLimitIntervalSec=0
RestartSec=1
WorkingDirectory=/
[Install]
WantedBy=multi-user.target
使用supervisord设置自动重启,如ardb
#cat /etc/supervisord/conf.d/ardb.conf
[program:ardb]
directory=/opt/db/ardb
command=/opt/db/ardb/src/ardb-server /opt/db/ardb/ardb.conf
numprocs=1
user=root
autostart=true
autorestart=true
redirect_stderr=true
stdout_logfile=/opt/db/ardb/log/ardb-server.log
stdout_logfile_maxbytes=200MB
stdout_logfile_backups=20