34 $IPaddr =
'127.0.0.1';
39 if (($sock = socket_create(AF_INET, SOCK_STREAM, SOL_TCP)) ===
false) {
40 $ErrorMsg =
"socket_create() failed: reason: " . socket_strerror(socket_last_error()) .
"<br>\n";
45 if ($result ===
false) {
46 $ErrorMsg =
"Connection to the scheduler failed. Is the scheduler running?<br>";
47 $ErrorMsg .=
"socket_connect() failed.\nReason: ($result) " . socket_strerror(socket_last_error($sock)) .
"<br>\n";
64 return socket_read($SchedObj, $MaxSize, PHP_NORMAL_READ);
80 return socket_write($SchedObj, $msg, strlen($msg));
92 socket_close($SchedObj);
124 $address = $SysConf[
'FOSSOLOGY'][
'address'];
125 $port = $SysConf[
'FOSSOLOGY'][
'port'];
134 if (substr($buf, 0, 3) ==
"end") {
137 if (substr($buf, 0, 8) ==
"received") {
144 if (substr($input, 0, 6) !=
"status" && substr($input, 0, 6) !=
"agents") {
148 $output .=
"$buf<br>";
152 $error_msg = socket_strerror(socket_last_error($sock));
157 return empty($error_msg);
183 if (
false === $command_status) {
186 $pattern =
'/job:(\d+) /';
187 preg_match_all($pattern, $status_info, $matches);
189 $job_array = $matches[1];
190 sort($job_array, SORT_NUMERIC);
fo_scheduler_write($SchedObj, $msg)
Write to the scheduler socket.
fo_scheduler_close($SchedObj)
Close the scheduler connection (socket).
fo_communicate_with_scheduler($input, &$output, &$error_msg)
Communicate with scheduler, send commands to the scheduler, then get the output.
fo_scheduler_read($SchedObj, $MaxSize=2048)
Read the scheduler socket.
GetRunnableJobList()
Get runnable job list, the process is below:
fo_scheduler_connect($IPaddr='', $Port='', &$ErrorMsg="")
Connect to the scheduler.
int socket_connect(char *host, char *port)
Create a socket connection.
char * trim(char *ptext)
Trimming whitespace.