Wait until a process ends in PHP
php wait for exec to finish
PHP exec will wait until the execution of the called program is finished,
before processing the next line,
unless you use & at the end of the string to run the program in background.
Wait for PHP Process to finish?
#!/bin/bash
timestamp() {
date +"%T"
}
pushd 'httpdocs/DIR1/DIR2';
file="Lock3.key"
if [ -f "$file" ]
then
echo "$file found, Session is already in progress" $(date)
else
echo "$file was not found, Its safe to start the script" $(date)
echo "Running Ebay Stock Only Script" $(date)
#Its possible to double check if the script is running by checking memory.
#ps aux | grep "php Cron-Run.php" (Not safe)
php Cron-Run.php > Output.log
echo "Finished Running Script, Lock file is deleted by PHP, Now exiting" $(date)
fi
exit