使用 Supervisor 启动 L8P0 的操作步骤
本文介绍了如何在 Ubuntu 18.04 上安装 Supervisor,并使用 Supervisor 启动 L8P0 项目的 C++/Qt 控制台应用程序。
安装 Supervisor
首先,确保你的系统已经更新,然后安装 Supervisor:
sudo apt-get update
sudo apt-get install supervisor
配置 Supervisor
创建或编辑 Supervisor 的配置文件,确保所有应用程序都能够被 Supervisor 管理。我们将在 /etc/supervisor/conf.d/
目录下创建一个新的配置文件 my_applications.conf
。
创建配置文件
在 /etc/supervisor/conf.d/
目录下创建并编辑 my_applications.conf
文件:
sudo nano /etc/supervisor/conf.d/my_applications.conf
添加程序配置
将以下内容添加到 my_applications.conf
文件中:
[program:bg_data_filter_service]
command=/data/DTC/L8P0/PV/bin/NewBgDataFilterService
directory=/data/DTC/L8P0/PV/bin
autostart=true
autorestart=true
startsecs=5
stderr_logfile=/var/log/supervisor/bg_data_filter_service_err.log
stdout_logfile=/var/log/supervisor/bg_data_filter_service_out.log
[program:cluster_service]
command=/data/DTC/L8P0/PV/bin/ClusterService
directory=/data/DTC/L8P0/PV/bin
autostart=true
autorestart=true
startsecs=5
stderr_logfile=/var/log/supervisor/cluster_service_err.log
stdout_logfile=/var/log/supervisor/cluster_service_out.log
[program:track_service]
command=/data/DTC/L8P0/PV/bin/TrackService
directory=/data/DTC/L8P0/PV/bin
autostart=true
autorestart=true
startsecs=5
stderr_logfile=/var/log/supervisor/track_service_err.log
stdout_logfile=/var/log/supervisor/track_service_out.log
[program:object_info_process_service]
command=/data/DTC/L8P0/PV/bin/ObjectInfoProcessService
directory=/data/DTC/L8P0/PV/bin
autostart=true
autorestart=true
startsecs=5
stderr_logfile=/var/log/supervisor/object_info_process_service_err.log
stdout_logfile=/var/log/supervisor/object_info_process_service_out.log
[program:io_service]
command=/data/DTC/L8P0/PV/bin/IOServer
directory=/data/DTC/L8P0/PV/bin
autostart=true
autorestart=true
startsecs=5
stderr_logfile=/var/log/supervisor/io_service_err.log
stdout_logfile=/var/log/supervisor/io_service_out.log
[program:io_service_192_168_0_100]
command=/data/DTC/L8P0/PV/bin/IOServer_192_168_0_100
directory=/data/DTC/L8P0/PV/bin
autostart=true
autorestart=true
startsecs=5
stderr_logfile=/var/log/supervisor/io_service_192_168_0_100_err.log
stdout_logfile=/var/log/supervisor/io_service_192_168_0_100_out.log
[program:io_service_192_168_0_101]
command=/data/DTC/L8P0/PV/bin/IOServer_192_168_0_101
directory=/data/DTC/L8P0/PV/bin
autostart=true
autorestart=true
startsecs=5
stderr_logfile=/var/log/supervisor/io_service_192_168_0_101_err.log
stdout_logfile=/var/log/supervisor/io_service_192_168_0_101_out.log
[program:io_service_192_168_0_102]
command=/data/DTC/L8P0/PV/bin/IOServer_192_168_0_102
directory=/data/DTC/L8P0/PV/bin
autostart=true
autorestart=true
startsecs=5
stderr_logfile=/var/log/supervisor/io_service_192_168_0_102_err.log
stdout_logfile=/var/log/supervisor/io_service_192_168_0_102_out.log
[program:io_service_192_168_0_103]
command=/data/DTC/L8P0/PV/bin/IOServer_192_168_0_103
directory=/data/DTC/L8P0/PV/bin
autostart=true
autorestart=true
startsecs=5
stderr_logfile=/var/log/supervisor/io_service_192_168_0_103_err.log
stdout_logfile=/var/log/supervisor/io_service_192_168_0_103_out.log
[program:io_service_192_168_0_104]
command=/data/DTC/L8P0/PV/bin/IOServer_192_168_0_104
directory=/data/DTC/L8P0/PV/bin
autostart=true
autorestart=true
startsecs=5
stderr_logfile=/var/log/supervisor/io_service_192_168_0_104_err.log
stdout_logfile=/var/log/supervisor/io_service_192_168_0_104_out.log
[program:io_service_192_168_0_105]
command=/data/DTC/L8P0/PV/bin/IOServer_192_168_0_105
directory=/data/DTC/L8P0/PV/bin
autostart=true
autorestart=true
startsecs=5
stderr_logfile=/var/log/supervisor/io_service_192_168_0_105_err.log
stdout_logfile=/var/log/supervisor/io_service_192_168_0_105_out.log
[program:io_service_192_168_0_106]
command=/data/DTC/L8P0/PV/bin/IOServer_192_168_0_106
directory=/data/DTC/L8P0/PV/bin
autostart=true
autorestart=true
startsecs=5
stderr_logfile=/var/log/supervisor/io_service_192_168_0_106_err.log
stdout_logfile=/var/log/supervisor/io_service_192_168_0_106_out.log
[program:log_service]
command=/data/DTC/L8P0/PV/bin/LogServer
directory=/data/DTC/L8P0/PV/bin
autostart=true
autorestart=true
startsecs=5
stderr_logfile=/var/log/supervisor/log_service_err.log
stdout_logfile=/var/log/supervisor/log_service_out.log
[program:data_collector_service]
command=/data/DTC/L8P0/PV/bin/DataCollectorService
directory=/data/DTC/L8P0/PV/bin
autostart=true
autorestart=true
startsecs=5
stderr_logfile=/var/log/supervisor/data_collector_service_err.log
stdout_logfile=/var/log/supervisor/data_collector_service_out.log
[program:data_replayer_service]
command=/data/DTC/L8P0/PV/bin/DataReplayerService
directory=/data/DTC/L8P0/PV/bin
autostart=true
autorestart=true
startsecs=5
stderr_logfile=/var/log/supervisor/data_replayer_service_err.log
stdout_logfile=/var/log/supervisor/data_replayer_service_out.log
[program:main_service_192_168_0_100]
command=/data/DTC/L8P0/PV/bin/PluginAppService_192_168_0_100
directory=/data/DTC/L8P0/PV/bin
autostart=true
autorestart=true
startsecs=5
stderr_logfile=/var/log/supervisor/main_service_192_168_0_100_err.log
stdout_logfile=/var/log/supervisor/main_service_192_168_0_100_out.log
[program:main_service_192_168_0_101]
command=/data/DTC/L8P0/PV/bin/PluginAppService_192_168_0_101
directory=/data/DTC/L8P0/PV/bin
autostart=true
autorestart=true
startsecs=5
stderr_logfile=/var/log/supervisor/main_service_192_168_0_101_err.log
stdout_logfile=/var/log/supervisor/main_service_192_168_0_101_out.log
[program:main_service_192_168_0_102]
command=/data/DTC/L8P0/PV/bin/PluginAppService_192_168_0_102
directory=/data/DTC/L8P0/PV/bin
autostart=true
autorestart=true
startsecs=5
stderr_logfile=/var/log/supervisor/main_service_192_168_0_102_err.log
stdout_logfile=/var/log/supervisor/main_service_192_168_0_102_out.log
[program:main_service_192_168_0_103]
command=/data/DTC/L8P0/PV/bin/PluginAppService_192_168_0_103
directory=/data/DTC/L8P0/PV/bin
autostart=true
autorestart=true
startsecs=5
stderr_logfile=/var/log/supervisor/main_service_192_168_0_103_err.log
stdout_logfile=/var/log/supervisor/main_service_192_168_0_103_out.log
[program:main_service_192_168_0_104]
command=/data/DTC/L8P0/PV/bin/PluginAppService_192_168_0_104
directory=/data/DTC/L8P0/PV/bin
autostart=true
autorestart=true
startsecs=5
stderr_logfile=/var/log/supervisor/main_service_192_168_0_104_err.log
stdout_logfile=/var/log/supervisor/main_service_192_168_0_104_out.log
[program:main_service_192_168_0_105]
command=/data/DTC/L8P0/PV/bin/PluginAppService_192_168_0_105
directory=/data/DTC/L8P0/PV/bin
autostart=true
autorestart=true
startsecs=5
stderr_logfile=/var/log/supervisor/main_service_192_168_0_105_err.log
stdout_logfile=/var/log/supervisor/main_service_192_168_0_105_out.log
[program:main_service_192_168_0_106]
command=/data/DTC/L8P0/PV/bin/PluginAppService_192_168_0_106
directory=/data/DTC/L8P0/PV/bin
autostart=true
autorestart=true
startsecs=5
stderr_logfile=/var/log/supervisor/main_service_192_168_0_106_err.log
stdout_logfile=/var/log/supervisor/main_service_192_168_0_106_out.log
启动和管理 Supervisor
重新加载 Supervisor 配置并启动服务:
sudo supervisorctl reread
sudo supervisorctl update
sudo supervisorctl start all
可以使用以下命令检查服务的运行状态:
sudo supervisorctl status
通过以上步骤,你可以在 Ubuntu 18.04 上使用 Supervisor 启动并管理 L8P0 项目的所有 C++/Qt 控制台应用程序。Supervisor 将会自动监控这些应用程序,并在它们崩溃时重新启动它们。