Posted By

wnasich on 01/12/11


Tagged

php port listening


Versions (?)

Ensure a PHP CLI process always active


 / Published in: Bash
 

URL: http://forums.cpanel.net/f5/check-php-cli-process-running-184662.html

  1. #! /bin/bash
  2. ###########################################
  3. port_check=`/usr/sbin/lsof -i :[port-number]|wc -l`
  4. ###########################################
  5.  
  6. if [ $port_check -ge "1" ]; then
  7. exit 0
  8. else
  9. pkill -f '/usr/local/bin/php -f /home/path/to/file.php'
  10. /usr/local/bin/php -f /home/path/to/file.php > /dev/null &
  11. fi

Report this snippet  

You need to login to post a comment.