Skip to content

Instantly share code, notes, and snippets.

@frytg
Created July 4, 2019 08:54
Show Gist options
  • Save frytg/2f666f7f1bb4cef4b3cbf955bddb8f0c to your computer and use it in GitHub Desktop.
Save frytg/2f666f7f1bb4cef4b3cbf955bddb8f0c to your computer and use it in GitHub Desktop.
Unix At

UNIX AT Command

Schedule command in PHP

$job = "echo '/usr/bin/php5 /path/to/file.php " . $IdYouWantToGive . " false > /dev/null 2>&1' | at now + 1 minute 2>&1";
$exec = system($job);

Build queue by cycling through items

$j = 0;
/* ... { */
$job = "echo '/usr/bin/php5 /path/to/file.php " . $IdYouWantToGiveForJob . " false > /dev/null 2>&1' | at now + " . round(($j+1)/3) . " minute 2>&1";
$j++;
/* } */

Delete all entries from queue

atrm $(atq | cut -f1)

Then check completion with atq.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment