FirstMQ以服务形式运行于Linux平台,步骤如下 :
1 在 /etc/systemd/system/ 下创建服务, 如: FirstMQ.service
2 打开 FirstMQ.service, 编写如下命令 :
[Unit]
Description=FirstMQ
After=network-online.target
Wants=network-online.target
[Service]
Type=simple
# 程序执行的目录
WorkingDirectory=/FirstMQ/
# 启动的脚本命令
ExecStart=/FirstMQ/FirstMQ
# 重启条件
Restart=always
# 几秒后重启
RestartSec=5
[Install]
WantedBy=multi-user.target
systemctl enable FirstMQ.service
systemctl start FirstMQ.service
systemctl status FirstMQ.service
systemctl stop FirstMQ.service