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