Php script als dienst: Unterschied zwischen den Versionen

Aus metasec wiki
Wechseln zu: Navigation, Suche
 
Zeile 3: Zeile 3:
 
#!/usr/bin/php4 -q
 
#!/usr/bin/php4 -q
 
<?php
 
<?php
/*
 
*      AGI Script for checking dialout permissions
 
*      (c) Lukas Ziaja <lz@metasec.de>
 
*/
 
  
 
set_time_limit(0);
 
set_time_limit(0);

Aktuelle Version vom 19. November 2010, 10:50 Uhr

<?php
#!/usr/bin/php4 -q
<?php

set_time_limit(0);
declare(tick=1);
$pid = pcntl_fork();
if ( $pid == -1 ) {
    die("could not fork");
} elseif ( $pid ) {
    exit();
} else {
    // we are the child!
}

if ( posix_setsid() == -1 )
    die("could not detach form terminal\n");

while ( !$test ) {
    so_something();
    sleep(1);
};

?>
chmod +x script_name.php
./script_name.php