@ -45,24 +45,23 @@ for ((i = 0; i < ${#service_filename[*]}; i++)); do
if [ $( eval ${ count } ) -gt 0 ] ; then
if [ $( eval ${ count } ) -gt 0 ] ; then
pid = " ${ service_name } | awk '{print \$2}' "
pid = " ${ service_name } | awk '{print \$2}' "
echo -e " ${ SKY_BLUE_PREFIX } ${ service_filename [ $i ] } service has been started,pid: $( eval $pid ) $COLOR_SUFFIX "
echo " ${ service_filename [ $i ] } service has been started,pid: $( eval $pid ) "
echo -e " ${ SKY_BLUE_PREFIX } K illing the service ${ service_filename [ $i ] } pid: $( eval $pid ) ${ COLOR_SUFFIX } "
echo " k illing the service ${ service_filename [ $i ] } pid: $( eval $pid ) "
#kill the service that existed
#kill the service that existed
kill -9 $( eval $pid )
kill -9 $( eval $pid )
sleep 0.5
sleep 0.5
fi
fi
cd ../bin && echo -e " ${ SKY_BLUE_PREFIX } ${ service_filename [ $i ] } service is starting ${ COLOR_SUFFIX } "
cd ../bin
#Get the rpc port in the configuration file
#Get the rpc port in the configuration file
portList = $( cat $config_path | grep ${ service_port_name [ $i ] } | awk -F '[:]' '{print $NF}' )
portList = $( cat $config_path | grep ${ service_port_name [ $i ] } | awk -F '[:]' '{print $NF}' )
list_to_string ${ portList }
list_to_string ${ portList }
#Start related rpc services based on the number of ports
#Start related rpc services based on the number of ports
for j in ${ ports_array } ; do
for j in ${ ports_array } ; do
echo -e " ${ SKY_BLUE_PREFIX } ${ service_filename [ $i ] } Service is starting,port number: $j $COLOR_SUFFIX "
#Start the service in the background
#Start the service in the background
# ./${service_filename[$i]} -port $j &
# ./${service_filename[$i]} -port $j &
nohup ./${ service_filename [ $i ] } -port $j >>../logs/openIM.log 2>& 1 &
nohup ./${ service_filename [ $i ] } -port $j >>../logs/openIM.log 2>& 1 &
sleep 1
sleep 1
pid = " netstat -ntlp|grep $j |awk '{printf \$7}'|cut -d/ -f1 "
pid = " netstat -ntlp|grep $j |awk '{printf \$7}'|cut -d/ -f1 "
echo -e " ${ RED_PREFIX} ${ service_filename [ $i ] } Service is started ,port number:$j pid: $( eval $pid ) $COLOR_SUFFIX "
echo -e " ${ GREEN_PREFIX} ${ service_filename [ $i ] } start success ,port number:$j pid: $( eval $pid ) $COLOR_SUFFIX "
done
done
done
done