Support Fenix as admin tool
[doctor.git] / doctor_tests / admin_tool / fenix / run
1 #!/bin/sh
2 . overcloudrc
3
4 # Start the first process
5 nohup python /fenix/fenix/cmd/engine.py > /var/log/fenix-engine.log&
6 status=$?
7 if [ $status -ne 0 ]; then
8   echo "Failed to start engine.py: $status"
9   exit $status
10 fi
11
12 # Start the second process
13 nohup python /fenix/fenix/cmd/api.py > /var/log/fenix-api.log&
14 status=$?
15 if [ $status -ne 0 ]; then
16   echo "Failed to start api.py: $status"
17   exit $status
18 fi
19
20 echo "started Fenix: engine and api"
21 while sleep 60; do
22   ps aux |grep "cmd/engine.py" |grep -q -v grep
23   PROCESS_1_STATUS=$?
24   ps aux |grep "cmd/api.py" |grep -q -v grep
25   PROCESS_2_STATUS=$?
26   # If the greps above find anything, they exit with 0 status
27   # If they are not both 0, then something is wrong
28   if [ $PROCESS_1_STATUS -ne 0 -o $PROCESS_2_STATUS -ne 0 ]; then
29     echo "One of the processes has already exited."
30     exit 1
31   fi
32 done