mirror of
https://github.com/openimsdk/open-im-server.git
synced 2026-05-07 10:35:59 +08:00
feat: add start sctips help
Signed-off-by: Xinwei Xiong(cubxxw-openim) <3293172751nss@gmail.com>
This commit is contained in:
+26
-13
@@ -20,26 +20,39 @@ set -o nounset
|
||||
set -o pipefail
|
||||
|
||||
OPENIM_ROOT=$(dirname "${BASH_SOURCE[0]}")/..
|
||||
source "${OPENIM_ROOT}/scripts/lib/init.sh"
|
||||
source "${OPENIM_ROOT}/scripts/install/common.sh"
|
||||
|
||||
set +o errexit
|
||||
openim::golang::check_openim_binaries
|
||||
if [[ $? -ne 0 ]]; then
|
||||
openim::log::error "OpenIM binaries are not found. Please run 'make' to build binaries."
|
||||
openim::log::error "OpenIM binaries are not found. Please run 'make build' to build binaries."
|
||||
${OPENIM_ROOT}/scripts/build_all_service.sh
|
||||
fi
|
||||
set -o errexit
|
||||
|
||||
scripts_to_run=$(openim::golang::start_script_list)
|
||||
echo "You need to start the following scripts in order: ${OPENIM_SERVER_SCRIPTARIES[@]}"
|
||||
openim::log::install_errexit
|
||||
|
||||
for script in $scripts_to_run; do
|
||||
openim::log::info "Executing: $script"
|
||||
"$script"
|
||||
if [ $? -ne 0 ]; then
|
||||
# Print error message and exit
|
||||
openim::log::error "Error executing ${i}. Exiting..."
|
||||
exit -1
|
||||
fi
|
||||
done
|
||||
# Function to execute the scripts.
|
||||
function execute_scripts() {
|
||||
for script_path in "${OPENIM_SERVER_SCRIPT_START_LIST[@]}"; do
|
||||
# Check if the script file exists and is executable.
|
||||
if [[ -x "$script_path" ]]; then
|
||||
openim::log::status "Starting script: ${script_path##*/}" # Log the script name.
|
||||
|
||||
# Execute the script.
|
||||
"$script_path"
|
||||
|
||||
openim::log::success "OpenIM Server has been started successfully!"
|
||||
# Check if the script executed successfully.
|
||||
if [[ $? -eq 0 ]]; then
|
||||
openim::log::info "${script_path##*/} executed successfully."
|
||||
else
|
||||
openim::log::errexit "Error executing ${script_path##*/}."
|
||||
fi
|
||||
else
|
||||
openim::log::errexit "Script ${script_path##*/} is missing or not executable."
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
||||
execute_scripts
|
||||
Reference in New Issue
Block a user