Skip to content

takuya/php-atq-wrapper

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

atq/at/atrm command php wrapper

'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();
    }

About

atq/at/atrm command wrapper for php

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages