Unfortunately, I can't get rid of exec call because the whole idea is that start.cgi is a client programm which must check if server is running and start it if it's not. I can't get rid of location also because start.cgi must then redirect client to a page which will connect to the server via sockets.