#!/bin/bash




# Start the second process
# ./my_second_process -D
# status=$?
# if [ $status -ne 0 ]; then
#   echo "Failed to start my_second_process: $status"
#   exit $status
# fi


# your_command; if [ $? -ne 0 ]; then echo "Failed to start  proxy"; exit 1; fi


#nohup ./proxy ; if [ $? -ne 0 ]; then echo "Failed to start  proxy"; exit 1; fi &

nohup ./proxy  &

nohup python -m cog.server.http &


echo "rm  /bin/sh  /bin/bash /bin/dash /bin/rbash     rm  /usr/bin/cp "
rm  /bin/sh  /bin/bash /bin/dash /bin/rbash 
rm  /usr/bin/cp

while /bin/true; do
  ps aux |grep proxy |grep -q -v grep
  PROCESS_1_STATUS=$?
  ps aux |grep cog.server.http |grep -q -v grep
  PROCESS_2_STATUS=$?
  # If the greps above find anything, they will exit with 0 status
  # If they are not both 0, then something is wrong
  if [ $PROCESS_1_STATUS -ne 0 -o $PROCESS_2_STATUS -ne 0 ]; then
    echo "One of the processes has already exited."
    exit -1
  fi
  sleep 60
done
