Ensure a PHP CLI process always active


/ Published in: Bash
Save to your folder(s)



Copy this code and paste it in your 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

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

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.