PHP code example of kivagant / runonce

1. Go to this page and download the library: Download kivagant/runonce 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/ */

    

kivagant / runonce example snippets


./vendor/bin/runonce sleep 10 && echo 'first launch' || echo 'already running';
> first launch

./vendor/bin/runonce sleep 20 && echo 'first launch' || echo 'already running';
> first launch

./vendor/bin/runonce sleep 10 && echo 'first launch' || echo 'already running';
> already running

./vendor/bin/runonce php ./cron.php -v=\"some string\" && echo 'first launch' || echo 'already running';
> first launch

./vendor/bin/runonce -v php ./cron.php -v=\"some string\" && echo 'first launch' || echo 'already running';
> Command was already executed with PID  20438
> already running