public
|
#
__construct( string $pid_file, integer $mem = null, integer $egid = null, integer $euid = null, integer $killZombieChildsAfter = 10 )
create a CLI daemon (basic class for a CLI daemon), for more see the samples
create a CLI daemon (basic class for a CLI daemon), for more see the samples
Parameters
- $pid_file
- $mem
- $egid
- $euid
- $killZombieChildsAfter
|
public
|
|
protected
|
#
log( $msg, $autolock = true )
|
public
boolean
|
#
isRequestedStop( )
required to check in a child fork the daemon(parent) ask for stop
required to check in a child fork the daemon(parent) ask for stop
Returns
boolean
|
private
shm
&
|
|
public
|
|
public
|
|
public
|
#
stop( integer $forceAfter_sec = 5 )
set stop flag in the Inter-process communication to give childs the chance to stop self before the parent kill his childs, see also the method "isRequestedStop"
set stop flag in the Inter-process communication to give childs the chance to stop self before the parent kill his childs, see also the method "isRequestedStop"
Parameters
- $forceAfter_sec
- null to disable, kill childs after x sec., if they not stops self and run as zombie
|
public
|
#
destroyChilds( integer $pid = null )
kill all child processes or a single child (could be also used to remove crashed childs from IPC)
kill all child processes or a single child (could be also used to remove crashed childs from IPC)
Parameters
- $pid
- to kill a certain child, null for all
|
public
|
|
public
boolean
|
#
fork( string $name )
fork a new process (child), on error a exception will be created do not forget to dispatch and sleep for long-running tasks
fork a new process (child), on error a exception will be created do not forget to dispatch and sleep for long-running tasks
Parameters
- $name
- method or process filename
Returns
boolean
|
public
integer
|
#
getPid( )
return the pid of the parent process
return the pid of the parent process
Returns
integer
|
public
array
|
#
getChild_Pids( )
return an array with all running child pids
return an array with all running child pids
Returns
array
|
public
array
|
#
getChild_Names( )
return an array with all running child names
return an array with all running child names
Returns
array
|
public
integer
|
#
getUptime( )
return the uptime of the daemon
return the uptime of the daemon
Returns
integer
|
public
|
#
lockIPC( )
lock the shared memory for other processes
lock the shared memory for other processes
|
public
|
#
unlockIPC( )
unlock the shared memory for other processes
unlock the shared memory for other processes
|
public
mixed
|
#
getIPC( string $varname, boolean $autolock = true )
get a variable from the SHM (used for Inter-process communication)
get a variable from the SHM (used for Inter-process communication)
Parameters
- $varname
- $autolock
- automatic lock/unlock the shared memory for other processes
Returns
mixed
|
public
boolean
|
#
setIPC( string $varname, mixed $value, boolean $autolock = true )
set a variable to the SHM, if the memory is not unlimited and to small, a exception will be created (used for Inter-process communication)
set a variable to the SHM, if the memory is not unlimited and to small, a exception will be created (used for Inter-process communication)
Parameters
- $varname
- $value
- $autolock
- automatic lock/unlock the shared memory for other processes
Returns
boolean
|