| » Metadata |
» Status |
|
|
|
| » Description |
System_Daemon turns PHP-CLI scripts into daemons (background processes on Linux).
Some features:
- Support for PEAR's Log package
- Simple syntax
- Methods to determine OS and write startup files (init.d)
- Can run with or without PEAR (PEAR adds more elegance & functionality)
- Default signal handlers, but optionally reroute signals to your own handlers.
- Log levels comply with PEAR_LOG_ levels but are called SYSTEM_DAEMON_LOG_ for (in)dependency reasons
- Set options like max RAM usage
Minimalistic Usage Example:
<?php
require_once "System/Deamon.php";
// Set at least these properties
System_Daemon::$appName = "simple";
System_Daemon::$appDir = dirname(__FILE__);
System_Daemon::log(1, "Daemon not yet summoned. Writing this to STDOUT");
// Spawn Deamon!
System_Daemon::start();
System_Daemon::log(1, "Daemon: 'simple' summoned! Writing this to /var/log/simple.log");
// Your normal PHP code goes here. Only now the code will run in the
// background so you can close your terminal session, and the application
// will still run.
System_Daemon::stop();
?>
|
| » Dependencies |
» Links |
- Linux
- --enable-cli
- --with-pcntl
|
|
| » Timeline |
» Changelog |
-
First Draft: 2008-04-19
- Proposal: 2008-04-28
- Call for Votes: 2008-05-10
- Voting Extended: 2008-05-18
|
|