PHP code example of graftype / nohup

1. Go to this page and download the library: Download graftype/nohup library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

graftype / nohup example snippets


use graftype\nohup;

$process = Nohup::run('sleep 5');

//...
$process->stop();

use graftype\nohup\Nohup;

$process = Nohup::run('sleep 5');
while ($process->isRunning()) {
    echo '.';
    sleep(1);
}
echo "Done.\n";


use graftype\nohup\Process;

$process = Process::loadFromPid($pid);  
// or
$process = new Process($pid); 

if ($process->isRunning()) {
    $process->stop();
}