(接上篇)
打开edgex-launch.sh:#vim edgex-go/bin/edgex-launch.sh,具体如下所示。
#!/bin/bash**
*#
# Copyright (c) 2018
# Mainflux
#
# SPDX-License-Identifier: Apache-2.0
#
**
###
# Launches all EdgeX Go binaries (must be previously built).
#
# Expects that Consul and MongoDB are already installed and running.
#
###
**
*DIR=$PWD
CMD=../cmd
# Kill all edgex - stuff**
*function cleanup {
pkill edgex
}
# disable secret-store integration*
*export EDGEX_SECURITY_SECRET_STORE=false
###*
# Support logging
###
*cd CMD/support-logging
*# Add `* *edgex* *-` prefix on start, so we can find the process family**
*exec -a edgex-support-logging ./support-logging &
cd DIR
###*
# Core Command
###
*cd CMD/core-command
*# Add `* *edgex* *-` prefix on start, so we can find the process family**
*exec -a edgex-core-command ./core-command &
cd DIR
###*
# Core Data
###
*cd CMD/core-data
exec -a edgex-core-data ./core-data &
cd DIR
###*
# Core Meta Data
###
*cd CMD/core-metadata
exec -a edgex-core-metadata ./core-metadata &
cd DIR
###*
# Support Notifications
###
*cd CMD/support-notifications
*# Add `* *edgex* *-` prefix on start, so we can find the process family**
*exec -a edgex-support-notifications ./support-notifications &
cd DIR
###*
# System Management Agent
###
*cd CMD/sys-mgmt-agent
*# Add `* *edgex* *-` prefix on start, so we can find the process family**
*exec -a edgex-sys-mgmt-agent ./sys-mgmt-agent &
cd DIR
# Support Scheduler*
###
*cd CMD/support-scheduler
*# Add `* *edgex* *-` prefix on start, so we can find the process family**
*exec -a edgex-support-scheduler ./support-scheduler &
cd DIR
trap cleanup EXIT
while : ; do sleep 1 ; done
edgex-launch.sh主要做了3件事。
1)通过shell的内置命令exec将EdgeX Foundry的各组件以系统进程的方式运行起来;
2)通过一个while死循环将edgex-launch.sh以前台驻留进程的方式驻留在前台;
3)通过trap命令监听EXIT信号,并在监听到EXIT信号之后调用clean函数杀掉EdgeX Foundry的各组件以系统进程的方式运行起来的进程。
「未完待续……」 点击下方标题可阅读技术文章