takuya/php-atq-wrapper

atq/atrm php wrapper class

Installs: 9

Dependents: 0

Suggesters: 0

Security: 0

Stars: 0

Watchers: 1

Forks: 0

Open Issues: 0

pkg:composer/takuya/php-atq-wrapper

1.0 2021-03-05 19:16 UTC

This package is auto-updated.

Last update: 2025-10-06 04:58:20 UTC


README

'atq/at' scheduled job timer command line wrapper.

what is atq

atq/at is pre-installd majaor linux dist. alarm or scheduling timer run once at specified.

https://manpages.debian.org/jessie/at/at.1.en.html

Install

composer require takuya/php-atq-wrapper

Samples

add/show/remove atq job

<?php
    use SystemUtil\AtJobs;
    $at_job = new AtJobs( 'ssh server docker exec ubuntu1604 -- at' );
    $id = $at_job->add( '+30days', 'echo Hello 2','s' );
    $at_job->exists($id);// => true
    $at_job->get_body( $id ); //=> /bin/sh body will be executed.
    $at_job->remove($id); //=> cancel job.

list current queued jobs.

<?php
    use SystemUtil\AtJobs;
    $at_job = new AtJobs( 'ssh server docker exec ubuntu1604 -- at' );
    foreach ($at_job->queue() as $job) {
      $job->id;
      $job->start;
      $job->q;
      $job->user;
      $job->body();
    }

Cancel Jobs

<?php
    use SystemUtil\AtJobs;
    $at_job = new AtJobs( 'ssh server docker exec ubuntu1604 -- at' );
    foreach ($at_job->queue('a') as $job) {
      $job->remove();
    }