I have a PHP script that loops through some urls. The urls are stored in urls.txt, and it needs to call the php script like php urlcheck.php LINE_FROM_urls.txt
When it reaches a set number of processes, I want it to sleep for 5 seconds, like this
COMCHECK=`ps aux | grep -c php`
while [ $COMCHECK -ge 150 ];do
COMCHECK=`ps aux | grep -c php`
echo "Sleeping"
sleep 5
and then I want it to check again. If its -le 150, run the next url etc.
I have no idea how to do this. My Bash is quite limited, and frankly, the language weirds me out.