Advertisement
Guest User

Untitled

a guest
Jul 16th, 2019
110
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.52 KB | None | 0 0
  1. # UNIX AT Command
  2.  
  3. ## Schedule command in PHP
  4. ```php
  5. $job = "echo '/usr/bin/php5 /path/to/file.php " . $IdYouWantToGive . " false > /dev/null 2>&1' | at now + 1 minute 2>&1";
  6. $exec = system($job);
  7. ```
  8.  
  9. Build queue by cycling through items
  10. ```php
  11. $j = 0;
  12. /* ... { */
  13. $job = "echo '/usr/bin/php5 /path/to/file.php " . $IdYouWantToGiveForJob . " false > /dev/null 2>&1' | at now + " . round(($j+1)/3) . " minute 2>&1";
  14. $j++;
  15. /* } */
  16. ```
  17.  
  18. ## Delete all entries from queue
  19. ```
  20. atrm $(atq | cut -f1)
  21. ```
  22. Then check completion with `atq`.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement