Note that there are some explanatory texts on larger screens.

plurals
  1. PORun a php script in background on debian (Apache)
    text
    copied!<p>I'm trying to make a push notification work on my debian vps (apace2, mysql). </p> <p>I use a php script from this tutorial (http://www.raywenderlich.com/3525/apple-push-notification-services-tutorial-part-2).</p> <p>Basically, the script is put in an infintive loop, that check a mysql table for new records every couple of seconds. The tutorial says it should be run as a background process. </p> <pre><code>// This script should be run as a background process on the server. It checks // every few seconds for new messages in the database table push_queue and // sends them to the Apple Push Notification Service. // // Usage: php push.php development &amp; </code></pre> <p>So I have four questions. </p> <ol> <li><p>How do I start the script from the terminal? What should I type? The script location on the server is:</p> <p>/var/www/development_folder/scripts/push2/push.php </p></li> <li><p>How can I kill it if I need to (without having to restart apace)?</p></li> <li><p>Since the push notification is essential, I need a way to check if the script is running. The code (from the tutorial) calls a function is something goes wrong: </p> <pre><code>function fatalError($message) { writeToLog('Exiting with fatal error: ' . $message); exit; } </code></pre></li> </ol> <p>Maybe I can put something in there to restart the script? But It would also be nice to have a cron job or something that check every 5 minute or so if the script is running, and start it if it doens't. </p> <p>4 - Can I make the script automatically start after a apace or mysql restart? If the server crash or something else happens that need a apace restart? </p> <p>Thanks a lot in advance</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload