feat: sets the absolute path of the script

Signed-off-by: Xinwei Xiong(cubxxw-openim) <3293172751nss@gmail.com>
pull/462/head
Xinwei Xiong(cubxxw-openim) 1 year ago
parent b6e108774a
commit 7426ee0abe

@ -1,9 +1,30 @@
#!/usr/bin/env bash #!/usr/bin/env bash
cd scripts ; set -e
chmod +x *.sh ;
./env_check.sh; # Change directory to the 'scripts' folder
cd .. ; cd scripts
docker-compose up -d;
cd scripts ; # Grant execute permissions to all shell scripts in the 'scripts' folder
chmod +x *.sh
# Run the 'env_check.sh' script for environment checks
./env_check.sh
# Move back to the parent directory
cd ..
# Check if Docker is installed
if ! command -v docker >/dev/null 2>&1; then
echo "Error: Docker is not installed. Please install Docker before running this script."
exit 1
fi
# Start Docker services using docker-compose
docker-compose up -d
# Move back to the 'scripts' folder
cd scripts
# Run the 'docker_check_service.sh' script for Docker service checks
./docker_check_service.sh ./docker_check_service.sh

@ -23,7 +23,7 @@ source "$(dirname "${BASH_SOURCE[0]}")/../scripts.sh"
source "$(dirname "${BASH_SOURCE[0]}")/../scripts/style_info.cfg" \ source "$(dirname "${BASH_SOURCE[0]}")/../scripts/style_info.cfg" \
"$OPENIM_ROOT/scripts/path_info.cfg" "$OPENIM_ROOT/scripts/path_info.cfg"
bin_dir="$OPENIM_ROOT/bin" bin_dir="$BIN_DIR"
logs_dir="$OPENIM_ROOT/logs" logs_dir="$OPENIM_ROOT/logs"
sdk_db_dir="$OPENIM_ROOT/sdk/db/" sdk_db_dir="$OPENIM_ROOT/sdk/db/"

@ -1,3 +1,5 @@
#!/bin/bash
# Copyright © 2023 OpenIM. All rights reserved. # Copyright © 2023 OpenIM. All rights reserved.
# #
# Licensed under the Apache License, Version 2.0 (the "License"); # Licensed under the Apache License, Version 2.0 (the "License");
@ -14,7 +16,6 @@
source ../.env source ../.env
# Check if PASSWORD only contains letters and numbers # Check if PASSWORD only contains letters and numbers
if [[ "$PASSWORD" =~ ^[a-zA-Z0-9]+$ ]] if [[ "$PASSWORD" =~ ^[a-zA-Z0-9]+$ ]]
then then
@ -24,15 +25,11 @@ else
exit exit
fi fi
echo "your user is:$USER" echo "your user is:$USER"
echo "your password is:$PASSWORD" echo "your password is:$PASSWORD"
echo "your minio endPoint is:$MINIO_ENDPOINT" echo "your minio endPoint is:$MINIO_ENDPOINT"
echo "your data dir is $DATA_DIR" echo "your data dir is $DATA_DIR"
#!/bin/bash
# Specify the config file # Specify the config file
config_file='../config/config.yaml' config_file='../config/config.yaml'
@ -57,4 +54,3 @@ sed -i '/minio:/,/endpoint:/s|endpoint: .*|endpoint: '${MINIO_ENDPOINT}'|' $conf
# Replace secret for token # Replace secret for token
sed -i "s/secret: .*/secret: $PASSWORD/" $config_file sed -i "s/secret: .*/secret: $PASSWORD/" $config_file

@ -21,7 +21,7 @@ source $OPENIM_ROOT/scripts/style_info.cfg
source $OPENIM_ROOT/scripts/path_info.cfg source $OPENIM_ROOT/scripts/path_info.cfg
source $OPENIM_ROOT/scripts/function.sh source $OPENIM_ROOT/scripts/function.sh
bin_dir="$OPENIM_ROOT/bin" bin_dir="$BIN_DIR"
logs_dir="$OPENIM_ROOT/logs" logs_dir="$OPENIM_ROOT/logs"
sdk_db_dir="$OPENIM_ROOT/sdk/db/" sdk_db_dir="$OPENIM_ROOT/sdk/db/"

@ -21,7 +21,7 @@ source $OPENIM_ROOT/scripts/style_info.cfg
source $OPENIM_ROOT/scripts/path_info.cfg source $OPENIM_ROOT/scripts/path_info.cfg
source $OPENIM_ROOT/scripts/function.sh source $OPENIM_ROOT/scripts/function.sh
bin_dir="$OPENIM_ROOT/bin" bin_dir="$BIN_DIR"
logs_dir="$OPENIM_ROOT/logs" logs_dir="$OPENIM_ROOT/logs"
sdk_db_dir="$OPENIM_ROOT/sdk/db/" sdk_db_dir="$OPENIM_ROOT/sdk/db/"

@ -2,7 +2,20 @@
architecture=$(uname -m) architecture=$(uname -m)
version=$(uname -s | tr '[:upper:]' '[:lower:]') version=$(uname -s | tr '[:upper:]' '[:lower:]')
OPENIM_ROOT=$(dirname "${BASH_SOURCE[0]}")/.. #Include shell font styles and some basic information
SCRIPTS_ROOT=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)
OPENIM_ROOT=$(dirname "${SCRIPTS_ROOT}")/..
#Include shell font styles and some basic information
source $SCRIPTS_ROOT/style_info.cfg
source $SCRIPTS_ROOT/path_info.cfg
source $SCRIPTS_ROOT/function.sh
cd $SCRIPTS_ROOT
echo -e "${BACKGROUND_YELLOW}=======>SCRIPTS_ROOT=$SCRIPTS_ROOT${COLOR_SUFFIX}"
echo -e "${BACKGROUND_YELLOW}=======>OPENIM_ROOT=$OPENIM_ROOT${COLOR_SUFFIX}"
echo -e "${BACKGROUND_YELLOW}=======>pwd=$PWD${COLOR_SUFFIX}"
# Define the supported architectures and corresponding bin directories # Define the supported architectures and corresponding bin directories
declare -A supported_architectures=( declare -A supported_architectures=(
@ -46,20 +59,20 @@ push_source_root="../cmd/push/"
openim_msgtransfer="openim-rpc-msg_transfer" openim_msgtransfer="openim-rpc-msg_transfer"
msg_transfer_binary_root="$OPENIM_ROOT/$BIN_DIR" msg_transfer_binary_root="$OPENIM_ROOT/$BIN_DIR"
msg_transfer_source_root="../cmd/msgtransfer/" msg_transfer_source_root="$OPENIM_ROOT/cmd/msgtransfer/"
msg_transfer_service_num=4 msg_transfer_service_num=4
cron_task_name="openim-crontask" cron_task_name="openim-crontask"
cron_task_binary_root="$OPENIM_ROOT/$BIN_DIR" cron_task_binary_root="$OPENIM_ROOT/$BIN_DIR"
cron_task_source_root="../cmd/crontask/" cron_task_source_root="$OPENIM_ROOT/cmd/crontask/"
cmd_utils_name="openim_cmd_utils" cmd_utils_name="openim_cmd_utils"
cmd_utils_binary_root="$OPENIM_ROOT/$BIN_DIR" cmd_utils_binary_root="$OPENIM_ROOT/$BIN_DIR"
cmd_utils_source_root="../cmd/cmduitls/" cmd_utils_source_root="$OPENIM_ROOT/cmd/cmduitls/"
# Global configuration file default dir # Global configuration file default dir
config_path="../config/config.yaml" config_path="$OPENIM_ROOT/config/config.yaml"
# servicefile dir path # servicefile dir path
service_source_root=( service_source_root=(

@ -21,7 +21,7 @@ source $OPENIM_ROOT/scripts/style_info.cfg
source $OPENIM_ROOT/scripts/path_info.cfg source $OPENIM_ROOT/scripts/path_info.cfg
source $OPENIM_ROOT/scripts/function.sh source $OPENIM_ROOT/scripts/function.sh
bin_dir="$OPENIM_ROOT/bin" bin_dir="$BIN_DIR"
logs_dir="$OPENIM_ROOT/logs" logs_dir="$OPENIM_ROOT/logs"
sdk_db_dir="$OPENIM_ROOT/sdk/db/" sdk_db_dir="$OPENIM_ROOT/sdk/db/"

@ -17,21 +17,26 @@
#FIXME The full names of the shell scripts that need to be started are placed in the `need_to_start_server_shell` array. #FIXME The full names of the shell scripts that need to be started are placed in the `need_to_start_server_shell` array.
#Include shell font styles and some basic information #Include shell font styles and some basic information
OPENIM_ROOT=$(dirname "${BASH_SOURCE[0]}")/.. SCRIPTS_ROOT=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)
OPENIM_ROOT=$(dirname "${SCRIPTS_ROOT}")/..
#Include shell font styles and some basic information #Include shell font styles and some basic information
source $OPENIM_ROOT/scripts/style_info.cfg source $SCRIPTS_ROOT/style_info.cfg
source $OPENIM_ROOT/scripts/path_info.cfg source $SCRIPTS_ROOT/path_info.cfg
source $OPENIM_ROOT/scripts/function.sh source $SCRIPTS_ROOT/function.sh
bin_dir="$OPENIM_ROOT/bin" cd $SCRIPTS_ROOT
echo -e "${BACKGROUND_YELLOW}=======>SCRIPTS_ROOT=$SCRIPTS_ROOT${COLOR_SUFFIX}"
echo -e "${BACKGROUND_YELLOW}=======>OPENIM_ROOT=$OPENIM_ROOT${COLOR_SUFFIX}"
echo -e "${BACKGROUND_YELLOW}=======>pwd=$PWD${COLOR_SUFFIX}"
bin_dir="$BIN_DIR"
logs_dir="$OPENIM_ROOT/logs" logs_dir="$OPENIM_ROOT/logs"
sdk_db_dir="$OPENIM_ROOT/sdk/db/" sdk_db_dir="$OPENIM_ROOT/sdk/db/"
cd "$OPENIM_ROOT/scripts/"
# Print title # Print title
echo -e "${BOLD_PREFIX}${BLUE_PREFIX}OpenIM Server Start${COLOR_SUFFIX}" echo -e "${BOLD_PREFIX}${BLUE_PREFIX}================> OpenIM Server Start${COLOR_SUFFIX}"
# Get current time # Get current time
time=$(date +"%Y-%m-%d %H:%M:%S") time=$(date +"%Y-%m-%d %H:%M:%S")
@ -45,7 +50,6 @@ echo -e "${BOLD_PREFIX}${CYAN_PREFIX}Server Start Time: ${time}${COLOR_SUFFIX}"
# Print section separator # Print section separator
echo -e "${PURPLE_PREFIX}==========================================================${COLOR_SUFFIX}" echo -e "${PURPLE_PREFIX}==========================================================${COLOR_SUFFIX}"
cd $OPENIM_ROOT/scripts
# FIXME Put the shell script names here # FIXME Put the shell script names here
need_to_start_server_shell=( need_to_start_server_shell=(
start_rpc_service.sh start_rpc_service.sh
@ -55,7 +59,6 @@ need_to_start_server_shell=(
start_cron.sh start_cron.sh
) )
# Loop through the script names and execute them # Loop through the script names and execute them
for i in ${need_to_start_server_shell[*]}; do for i in ${need_to_start_server_shell[*]}; do
chmod +x $i chmod +x $i

@ -21,7 +21,7 @@ source $OPENIM_ROOT/scripts/style_info.cfg
source $OPENIM_ROOT/scripts/path_info.cfg source $OPENIM_ROOT/scripts/path_info.cfg
source $OPENIM_ROOT/scripts/function.sh source $OPENIM_ROOT/scripts/function.sh
bin_dir="$OPENIM_ROOT/bin" bin_dir="$BIN_DIR"
logs_dir="$OPENIM_ROOT/logs" logs_dir="$OPENIM_ROOT/logs"
sdk_db_dir="$OPENIM_ROOT/sdk/db/" sdk_db_dir="$OPENIM_ROOT/sdk/db/"

@ -13,12 +13,20 @@
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
OPENIM_ROOT=$(dirname "${BASH_SOURCE[0]}")/.. #Include shell font styles and some basic information
SCRIPTS_ROOT=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)
OPENIM_ROOT=$(dirname "${SCRIPTS_ROOT}")/..
#Include shell font styles and some basic information #Include shell font styles and some basic information
source $OPENIM_ROOT/scripts/style_info.cfg source $SCRIPTS_ROOT/style_info.cfg
source $OPENIM_ROOT/scripts/path_info.cfg source $SCRIPTS_ROOT/path_info.cfg
source $OPENIM_ROOT/scripts/function.sh source $SCRIPTS_ROOT/function.sh
cd $SCRIPTS_ROOT
echo -e "${BACKGROUND_YELLOW}=======>SCRIPTS_ROOT=$SCRIPTS_ROOT${COLOR_SUFFIX}"
echo -e "${BACKGROUND_YELLOW}=======>OPENIM_ROOT=$OPENIM_ROOT${COLOR_SUFFIX}"
echo -e "${BACKGROUND_YELLOW}=======>pwd=$PWD${COLOR_SUFFIX}"
bin_dir="$BIN_DIR" bin_dir="$BIN_DIR"
logs_dir="$OPENIM_ROOT/logs" logs_dir="$OPENIM_ROOT/logs"

@ -21,7 +21,7 @@ source $OPENIM_ROOT/scripts/style_info.cfg
source $OPENIM_ROOT/scripts/path_info.cfg source $OPENIM_ROOT/scripts/path_info.cfg
source $OPENIM_ROOT/scripts/function.sh source $OPENIM_ROOT/scripts/function.sh
bin_dir="$OPENIM_ROOT/bin" bin_dir="$BIN_DIR"
logs_dir="$OPENIM_ROOT/logs" logs_dir="$OPENIM_ROOT/logs"
sdk_db_dir="$OPENIM_ROOT/sdk/db/" sdk_db_dir="$OPENIM_ROOT/sdk/db/"

Loading…
Cancel
Save