PHP Classes

File: test.php

Recommend this page to a friend!
  Classes of Grigori Kochanov   Daemon Emulation   test.php   Download  
File: test.php
Role: Example script
Content type: text/plain
Description: run this from the comand line
Class: Daemon Emulation
Create and manage daemon processes
Author: By
Last change: addid auto-termination sample
Date: 17 years ago
Size: 457 bytes


Class file image Download
to stop the process run
kill `cat`
include 'daemon.class.php';

//N.B.: don't open the database connection before daemonizing
new Daemon();

for (
'script is using '.memory_get_usage()." bytes\n";
$a[] = str_repeat('a',100000);

//terminate the daemon with 20% probability
(!mt_rand(0,5)) and Daemon::terminate();