[Solved] Php script waiting for shell script execution completion


I understand this is more a conceptual question. Two simplest methods that come into mind are:

1) Use a “flag file” that you create from the shell script. When the file exists, it means the script is done. When there’s no file, the script still runs. Or other way around. That’s common method for shell scripts anyway.
For more background info on how to create this from your shell script, see http://www.cyberciti.biz/tips/shell-scripting-bash-how-to-create-empty-temporary-file-quickly.html

From your PHP code, you test for the (non)existence of that file. PHP has a lot of functions for that, eq. look into file_exists ( string $filename ), see http://php.net/manual/en/function.file-exists.php

2) From the shell script, use a URL parameter when you call the php script and from your PHP code, you read the parameter and work with that. PHP has a lot of functions for that (eg. look into $_SERVER['QUERY_STRING']). Some more on using the $_SERVER vars, see http://php.net/manual/en/reserved.variables.server.php

Hope this helps…

solved Php script waiting for shell script execution completion