You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Open-IM-Server/script/batch_start_all.sh

61 lines
2.0 KiB

2 years ago
#!/usr/bin/env bash
#fixme This script is the total startup script
#fixme The full name of the shell script that needs to be started is placed in the need_to_start_server_shell array
#fixme Put the shell script name here
need_to_start_server_shell=(
start_rpc_service.sh
msg_gateway_start.sh
push_start.sh
msg_transfer_start.sh
sdk_svr_start.sh
)
time=`date +"%Y-%m-%d %H:%M:%S"`
echo "==========================================================">>../logs/openIM.log 2>&1 &
echo "==========================================================">>../logs/openIM.log 2>&1 &
echo "==========================================================">>../logs/openIM.log 2>&1 &
echo "==========server start time:${time}===========">>../logs/openIM.log 2>&1 &
echo "==========================================================">>../logs/openIM.log 2>&1 &
echo "==========================================================">>../logs/openIM.log 2>&1 &
echo "==========================================================">>../logs/openIM.log 2>&1 &
build_pid_array=()
2 years ago
idx=0
2 years ago
for i in ${need_to_start_server_shell[*]}; do
chmod +x $i
./$i &
build_pid=$!
2 years ago
echo "build_pid " $build_pid
build_pid_array[idx]=$build_pid
let idx=idx+1
2 years ago
done
echo "wait all start finish....."
2 years ago
exit 0
2 years ago
success_num=0
for ((i = 0; i < ${#need_to_start_server_shell[*]}; i++)); do
echo "wait pid: " ${build_pid_array[i]} ${need_to_start_server_shell[$i]}
wait ${build_pid_array[i]}
stat=$?
echo ${build_pid_array[i]} " " $stat
if [ $stat == 0 ]
then
2 years ago
# echo -e "${GREEN_PREFIX}${need_to_start_server_shell[$i]} successfully be built ${COLOR_SUFFIX}\n"
2 years ago
let success_num=$success_num+1
else
2 years ago
#echo -e "${RED_PREFIX}${need_to_start_server_shell[$i]} build failed ${COLOR_SUFFIX}\n"
2 years ago
exit -1
fi
done
echo "success_num" $success_num "service num:" ${#need_to_start_server_shell[*]}
if [ $success_num == ${#need_to_start_server_shell[*]} ]
then
echo -e ${YELLOW_PREFIX}"all services build success"${COLOR_SUFFIX}
fi