mirror of
https://github.com/openimsdk/open-im-server.git
synced 2026-05-01 07:35:58 +08:00
feat: option scripts and docs
Signed-off-by: Xinwei Xiong(cubxxw-openim) <3293172751nss@gmail.com>
This commit is contained in:
@@ -16,20 +16,15 @@
|
||||
#fixme This scripts is the total startup scripts
|
||||
#fixme The full name of the shell scripts that needs to be started is placed in the need_to_start_server_shell array
|
||||
|
||||
#Include shell font styles and some basic information
|
||||
SCRIPTS_ROOT=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)
|
||||
OPENIM_ROOT=$(dirname "${BASH_SOURCE[0]}")/..
|
||||
set -o errexit
|
||||
set -o nounset
|
||||
set -o pipefail
|
||||
|
||||
#Include shell font styles and some basic information
|
||||
source $SCRIPTS_ROOT/lib/init.sh
|
||||
source $SCRIPTS_ROOT/path_info.sh
|
||||
OPENIM_ROOT=$(dirname "${BASH_SOURCE[0]}")/..
|
||||
source "${OPENIM_ROOT}/scripts/lib/init.sh"
|
||||
|
||||
cd $SCRIPTS_ROOT
|
||||
|
||||
echo -e "${YELLOW_PREFIX}=======>SCRIPTS_ROOT=$SCRIPTS_ROOT${COLOR_SUFFIX}"
|
||||
echo -e "${YELLOW_PREFIX}=======>OPENIM_ROOT=$OPENIM_ROOT${COLOR_SUFFIX}"
|
||||
echo -e "${YELLOW_PREFIX}=======>pwd=$PWD${COLOR_SUFFIX}"
|
||||
|
||||
need_to_start_server_shell=(
|
||||
"start_rpc_service.sh"
|
||||
"msg_gateway_start.sh"
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# Copyright © 2023 OpenIM. All rights reserved.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
@@ -18,9 +17,9 @@
|
||||
# The command compiles all Makefile configs.
|
||||
# Args:
|
||||
# WHAT: Directory names to build. If any of these directories has a 'main'
|
||||
# package, the build will produce executable files under $(OUT_DIR)/go/bin.
|
||||
# package, the build will produce executable files under $(OUT_DIR)/bin/platforms OR $(OUT_DIR)/bin—tools/platforms.
|
||||
# If not specified, "everything" will be built.
|
||||
# Usage: `hack/build-go.sh`.
|
||||
# Usage: `scripts/build_all_server.sh`.
|
||||
# Example: `hack/build-go.sh WHAT=cmd/kubelet`.
|
||||
|
||||
set -o errexit
|
||||
@@ -30,21 +29,6 @@ set -o pipefail
|
||||
OPENIM_ROOT=$(dirname "${BASH_SOURCE[0]}")/..
|
||||
source "${OPENIM_ROOT}/scripts/lib/init.sh"
|
||||
|
||||
source $SCRIPTS_ROOT/lib/init.sh
|
||||
|
||||
bin_dir="$BIN_DIR"
|
||||
logs_dir="$OPENIM_ROOT/logs"
|
||||
|
||||
echo "==> bin_dir=$bin_dir"
|
||||
echo "==> logs_dir=$logs_dir"
|
||||
|
||||
# Automatically created when there is no bin, logs folder
|
||||
if [ ! -d $logs_dir ]; then
|
||||
mkdir -p $logs_dir
|
||||
fi
|
||||
|
||||
cd $OPENIM_ROOT
|
||||
|
||||
# CPU core number
|
||||
# Check the system type
|
||||
system_type=$(uname)
|
||||
@@ -61,47 +45,30 @@ else
|
||||
fi
|
||||
echo -e "${GREEN_PREFIX}======> cpu_count=$cpu_count${COLOR_SUFFIX}"
|
||||
|
||||
# Count the number of concurrent compilations (half the number of cpus)
|
||||
openim::log::status "Building OpenIM, Parallel compilation compile=$cpu_count"
|
||||
compile_count=$((cpu_count / 2))
|
||||
|
||||
# Execute 'make build' run the make command for concurrent compilation
|
||||
make -j$compile_count build
|
||||
|
||||
if [ $? -ne 0 ]; then
|
||||
echo "make build Error, script exits"
|
||||
exit 1
|
||||
# For help output
|
||||
ARGHELP=""
|
||||
if [[ "$#" -gt 0 ]]; then
|
||||
ARGHELP="'$*'"
|
||||
fi
|
||||
|
||||
openim::util::gen_os_arch
|
||||
openim::color::echo $COLOR_CYAN "NOTE: $0 has been replaced by 'make multiarch' or 'make build'"
|
||||
echo
|
||||
echo "The equivalent of this invocation is: "
|
||||
echo " make build ${ARGHELP}"
|
||||
echo
|
||||
echo " Example: "
|
||||
echo " Print a single binary:"
|
||||
echo " make build BINS=openim-api"
|
||||
echo " Print : Enable debugging and logging"
|
||||
echo " make build BINS=openim-api V=1 DEBUG=1"
|
||||
echo
|
||||
make --no-print-directory -C "${OPENIM_ROOT}" -j$compile_count build "$*"
|
||||
|
||||
# Determine if all scripts were successfully built
|
||||
BUILD_SUCCESS=true
|
||||
FAILED_SCRIPTS=()
|
||||
|
||||
for binary in $(find _output/bin/platforms/$REPO_DIR -type f); do
|
||||
if [[ ! -x $binary ]]; then
|
||||
FAILED_SCRIPTS+=("$binary")
|
||||
BUILD_SUCCESS=false
|
||||
fi
|
||||
done
|
||||
|
||||
echo -e " "
|
||||
|
||||
echo -e "${BOLD_PREFIX}=====================> Build Results <=====================${COLOR_SUFFIX}"
|
||||
|
||||
echo -e " "
|
||||
|
||||
if [[ "$BUILD_SUCCESS" == true ]]; then
|
||||
echo -e "${GREEN_PREFIX}All binaries built successfully.${COLOR_SUFFIX}"
|
||||
if [ $? -eq 0 ]; then
|
||||
openim::log::success "all service build success, run 'make start' or './scripts/start_all.sh'"
|
||||
else
|
||||
echo -e "${RED_PREFIX}Some binary builds failed. Please check the following binary files:${COLOR_SUFFIX}"
|
||||
for script in "${FAILED_SCRIPTS[@]}"; do
|
||||
echo -e "${RED_PREFIX}$script${COLOR_SUFFIX}"
|
||||
done
|
||||
openim::log::error "make build Error, script exits"
|
||||
fi
|
||||
|
||||
echo -e " "
|
||||
|
||||
echo -e "${BOLD_PREFIX}============================================================${COLOR_SUFFIX}"
|
||||
|
||||
echo -e " "
|
||||
|
||||
Executable
+243
@@ -0,0 +1,243 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# Usage Instructions: https://git.k8s.io/community/contributors/devel/sig-release/cherry-picks.md
|
||||
|
||||
# Checkout a PR from GitHub. (Yes, this is sitting in a Git tree. How
|
||||
# meta.) Assumes you care about pulls from remote "upstream" and
|
||||
# checks them out to a branch named:
|
||||
# automated-cherry-pick-of-<pr>-<target branch>-<timestamp>
|
||||
|
||||
set -o errexit
|
||||
set -o nounset
|
||||
set -o pipefail
|
||||
|
||||
REPO_ROOT="$(git rev-parse --show-toplevel)"
|
||||
declare -r REPO_ROOT
|
||||
cd "${REPO_ROOT}"
|
||||
|
||||
STARTINGBRANCH=$(git symbolic-ref --short HEAD)
|
||||
declare -r STARTINGBRANCH
|
||||
declare -r REBASEMAGIC="${REPO_ROOT}/.git/rebase-apply"
|
||||
DRY_RUN=${DRY_RUN:-""}
|
||||
REGENERATE_DOCS=${REGENERATE_DOCS:-""}
|
||||
UPSTREAM_REMOTE=${UPSTREAM_REMOTE:-upstream}
|
||||
FORK_REMOTE=${FORK_REMOTE:-origin}
|
||||
MAIN_REPO_ORG=${MAIN_REPO_ORG:-$(git remote get-url "$UPSTREAM_REMOTE" | awk '{gsub(/http[s]:\/\/|git@/,"")}1' | awk -F'[@:./]' 'NR==1{print $3}')}
|
||||
MAIN_REPO_NAME=${MAIN_REPO_NAME:-$(git remote get-url "$UPSTREAM_REMOTE" | awk '{gsub(/http[s]:\/\/|git@/,"")}1' | awk -F'[@:./]' 'NR==1{print $4}')}
|
||||
|
||||
if [[ -z ${GITHUB_USER:-} ]]; then
|
||||
echo "Please export GITHUB_USER=<your-user> (or GH organization, if that's where your fork lives)"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if ! command -v gh > /dev/null; then
|
||||
echo "Can't find 'gh' tool in PATH, please install from https://github.com/cli/cli"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [[ "$#" -lt 2 ]]; then
|
||||
echo "${0} <remote branch> <pr-number>...: cherry pick one or more <pr> onto <remote branch> and leave instructions for proposing pull request"
|
||||
echo
|
||||
echo " Checks out <remote branch> and handles the cherry-pick of <pr> (possibly multiple) for you."
|
||||
echo " Examples:"
|
||||
echo " $0 upstream/release-3.14 12345 # Cherry-picks PR 12345 onto upstream/release-3.14 and proposes that as a PR."
|
||||
echo " $0 upstream/release-3.14 12345 56789 # Cherry-picks PR 12345, then 56789 and proposes the combination as a single PR."
|
||||
echo
|
||||
echo " Set the DRY_RUN environment var to skip git push and creating PR."
|
||||
echo " This is useful for creating patches to a release branch without making a PR."
|
||||
echo " When DRY_RUN is set the script will leave you in a branch containing the commits you cherry-picked."
|
||||
echo
|
||||
echo " Set the REGENERATE_DOCS environment var to regenerate documentation for the target branch after picking the specified commits."
|
||||
echo " This is useful when picking commits containing changes to API documentation."
|
||||
echo
|
||||
echo " Set UPSTREAM_REMOTE (default: upstream) and FORK_REMOTE (default: origin)"
|
||||
echo " to override the default remote names to what you have locally."
|
||||
echo
|
||||
echo " For merge process info, see https://git.k8s.io/community/contributors/devel/sig-release/cherry-picks.md"
|
||||
exit 2
|
||||
fi
|
||||
|
||||
# Checks if you are logged in. Will error/bail if you are not.
|
||||
gh auth status
|
||||
|
||||
if git_status=$(git status --porcelain --untracked=no 2>/dev/null) && [[ -n "${git_status}" ]]; then
|
||||
echo "!!! Dirty tree. Clean up and try again."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [[ -e "${REBASEMAGIC}" ]]; then
|
||||
echo "!!! 'git rebase' or 'git am' in progress. Clean up and try again."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
declare -r BRANCH="$1"
|
||||
shift 1
|
||||
declare -r PULLS=( "$@" )
|
||||
|
||||
function join { local IFS="$1"; shift; echo "$*"; }
|
||||
PULLDASH=$(join - "${PULLS[@]/#/#}") # Generates something like "#12345-#56789"
|
||||
declare -r PULLDASH
|
||||
PULLSUBJ=$(join " " "${PULLS[@]/#/#}") # Generates something like "#12345 #56789"
|
||||
declare -r PULLSUBJ
|
||||
|
||||
echo "+++ Updating remotes..."
|
||||
git remote update "${UPSTREAM_REMOTE}" "${FORK_REMOTE}"
|
||||
|
||||
if ! git log -n1 --format=%H "${BRANCH}" >/dev/null 2>&1; then
|
||||
echo "!!! '${BRANCH}' not found. The second argument should be something like ${UPSTREAM_REMOTE}/release-0.21."
|
||||
echo " (In particular, it needs to be a valid, existing remote branch that I can 'git checkout'.)"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
NEWBRANCHREQ="automated-cherry-pick-of-${PULLDASH}" # "Required" portion for tools.
|
||||
declare -r NEWBRANCHREQ
|
||||
NEWBRANCH="$(echo "${NEWBRANCHREQ}-${BRANCH}" | sed 's/\//-/g')"
|
||||
declare -r NEWBRANCH
|
||||
NEWBRANCHUNIQ="${NEWBRANCH}-$(date +%s)"
|
||||
declare -r NEWBRANCHUNIQ
|
||||
echo "+++ Creating local branch ${NEWBRANCHUNIQ}"
|
||||
|
||||
cleanbranch=""
|
||||
gitamcleanup=false
|
||||
function return_to_kansas {
|
||||
if [[ "${gitamcleanup}" == "true" ]]; then
|
||||
echo
|
||||
echo "+++ Aborting in-progress git am."
|
||||
git am --abort >/dev/null 2>&1 || true
|
||||
fi
|
||||
|
||||
# return to the starting branch and delete the PR text file
|
||||
if [[ -z "${DRY_RUN}" ]]; then
|
||||
echo
|
||||
echo "+++ Returning you to the ${STARTINGBRANCH} branch and cleaning up."
|
||||
git checkout -f "${STARTINGBRANCH}" >/dev/null 2>&1 || true
|
||||
if [[ -n "${cleanbranch}" ]]; then
|
||||
git branch -D "${cleanbranch}" >/dev/null 2>&1 || true
|
||||
fi
|
||||
fi
|
||||
}
|
||||
trap return_to_kansas EXIT
|
||||
|
||||
SUBJECTS=()
|
||||
function make-a-pr() {
|
||||
local rel
|
||||
rel="$(basename "${BRANCH}")"
|
||||
echo
|
||||
echo "+++ Creating a pull request on GitHub at ${GITHUB_USER}:${NEWBRANCH}"
|
||||
|
||||
local numandtitle
|
||||
numandtitle=$(printf '%s\n' "${SUBJECTS[@]}")
|
||||
prtext=$(cat <<EOF
|
||||
Cherry pick of ${PULLSUBJ} on ${rel}.
|
||||
|
||||
${numandtitle}
|
||||
|
||||
For details on the cherry pick process, see the [cherry pick requests](https://git.k8s.io/community/contributors/devel/sig-release/cherry-picks.md) page.
|
||||
|
||||
\`\`\`release-note
|
||||
|
||||
\`\`\`
|
||||
EOF
|
||||
)
|
||||
|
||||
gh pr create --title="Automated cherry pick of ${numandtitle}" --body="${prtext}" --head "${GITHUB_USER}:${NEWBRANCH}" --base "${rel}" --repo="${MAIN_REPO_ORG}/${MAIN_REPO_NAME}"
|
||||
}
|
||||
|
||||
git checkout -b "${NEWBRANCHUNIQ}" "${BRANCH}"
|
||||
cleanbranch="${NEWBRANCHUNIQ}"
|
||||
|
||||
gitamcleanup=true
|
||||
for pull in "${PULLS[@]}"; do
|
||||
echo "+++ Downloading patch to /tmp/${pull}.patch (in case you need to do this again)"
|
||||
|
||||
curl -o "/tmp/${pull}.patch" -sSL "https://github.com/${MAIN_REPO_ORG}/${MAIN_REPO_NAME}/pull/${pull}.patch"
|
||||
echo
|
||||
echo "+++ About to attempt cherry pick of PR. To reattempt:"
|
||||
echo " $ git am -3 /tmp/${pull}.patch"
|
||||
echo
|
||||
git am -3 "/tmp/${pull}.patch" || {
|
||||
conflicts=false
|
||||
while unmerged=$(git status --porcelain | grep ^U) && [[ -n ${unmerged} ]] \
|
||||
|| [[ -e "${REBASEMAGIC}" ]]; do
|
||||
conflicts=true # <-- We should have detected conflicts once
|
||||
echo
|
||||
echo "+++ Conflicts detected:"
|
||||
echo
|
||||
(git status --porcelain | grep ^U) || echo "!!! None. Did you git am --continue?"
|
||||
echo
|
||||
echo "+++ Please resolve the conflicts in another window (and remember to 'git add / git am --continue')"
|
||||
read -p "+++ Proceed (anything other than 'y' aborts the cherry-pick)? [y/n] " -r
|
||||
echo
|
||||
if ! [[ "${REPLY}" =~ ^[yY]$ ]]; then
|
||||
echo "Aborting." >&2
|
||||
exit 1
|
||||
fi
|
||||
done
|
||||
|
||||
if [[ "${conflicts}" != "true" ]]; then
|
||||
echo "!!! git am failed, likely because of an in-progress 'git am' or 'git rebase'"
|
||||
exit 1
|
||||
fi
|
||||
}
|
||||
|
||||
# set the subject
|
||||
subject=$(grep -m 1 "^Subject" "/tmp/${pull}.patch" | sed -e 's/Subject: \[PATCH//g' | sed 's/.*] //')
|
||||
SUBJECTS+=("#${pull}: ${subject}")
|
||||
|
||||
# remove the patch file from /tmp
|
||||
rm -f "/tmp/${pull}.patch"
|
||||
done
|
||||
gitamcleanup=false
|
||||
|
||||
# Re-generate docs (if needed)
|
||||
if [[ -n "${REGENERATE_DOCS}" ]]; then
|
||||
echo
|
||||
echo "Regenerating docs..."
|
||||
if ! hack/generate-docs.sh; then
|
||||
echo
|
||||
echo "hack/generate-docs.sh FAILED to complete."
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
|
||||
if [[ -n "${DRY_RUN}" ]]; then
|
||||
echo "!!! Skipping git push and PR creation because you set DRY_RUN."
|
||||
echo "To return to the branch you were in when you invoked this script:"
|
||||
echo
|
||||
echo " git checkout ${STARTINGBRANCH}"
|
||||
echo
|
||||
echo "To delete this branch:"
|
||||
echo
|
||||
echo " git branch -D ${NEWBRANCHUNIQ}"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
if git remote -v | grep ^"${FORK_REMOTE}" | grep "${MAIN_REPO_ORG}/${MAIN_REPO_NAME}.git"; then
|
||||
echo "!!! You have ${FORK_REMOTE} configured as your ${MAIN_REPO_ORG}/${MAIN_REPO_NAME}.git"
|
||||
echo "This isn't normal. Leaving you with push instructions:"
|
||||
echo
|
||||
echo "+++ First manually push the branch this script created:"
|
||||
echo
|
||||
echo " git push REMOTE ${NEWBRANCHUNIQ}:${NEWBRANCH}"
|
||||
echo
|
||||
echo "where REMOTE is your personal fork (maybe ${UPSTREAM_REMOTE}? Consider swapping those.)."
|
||||
echo "OR consider setting UPSTREAM_REMOTE and FORK_REMOTE to different values."
|
||||
echo
|
||||
make-a-pr
|
||||
cleanbranch=""
|
||||
exit 0
|
||||
fi
|
||||
|
||||
echo
|
||||
echo "+++ I'm about to do the following to push to GitHub (and I'm assuming ${FORK_REMOTE} is your personal fork):"
|
||||
echo
|
||||
echo " git push ${FORK_REMOTE} ${NEWBRANCHUNIQ}:${NEWBRANCH}"
|
||||
echo
|
||||
read -p "+++ Proceed (anything other than 'y' aborts the cherry-pick)? [y/n] " -r
|
||||
if ! [[ "${REPLY}" =~ ^[yY]$ ]]; then
|
||||
echo "Aborting." >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
git push "${FORK_REMOTE}" -f "${NEWBRANCHUNIQ}:${NEWBRANCH}"
|
||||
make-a-pr
|
||||
@@ -16,7 +16,7 @@
|
||||
|
||||
#Include shell font styles and some basic information
|
||||
SCRIPTS_ROOT=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)
|
||||
OPENIM_ROOT=$(dirname "${BASH_SOURCE[0]}")/..
|
||||
OPENIM_ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/../.." && pwd -P)"
|
||||
|
||||
#Include shell font styles and some basic information
|
||||
source $SCRIPTS_ROOT/lib/init.sh
|
||||
+62
-2
@@ -39,8 +39,14 @@ COLOR_REVERSE='\033[7m';COLOR_CONCEAL='\033[8m';COLOR_NOBOLD='\033[22m';
|
||||
COLOR_NOUNDER='\033[24m';COLOR_NOBLINK='\033[25m';
|
||||
|
||||
# --- Front color ---
|
||||
COLOR_BLACK='\033[30m';COLOR_RED='\033[31m';COLOR_GREEN='\033[32m';COLOR_YELLOW='\033[33m';
|
||||
COLOR_BLUE='\033[34m';COLOR_MAGENTA='\033[35m';COLOR_CYAN='\033[36m';COLOR_WHITE='\033[37m';
|
||||
COLOR_BLACK='\033[30m';
|
||||
COLOR_RED='\033[31m';
|
||||
COLOR_GREEN='\033[32m';
|
||||
COLOR_YELLOW='\033[33m';
|
||||
COLOR_BLUE='\033[34m';
|
||||
COLOR_MAGENTA='\033[35m';
|
||||
COLOR_CYAN='\033[36m';
|
||||
COLOR_WHITE='\033[37m';
|
||||
|
||||
# --- background color ---
|
||||
COLOR_BBLACK='\033[40m';COLOR_BRED='\033[41m';
|
||||
@@ -89,3 +95,57 @@ openim::color::print_color()
|
||||
dim; blink; nobold; under"
|
||||
echo
|
||||
}
|
||||
|
||||
# test funtion
|
||||
openim::color::test() {
|
||||
echo "Starting the color tests..."
|
||||
|
||||
echo "Testing normal echo without color"
|
||||
openim::color::echo $COLOR_NORMAL "This is a normal text"
|
||||
|
||||
echo "Testing bold echo"
|
||||
openim::color::echo $COLOR_BOLD "This is bold text"
|
||||
|
||||
echo "Testing dim echo"
|
||||
openim::color::echo $COLOR_DIM "This is dim text"
|
||||
|
||||
echo "Testing underlined echo"
|
||||
openim::color::echo $COLOR_UNDER "This is underlined text"
|
||||
|
||||
echo "Testing italic echo"
|
||||
openim::color::echo $COLOR_ITALIC "This is italic text"
|
||||
|
||||
echo "Testing red color"
|
||||
openim::color::echo $COLOR_RED "This is red text"
|
||||
|
||||
echo "Testing green color"
|
||||
openim::color::echo $COLOR_GREEN "This is green text"
|
||||
|
||||
echo "Testing yellow color"
|
||||
openim::color::echo $COLOR_YELLOW "This is yellow text"
|
||||
|
||||
echo "Testing blue color"
|
||||
openim::color::echo $COLOR_BLUE "This is blue text"
|
||||
|
||||
echo "Testing magenta color"
|
||||
openim::color::echo $COLOR_MAGENTA "This is magenta text"
|
||||
|
||||
echo "Testing cyan color"
|
||||
openim::color::echo $COLOR_CYAN "This is cyan text"
|
||||
|
||||
echo "Testing black background"
|
||||
openim::color::echo $COLOR_BBLACK "This is text with black background"
|
||||
|
||||
echo "Testing red background"
|
||||
openim::color::echo $COLOR_BRED "This is text with red background"
|
||||
|
||||
echo "Testing green background"
|
||||
openim::color::echo $COLOR_BGREEN "This is text with green background"
|
||||
|
||||
echo "Testing blue background"
|
||||
openim::color::echo $COLOR_BBLUE "This is text with blue background"
|
||||
|
||||
echo "All tests completed!"
|
||||
}
|
||||
|
||||
# openim::color::test
|
||||
|
||||
@@ -27,6 +27,11 @@ fi
|
||||
# Set the log file path
|
||||
log_file="${OPENIM_OUTPUT}/logs/openim_$(date '+%Y%m%d').log"
|
||||
|
||||
if [ ! -f "$log_file" ]; then
|
||||
mkdir ${OPENIM_OUTPUT}/logs
|
||||
touch "$log_file"
|
||||
fi
|
||||
|
||||
# Define the logging function
|
||||
function echo_log() {
|
||||
if $ENABLE_LOGGING; then
|
||||
@@ -200,7 +205,7 @@ openim::log::success()
|
||||
if [[ ${OPENIM_VERBOSE} < ${V} ]]; then
|
||||
return
|
||||
fi
|
||||
echo_log -e "${BRIGHT_GREEN_PREFIX}===> [success] <===${COLOR_SUFFIX}\n=> " "$@"
|
||||
echo_log -e "${BRIGHT_GREEN_PREFIX}[success] ${COLOR_SUFFIX}==> " "$@"
|
||||
}
|
||||
|
||||
function openim::log::test_log() {
|
||||
|
||||
@@ -915,6 +915,11 @@ function openim::util::remove_space() {
|
||||
result=$(echo $value | sed 's/ //g') # 去除空格
|
||||
}
|
||||
|
||||
function openim::util::gencpu() {
|
||||
cpu=$(lscpu | grep -e '^CPU(s):' | awk '{print $2}')
|
||||
echo $cpu
|
||||
}
|
||||
|
||||
function openim::util::gen_os_arch() {
|
||||
# Get the current operating system and architecture
|
||||
OS=$(uname -s | tr '[:upper:]' '[:lower:]')
|
||||
|
||||
+1
-23
@@ -26,10 +26,6 @@ source $SCRIPTS_ROOT/path_info.sh
|
||||
|
||||
cd $SCRIPTS_ROOT
|
||||
|
||||
echo -e "${YELLOW_PREFIX}=======>SCRIPTS_ROOT=$SCRIPTS_ROOT${COLOR_SUFFIX}"
|
||||
echo -e "${YELLOW_PREFIX}=======>OPENIM_ROOT=$OPENIM_ROOT${COLOR_SUFFIX}"
|
||||
echo -e "${YELLOW_PREFIX}=======>pwd=$PWD${COLOR_SUFFIX}"
|
||||
|
||||
if [ ! -d "${OPENIM_ROOT}/_output/bin/platforms" ]; then
|
||||
# exec build_all_service.sh
|
||||
"${SCRIPTS_ROOT}/build_all_service.sh"
|
||||
@@ -46,20 +42,6 @@ if [ ! -d "$logs_dir" ]; then
|
||||
mkdir -p "$logs_dir"
|
||||
fi
|
||||
|
||||
# Print title
|
||||
echo -e "${BOLD_PREFIX}${BLUE_PREFIX}================> OpenIM Server Start${COLOR_SUFFIX}"
|
||||
|
||||
# Get current time
|
||||
time=$(date +"%Y-%m-%d %H:%M:%S")
|
||||
|
||||
# Print section separator
|
||||
echo -e "${PURPLE_PREFIX}==========================================================${COLOR_SUFFIX}"
|
||||
|
||||
# Print server start time
|
||||
echo -e "${BOLD_PREFIX}${CYAN_PREFIX}Server Start Time: ${time}${COLOR_SUFFIX}"
|
||||
|
||||
# Print section separator
|
||||
echo -e "${PURPLE_PREFIX}==========================================================${COLOR_SUFFIX}"
|
||||
|
||||
cd $SCRIPTS_ROOT
|
||||
|
||||
@@ -104,8 +86,4 @@ for i in ${need_to_start_server_shell[*]}; do
|
||||
fi
|
||||
done
|
||||
|
||||
# Print section separator
|
||||
echo -e "${PURPLE_PREFIX}==========================================================${COLOR_SUFFIX}"
|
||||
|
||||
# Print completion message
|
||||
echo -e "${GREEN_PREFIX}${BOLD_PREFIX}OpenIM Server has been started successfully!${COLOR_SUFFIX}"
|
||||
openim::log::success "OpenIM Server has been started successfully!"
|
||||
|
||||
Reference in New Issue
Block a user