source: trunk/listen.php@ 39

Last change on this file since 39 was 22, checked in by gegorbet, 9 years ago

fix us3 baseon listen.php and status_ex=EXECUTING handling in gridctl.php

File size: 738 bytes
Line 
1<?php
2
3$us3bin = exec( "ls -d ~us3/lims/bin" );
4$us3etc = exec( "ls -d ~us3/lims/etc" );
5include "$us3bin/listen-config.php";
6
7$socket = socket_create( AF_INET, SOCK_DGRAM, SOL_UDP );
8
9// Listen on all interfaces
10if ( ! socket_bind( $socket, 0, $listen_port ) )
11{
12 $msg = "listen bind failed: " . socket_strerror( socket_last_error( $socket ) );
13 write_log( "$self: $msg" );
14 exit();
15};
16
17$handle = fopen( $pipe, "r+" );
18
19$php = "/usr/bin/php";
20
21$cmd = "/usr/bin/nohup $php $us3bin/manage-us3-pipe.php >>$us3etc/manage.log 2>&1 </dev/null &";
22
23exec( $cmd );
24
25do
26{
27 socket_recvfrom( $socket, $buf, 200, 0, $from, $port );
28 fwrite( $handle, $buf . chr( 0 ) );
29
30} while ( trim( $buf ) != "Stop listen" );
31
32socket_close( $socket );
33?>
Note: See TracBrowser for help on using the repository browser.