How can I start and stop a background task on travis?
问题 I need to start and restart a custom web server on travis. Starting in background is fine using a sub-shell ( .travis.yml ): - if [ "$TEST_ADAPTER" = "HTTP" ]; then (vendor/bin/httpd.php start &); fi To stop/kill the process again I'm trying to get its PID and then kill it: - if [ "$TEST_ADAPTER" = "HTTP" ]; then (vendor/bin/httpd.php start &) && SERVER_PID=$!; fi - ... - if [ "$TEST_ADAPTER" = "HTTP" ]; then kill -9 $SERVER_PID && ...; fi However, SERVER_PID is empty. What is the right way