client_server_driver.sh.in 501 B

123456789101112131415161718192021222324
  1. #! /bin/bash
  2. # go to server dir to make sure that certificates are successfuly loaded
  3. SERVER_DIR=$(dirname "@SERVER_EXEC_PATH@")
  4. cd $SERVER_DIR
  5. echo "SERVER: @SERVER_EXEC_PATH@ & sleep 0.2"
  6. # start server and detach console
  7. "@SERVER_EXEC_PATH@" &
  8. # give server time to initialize
  9. sleep 0.5
  10. # run client provided in $1
  11. echo "CLIENT: @CLIENT_EXEC_PATH@"
  12. "@CLIENT_EXEC_PATH@"
  13. EXIT_CODE=$?
  14. echo "SERVER PID: $!"
  15. # kill background server process
  16. [[ @SERVER_EXEC_PATH@ ]] && kill $!
  17. exit $EXIT_CODE