Commit 8e5a796f authored by wentao.suo's avatar wentao.suo

edit rabbitmq sh

parent b8cf76e8
...@@ -9,6 +9,7 @@ cd /home/quant_group/rabbitmq ...@@ -9,6 +9,7 @@ cd /home/quant_group/rabbitmq
touch nohup.out touch nohup.out
echo "Starting RabbitMQ..." echo "Starting RabbitMQ..."
> /tmp/rabbitmq.out
nohup /usr/sbin/rabbitmq-server > /tmp/rabbitmq.out & nohup /usr/sbin/rabbitmq-server > /tmp/rabbitmq.out &
...@@ -31,31 +32,21 @@ do ...@@ -31,31 +32,21 @@ do
--header 'Content-Type: application/json' \ --header 'Content-Type: application/json' \
--data "{\"namespace\": \"$NAMESPACE\",\"job_name\": \"rabbitmq_sync\",\"status\": \"pending\"}" --data "{\"namespace\": \"$NAMESPACE\",\"job_name\": \"rabbitmq_sync\",\"status\": \"pending\"}"
count_wait=1 # wailt rabbitmq start
is_running=0 for ((i=0;;))
until [[ $count_wait -eq 300 ]] || [[ $is_running -eq 1 ]]
do do
let count_wait+=1 num=`grep -n -E 'Server startup complete' /tmp/rabbitmq.out |cut -d ":" -f 1`
echo "count_wait is count_wait" if [ -n "$num" ];then
curl -X GET -H "Authorization: Basic cWE6cWF0ZXN0" "http://localhost:15672/api/definitions"
if [ $? -eq 0 ]
then
echo "rabbitmq is running"
is_running=1 is_running=1
else break
echo "rabbitmq is not running"
sleep 1
fi fi
sleep 10
done done
if [[ $is_running -eq 1 ]] if [[ $is_running -eq 1 ]]
then then
echo "rabbitmq is running!!! start execution sync job" echo "rabbitmq is running!!! start execution sync job"
echo "init rabbit with eos server" echo "init rabbit with eos server"
# echo "get definitions from 172.16.1.231"
# response=$(curl -X GET -H "Authorization: Basic cmFiYml0X2FkbWluOmFiYzEyMzQ=" "http://172.16.1.231:15672/api/definitions")
# curl -X POST -H "Content-Type: application/json" -H "Authorization: Basic cWE6cWF0ZXN0" -d $response "http://rabbitmq:15672/api/definitions"
response=$(curl -X POST -H "Content-Type: application/json" -d "{\"namespace\":\"$NAMESPACE\"}" "http://192.168.6.13/api/etcd/init_env_rabbitmq_config") response=$(curl -X POST -H "Content-Type: application/json" -d "{\"namespace\":\"$NAMESPACE\"}" "http://192.168.6.13/api/etcd/init_env_rabbitmq_config")
echo $response echo $response
else else
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment