Crunz is a framework-agnostic package to schedule periodic tasks (cron jobs) in PHP using a fluent API.

Related tags

Task Runners crunz
Overview

Crunz

Install a cron job once and for all, manage the rest from the code.

Crunz is a framework-agnostic package to schedule periodic tasks (cron jobs) in PHP using a fluent API.

Crunz is capable of executing any kind of executable command as well as PHP closures.

Version Packagist Packagist

Version Supported PHP versions
dev v3 (v3.2-dev) 7.4+
stable v3 (v3.1.0) 7.4+
stable v2 (v2.3.1) 7.2+
stable v1 (v1.12.4) 5.6-7.0+

Roadmap

Version Release date Active support until Bug support until Status
v1.x April 2016 April 2019 April 2020 End of life
v2.x April 2019 April 2021 April 2022 Bug support
v3.x April 2021 April 2023 April 2024 Active support

Installation

To install it:

composer require lavary/crunz

If the installation is successful, a command-line utility named crunz is symlinked to the vendor/bin directory of your project.

How It Works?

The idea is very simple: instead of installing cron jobs in a crontab file, we define them in one or several PHP files, by using the Crunz interface.

Here's a basic example:


// tasks/backupTasks.php

use Crunz\Schedule;

$schedule = new Schedule();
$task = $schedule->run('cp project project-bk');       
$task->daily();

return $schedule;

To run the tasks, you only need to install an ordinary cron job (a crontab entry) which runs every minute, and delegates the responsibility to Crunz' event runner:

* * * * * cd /project && vendor/bin/crunz schedule:run

The command schedule:run is responsible for collecting all the PHP task files and run the tasks which are due.

Task Files

Task files resemble crontab files. Just like crontab files they can contain one or more tasks.

Normally we create our task files in the tasks/ directory within the project's root directory.

By default, Crunz assumes all the task files reside in the tasks/ directory within the project's root directory.

There are two ways to specify the source directory: 1) Configuration file 2) As a parameter to the event runner command.

We can explicitly set the source path by passing it to the event runner as a parameter:

* * * * * cd /project && vendor/bin/crunz schedule:run /path/to/tasks/directory

Creating a Simple Task

In the terminal, change the directory to your project's root directory and run the following commands:

mkdir tasks && cd tasks
nano GeneralTasks.php

Then, add a task as below:


// tasks/FirstTasks.php

use Crunz\Schedule;

$schedule = new Schedule();

$task = $schedule->run('cp project project-bk'); 
$task
    ->daily()
    ->description('Create a backup of the project directory.');

// ...

// IMPORTANT: You must return the schedule object
return $schedule; 

There are some conventions for creating a task file, which you need to follow. First of all, the filename should end with Tasks.php unless we change this via the configuration settings.

In addition to that, we must return the instance of Schedule class at the end of each file, otherwise, all the tasks inside the file will be skipped by the event runner.

Since Crunz scans the tasks directory recursively, we can either put all the tasks in one file or across different files (or directories) based on their usage. This behavior helps us have a well organized tasks directory.

The Command

We can run any command or script by using run(). This method accepts two arguments: the command to be executed, and the command options (as an associative array) if there's any.

Normal Command or Script



use Crunz\Schedule;

$schedule = new Schedule();
$task = $schedule->run(PHP_BINARY . ' backup.php', ['--destination' => 'path/to/destination']);
$task
    ->everyMinute()
    ->description('Copying the project directory');

return $schedule;

In the above example, --destination is an option supported by backup.php script.

Closures

We can also write to a closure instead of a command:



use Crunz\Schedule;

$schedule = new Schedule();

$x = 12;
$task = $schedule->run(function() use ($x) { 
   // Do some cool stuff in here 
});

$task
    ->everyMinute()
    ->description('Copying the project directory');

return $schedule;

Frequency of Execution

There are a variety of ways to specify when and how often a task should run. We can combine these methods together to get our desired frequencies.

Units of Time

There are a group of methods which specify a unit of time (bigger than minute) as frequency. They usually end with ly suffix, as in hourly(), daily(), weekly, monthly(), quarterly(), and yearly .

All the events scheduled with this set of methods happen at the beginning of that time unit. For example weekly() will run the event on Sundays, and monthly() will run on the first day of each month.

The task below will run daily at midnight (start of the daily time period).


// ...
$task = $schedule->run(PHP_BINARY . ' backup.php');    
$task->daily();
// ...

Here's another one, which runs on the first day of each month.


// ...
$task = $schedule->run(PHP_BINARY . ' email.php');
$task->monthly();
// ...

Running Events at Certain Times

To schedule a one-off tasks, you may use on() method like this:


// ...
$task = $schedule->run(PHP_BINARY . ' email.php'); 
$task->on('13:30 2016-03-01');
// ...

The above task will run on the first of march 2016 at 01:30 pm.

On() accepts any date format parsed by PHP's strtotime function.

To specify the time of a task we use at() method:


// ...
$task = $schedule->run(PHP_BINARY . ' email.php'); 
$task
    ->daily()
    ->at('13:30');
// ...

If we only pass a time to the on() method, it will have the same effect as using at()


// ...
$task = $schedule->run(PHP_BINARY . ' email.php');   
$task
    ->daily()
    ->on('13:30');
         
// is the sames as
$task = $schedule->run(PHP_BINARY . ' email.php');       
$task
    ->daily()
    ->at('13:30');
// ...

We can combine the "Unit of Time" methods eg. daily(), monthly() with the at() or on() constraint in a single statement if we wish.

The following task will be run every hour at the 15th minute


// ...
$task = $schedule->run(PHP_BINARY . ' feedmecookie.php'); 
$task
    ->hourlyAt('15');
// ...

hourlyOn('15') could have been used instead of hourlyAt('15') with the same result

The following task will be run Monday at 13:30


// ...
$task = $schedule->run(PHP_BINARY . ' startofwork.php'); 
$task
    ->weeklyOn(1,'13:30');
// ...

Sunday is considered day 0 of the week.

If we wished for the task to run on Tuesday (day 2 of the week) at 09:00 we would have used:


// ...
$task = $schedule->run(PHP_BINARY . ' startofwork.php'); 
$task
    ->weeklyOn(2,'09:00');
// ...

Task Life Time

In a crontab entry, we can not easily specify a task's lifetime (the period of time when the task is active). However, it's been made easy in Crunz:


//
$task = $schedule->run(PHP_BINARY . ' email.php');
$task
    ->everyFiveMinutes()
    ->from('12:30 2016-03-04')
    ->to('04:55 2016-03-10');
 //       

Or alternatively we can use the between() method to accomplish the same result:


//
$task = $schedule->run(PHP_BINARY . ' email.php');
$task
    ->everyFiveMinutes()
    ->between('12:30 2016-03-04', '04:55 2016-03-10');

 //       

If we don't specify the date portion, the task will be active every day but only within the specified duration:


//
$task = $schedule->run(PHP_BINARY . ' email.php');
$task
     ->everyFiveMinutes()
     ->between('12:30', '04:55');

 //       

The above task runs every five minutes between 12:30 pm and 4:55 pm every day.

An example of restricting a task from running only during a certain range of minutes each hour can be achieved as follows:


//

$hour = date('H');
$startminute = $hour.':05';
$endminute = $hour.':15';

$task = $schedule->run(PHP_BINARY . ' email.php');
$task
     ->hourly()
     ->between($startminute, $endminute);

 //       

The above task runs every hour between minutes 5 to 15

Weekdays

Crunz also provides a set of methods which specify a certain day in the week.

  • mondays()
  • tuesdays()
  • ...
  • sundays()
  • weekedays()
  • weekends()

These methods have been designed to be used as a constraint and should not be used alone. The reason is that weekday methods just modify the Day of Week field of a cron job expression.

Consider the following example:


// Cron equivalent:  * * * * 1
$task = $schedule->run(PHP_BINARY . ' startofwork.php');
$task->mondays();

At first glance, the task seems to run every Monday, but since it only modifies the "day of week" field of the cron job expression, the task runs every minute on Mondays.

This is the correct way of using weekday methods:


// ...
$task = $schedule->run(PHP_BINARY . ' startofwork.php');
$task    
    ->mondays()
    ->at('13:30');

// ...

(An easier to read alternative with a similar result ->weeklyOn(0,'13:30') to that shown in a previously example above)

The Classic Way

We can also do the scheduling the old way, just like we do in a crontab file:



$task = $schedule->run(PHP_BINARY . ' email.php');
$task->cron('30 12 * 5-6,9 Mon,Fri');

Setting Individual Fields

Crunz's methods are not limited to the ready-made methods explained. We can also set individual fields to compose custom frequencies similar to how a classic crontab would composed them. These methods either accept an array of values, or list arguments separated by commas:


// ...
$task = $schedule->run(PHP_BINARY . ' email.php');
$task       
    ->minute(['1-30', 45, 55])
    ->hour('1-5', 7, 8)
    ->dayOfMonth(12, 15)
    ->month(1);

Or:


// ...
$task = $schedule->run(PHP_BINARY . ' email.php');
$task
    ->minute('30')
    ->hour('13')
    ->month([1,2])
    ->dayofWeek('Mon', 'Fri', 'Sat');

// ...

Based on our use cases, we can choose and combine the proper set of methods, which are easier to use.

Running Conditions

Another thing that we cannot do very easily in a traditional crontab file is to make conditions for running the tasks. This has been made easy by when() and skip() methods.

Consider the following code:


//
$task = $schedule->run(PHP_BINARY . ' email.php');
$task
    ->everyFiveMinutes()
    ->between('12:30 2016-03-04', '04:55 2016-03-10')
    ->when(function() {
        if ((bool) (time() % 2)) {
            return true;
        }
        
        return false;
    });

Method when() accepts a callback, which must return TRUE for the task to run. This is really useful when we need to check our resources before performing a resource-hungry task.

We can also skip a task under certain conditions, by using skip() method. If the passed callback returns TRUE, the task will be skipped.


//
$task = $schedule->run(PHP_BINARY . ' email.php');
$task
    ->everyFiveMinutes()
    ->between('12:30 2016-03-04', '04:55 2016-03-10')
    ->skip(function() {
        if ((bool) (time() % 2)) {
            return true;
        }
        
        return false;  
    });

 //       

We can use these methods several times for a single task. They are evaluated sequentially.

Changing Directories

You can use the in() method to change directory before running a command:



// ...

$task = $schedule->run('./deploy.sh');
$task
    ->in('/home')
    ->weekly()
    ->sundays()
    ->at('12:30')
    ->appendOutputTo('/var/log/backup.log');

// ...

return $schedule;

Parallelism and the Locking Mechanism

Crunz runs the scheduled events in parallel (in separate processes), so all the events which have the same frequency of execution, will run at the same time asynchronously. To achieve this, Crunz utilizes the symfony/Process library for running the tasks in sub-processes.

If the execution of a task lasts until the next interval or even beyond that, we say that the same instances of a task are overlapping. In some cases, this is a not a problem. But there are times, when these tasks are modifying database data or files, which might cause unexpected behaviors, or even data loss.

To prevent critical tasks from overlapping each other, Crunz provides a locking mechanism through preventOverlapping() method, which, ensures no task runs if the previous instance is already running.


//
$task = $schedule->run(PHP_BINARY . ' email.php');
$task
    ->everyFiveMinutes()
    ->preventOverlapping();
 //       

By default, crunz uses file based locking (if no parameters are passed to preventOverlapping). For alternative lock mechanisms, crunz uses the symfony/lock component that provides lock mechanisms with various stores. To use this component, you can pass a store to the preventOverlapping() method. In the following example, the file based FlockStore is used to provide an alternative lock file path.



use Symfony\Component\Lock\Store\FlockStore;

$store = new FlockStore(__DIR__ . '/locks');
$task = $schedule->run(PHP_BINARY . ' email.php');
$task
    ->everyFiveMinutes()
    ->preventOverlapping($store);

As of Symfony 5.0 the StoreInterface has been split into BlockingStoreInterface and PersistingStoreInterface. To use any of the persistent locks (Redis, PDO, etc) they need to be decorated by the RetryTillSaveStore.



use Symfony\Component\Lock\Store\RedisStore;
use Symfony\Component\Lock\Store\RetryTillSaveStore;

$redis = new Redis();
$redis->connect('localhost');
$persistingStore = new RedisStore($redis);
$blockingStore = new RetryTillSaveStore($persistingStore);

$task = $schedule->run(PHP_BINARY . ' email.php');
$task
    ->everyFiveMinutes()
    ->preventOverlapping($blockingStore);

Keeping the Output

Cron jobs usually have outputs, which is normally emailed to the owner of the crontab file, or the user(s) set by the MAILTO environment variable inside the crontab file.

We can also redirect the standard output to a physical file using > or >> operators:

* * * * * /command/to/run >> /var/log/crons/cron.log

This kind of output logging has been automated in Crunz. To automatically send each event's output to a log file, we can set log_output and output_log_file options in the configuration file accordingly:

# Configuration settings

## ...
log_output:      true
output_log_file: /var/log/crunz.log
## ...

This will send the events' output (if executed successfully) to /var/log/crunz.log file. However, we need to make sure we are permitted to write to the respective file.

If we need to log the outputs on an event-basis, we can use appendOutputTo() or sendOutputTo() methods like this:


//
$task = $schedule->run(PHP_BINARY . ' email.php');
$task
    ->everyFiveMinutes()
    ->appendOutputTo('/var/log/crunz/emails.log');

 //       

Method appendOutputTo() appends the output to the specified file. To override the log file with new data after each run, we use saveOutputTo() method.

It is also possible to send the errors as emails to a group of recipients by setting email_output and mailer settings in the configuration file.

Error Handling

Crunz makes error handling easy by logging and also allowing you add a set of callbacks in case of an error.

Error Callbacks

You can set as many callbacks as needed to run in case of an error:



use Crunz\Schedule;

$schedule = new Schedule();

$task = $schedule->run('command/to/run');
$task->everyFiveMinutes();

$schedule
->onError(function() {
   // Send mail
})
->onError(function() {
   // Do something else
});

return $schedule;

If there's an error the two defined callbacks will be executed.

Error Logging

To log the possible errors during each run, we can set log_error and error_log_file settings in the configuration file as below:

# Configuration settings

# ...
log_errors:      true
errors_log_file: /var/log/error.log
# ...

As a result, if the execution of an event is unsuccessful for some reasons, the error message is appended to the specified error log file. Each entry provides useful information including the time it happened, the event description, the executed command which caused the error, and the error message itself.

It is also possible to send the errors as emails to a group of recipients by setting email_error and mailer settings in the configuration file.

Custom logger

To use your own logger create class implementing \Crunz\Application\Service\LoggerFactoryInterface, for example:



namespace Vendor\Package;

use Crunz\Application\Service\ConfigurationInterface;
use Crunz\Application\Service\LoggerFactoryInterface;
use Psr\Log\AbstractLogger;
use Psr\Log\LoggerInterface;

final class MyEchoLoggerFactory implements LoggerFactoryInterface
{
    public function create(ConfigurationInterface $configuration): LoggerInterface
    {
        return new class extends AbstractLogger {
            /** @inheritDoc */
            public function log(
                $level,
                $message,
                array $context = array()
            ) {
                echo "crunz.{$level}: {$message}";   
            }
        };
    }
}

then use this class name in config:

# ./crunz.yml file
 
logger_factory: 'Vendor\Package\MyEchoLoggerFactory'

Done.

Pre-Process and Post-Process Hooks

There are times when we want to do some kind of operations before and after an event. This is possible by attaching pre-process and post-process callbacks to the respective event.

To do this, we use before() and after() on both Event and Schedule objects, meaning we can have pre and post hooks on an event-basis as well as schedule basis. The hooks bind to schedule will run before all events, and after all the events are finished.



use Crunz\Schedule;

$schedule = new Schedule();

$task = $schedule->run(PHP_BINARY . ' email.php');
$task
    ->everyFiveMinutes()
    ->before(function() { 
        // Do something before the task runs
    })
    ->before(function() { 
        // Do something else
    })
    ->after(function() {
        // After the task is run
    });
 
$schedule
    ->before(function () {
       // Do something before all events
    })
    ->after(function () {
       // Do something after all events are finished
    })
    ->before(function () {
       // Do something before all events
    });

We might need to use these methods as many times we need by chaining them.

Post-execution callbacks are only called if the execution of the event has been successful.

Other Useful Commands

We've already used a few of crunz commands like schedule:run and publish:config.

To see all the valid options and arguments of crunz, we can run the following command:

vendor/bin/crunz --help

Listing Tasks

One of these commands is crunz schedule:list, which lists the defined tasks (in collected *.Tasks.php files) in a tabular format.

vendor/bin/crunz schedule:list

+---+---------------+-------------+--------------------+
| # | Task          | Expression  | Command to Run     |
+---+---------------+-------------+--------------------+
| 1 | Sample Task   | * * * * 1 * | command/to/execute |
+---+---------------+-------------+--------------------+

Force run

While in development it may be useful to force run all tasks regardless of their actual run time, which can be achieved by adding --force to schedule:run:

vendor/bin/crunz schedule:run --force

To force run a single task, use the schedule:list command above to determine the Task number and run as follows:

vendor/bin/crunz schedule:run --task 1 --force

Generating Tasks

There is also a useful command named make:task, which generates a task file skeleton with all the defaults, so we won't have to write them from scratch. We can modify the output file later based on our requirements.

For example, to create a task, which runs /var/www/script.php every hour on Mondays, we run the following command:

vendor/bin/crunz make:task exampleOne --run scripts.php --in /var/www --frequency everyHour --constraint mondays
Where do you want to save the file? (Press enter for the current directory)

When we run this command, Crunz will ask about the location we want to save the file. By default, it is our source tasks directory.

As a result, the event is defined in a file named exampleOneTasks.php within the specified tasks directory.

To see if the event has been created successfully, we list the events:

crunz schedule:list

+---+------------------+-------------+----------------+
| # | Task             | Expression  | Command to Run |
+---+------------------+-------------+----------------+
| 1 | Task description | 0 * * * 1 * | scripts.php    |
+---+------------------+-------------+----------------+

To see all the options of make:task command with all the defaults, we run this:

vendor/bin/crunz make:task --help

Debugging tasks

To show basic information about task run:

vendor/bin/crunz task:debug 1

Above command should output something like this:

+----------------------+-----------------------------------+
| Debug information for task '1'                           |
+----------------------+-----------------------------------+
| Command to run       | php -v                            |
| Description          | Inner task                        |
| Prevent overlapping  | No                                |
+----------------------+-----------------------------------+
| Cron expression      | * * * * *                         |
| Comparisons timezone | Europe/Warsaw (from config)       |
+----------------------+-----------------------------------+
| Example run dates                                        |
| #1                   | 2020-03-08 09:27:00 Europe/Warsaw |
| #2                   | 2020-03-08 09:28:00 Europe/Warsaw |
| #3                   | 2020-03-08 09:29:00 Europe/Warsaw |
| #4                   | 2020-03-08 09:30:00 Europe/Warsaw |
| #5                   | 2020-03-08 09:31:00 Europe/Warsaw |
+----------------------+-----------------------------------+

Configuration

There are a few configuration options provided by Crunz in YAML format. To modify the configuration settings, it is highly recommended to have your own copy of the configuration file, instead of modifying the original one.

To create a copy of the configuration file, first we need to publish the configuration file:

/project/vendor/bin/crunz publish:config
The configuration file was generated successfully

As a result, a copy of the configuration file will be created within our project's root directory.

The configuration file looks like this:

# Crunz Configuration Settings

# This option defines where the task files and
# directories reside.
# The path is relative to the project's root directory,
# where the Crunz is installed (Trailing slashes will be ignored).
source: tasks

# The suffix is meant to target the task files inside the ":source" directory.
# Please note if you change this value, you need
# to make sure all the existing tasks files are renamed accordingly.
suffix: Tasks.php

# Timezone is used to calculate task run time
# This option is very important and not setting it is deprecated
# and will result in exception in 2.0 version.
timezone: ~

# This option define which timezone should be used for log files
# If false, system default timezone will be used
# If true, the timezone in config file that is used to calculate task run time will be used
timezone_log: false

# By default the errors are not logged by Crunz
# You may set the value to true for logging the errors
log_errors: false

# This is the absolute path to the errors' log file
# You need to make sure you have the required permission to write to this file though.
errors_log_file:

# By default the output is not logged as they are redirected to the
# null output.
# Set this to true if you want to keep the outputs
log_output: false

# This is the absolute path to the global output log file
# The events which have dedicated log files (defined with them), won't be
# logged to this file though.
output_log_file:

# By default line breaks in logs aren't allowed.
# Set the value to true to allow them.
log_allow_line_breaks: false

# By default empty context arrays are shown in the log.
# Set the value to true to remove them.
log_ignore_empty_context: false

# This option determines whether the output should be emailed or not.
email_output: false

# This option determines whether the error messages should be emailed or not.
email_errors: false

# Global Swift Mailer settings
#
mailer:
    # Possible values: smtp, mail, and sendmail
    transport: smtp
    recipients:
    sender_name:
    sender_email:


# SMTP settings
#
smtp:
    host:
    port:
    username:
    password:
    encryption:

As you can see there are a few options like source which is used to specify the source tasks directory. The other options are used for error/output logging/emailing purposes.

Each time we run Crunz commands, it will look into the project's root directory to see if there's any user-modified configuration file. If the configuration file doesn't exists, it will use the one shipped with the package.

Development ENV flags

The following environment flags should be used only while in development. Typical end-users do not need to, and should not, change them.

CRUNZ_CONTAINER_DEBUG

Flag used to enable/disable container debug mode, useful only for development. Enabled by default in docker-compose.

CRUNZ_DEPRECATION_HANDLER

Flag used to enable/disable Crunz deprecation handler, useful only for integration tests. Disabled by default for tests.

Contributing

Which branch should I choose?

In most cases you should target branch 1.12.x, as this is active development branch. Branch master is for future release, but all bugs/features should go to 1.11.x anyway.

If You Need Help

Please submit all issues and questions using GitHub issues and I will try to help you.

Credits

License

Crunz is free software distributed under the terms of the MIT license.

Comments
  • Could not open input file: <project root>/crunz

    Could not open input file: /crunz

    Crunz version: v1.11.0-beta.1

    PHP version: 7.2.5

    Operating system type and version: Ubuntu 18.04.1

    Description
    Since upgrading to this beta release, calling crunz schedule:run results in Could not open input file: <project root>/crunz

    Intermittently, it may also throw No task found! Please check your source path. as well without any configuration change, but I have not been able to reliably reproduce this one.

    Both of these are not an issue for releases prior to this version.

    How to reproduce
    Upgrade to v1.11.0-beta.1 or later and attempt to call schedule:run.

    bug 
    opened by pridit 35
  • Empty error when invoking function with incorrect type hinting

    Empty error when invoking function with incorrect type hinting

    Example:

    TestTasks.php

    <?php
    
    use Crunz\Schedule;
    
    $schedule = new Schedule();
    
    
    $schedule->run(function () {
        echo 'test';
    
        function test(boolean $parameter)
        {
            echo 'test2';
        }
    
        test(true);
    })
    ->everyMinute()
    ->description('Test schedule');
    
    return $schedule;
    
    
    

    Output: [2018-09-04 17:47:02] crunz.ERROR: Test schedule(object(Closure)) [] []

    bug 
    opened by esetnik 33
  • When running more than one task at the same time, seems to only do the first one

    When running more than one task at the same time, seems to only do the first one

    Crunz version: 2.3.0

    PHP version: 7.4

    Operating system type and version: Linux, Nginx server

    Description
    I have several jobs I'm trying to run at the same time, using:

        ->daily()
        ->at("$continuetime")
    

    The $continuetime variable is retrieved from the db, and seems to work fine, but only on the first task that uses it. The others don't seem to fire. I'm verifying this by using ->sendOutputTo("logfile.log") on each task, with different log files, and only the first one gets written to.

    Also, I tried switching one of them to ->everyMinute(), and it ran, so this also makes me suspect the ->at() method is not working for multiple files set for the same time of day.

    Is this expected? Do I need to use different times if using the ->at() method?

    opened by jamminjames 17
  • Running a command on the server

    Running a command on the server

    I am able to trigger php files with the scheduler, but am having trouble initiating a command on the server. I want to run a simple "fetchmail -vk" command, which should be able to run from anywhere on the server. To check, however, I ran the command from the same location the scheduler triggers the php files, that is, the home folder for the website on the server. So, running the "fetchmail -vk" command via a SSH connection from said folder is successful.

    To run php files, of course, you have to prepend the run command with "/usr/bin/php", like so: $schedule->run('/usr/bin/php script.php')

    ... is there something I have to use before the fetchmail command? Right now, it's just: $schedule->run('fetchmail -vk')

    For frequency, I am using: ->everyTwoHours()

    Thanks for any help.

    question 
    opened by jamminjames 16
  • Class 'Crunz\Schedule' not found

    Class 'Crunz\Schedule' not found

    it is the ERROR: Fatal error: Uncaught Error: Class 'Crunz\Schedule' not found Stack trace: #0 {main} throw .. Here is the code: use Crunz\Schedule; $schedule = new Schedule(); $schedule->run('test2.php');
    $schedule->everyMinute(); $schedule->description('mail testing');

    return $schedule;

    opened by RaeesAbbas 16
  • High CPU usage

    High CPU usage

    I used crunz with a php script of sending email ("yiic emailSpool loop" http://cornernote.github.io/yii-email-module). In this script, it'll fetch spooled email (e.g 10 emails) from db and send them, then sleep 1 second, then next 10 emails,...

    The problem is the schedule:runused very high CPU load

    Pls look at process 84672

    screen shot 2017-07-26 at 3 29 11 pm screen shot 2017-07-26 at 3 30 04 pm

    I did try to run yiic emailSpool loop without crunz #yiic emailSpool loop & and it only takes 0.1% cpu (the same result if i put this script to crontab -e) Actually there isn't many emails to send, most of the time this script hit db get 0 spooled emails, sleep, hit db, 0 emails, sleep, ... but the server is always around 90-100% CPU load

    bug 
    opened by tamhv 16
  • When some php scripts triggered by Crunz, they don't work. Trigger the same scripts in a browser, they work

    When some php scripts triggered by Crunz, they don't work. Trigger the same scripts in a browser, they work

    I have an issue I can't seem to figure out, having tried many things. When I run certain php scripts via Crunz, they don't work. Trigger the same scripts in a browser, they work fine.

    There are two in particular: one is fetching some apcu variables and emailing the result; the other triggers a session garbage collection (session_gc()). Maybe it has to do with the nature of those two operations, but I don't get it. Why would it matter how the script is called, cron job vs the browser? Shouldn't they work either way? Or am I missing something I need to do to get these to work?

    I know I have the correct binary php path set, and I know the cron jobs are firing, as they trigger log entries via sendOutputTo. Also, in the example of the apcu report email, the email is sent, so I know the file and the cron are working. And as I said, trigger that same script from a browser, and it emails the apcu variable results just fine. Neither uses a function or anything, they both just call the script files.

    Any ideas? Love the scheduler. Thanks!

    opened by jamminjames 14
  • some problems whith v2.3.0 but on v1.12.4 and php v5.6 everything is fine

    some problems whith v2.3.0 but on v1.12.4 and php v5.6 everything is fine

    Crunz version: 2.3.0

    PHP version: 8.0.0 and 7.4.13

    **Operating system type and versionubuntu v2004:

    Description
    [email protected] in /shared/httpd/new_sheduler $ vendor/bin/crunz schedule:run

    Fatal error: Declaration of Symfony\Component\DependencyInjection\ServiceLocator::has(string $id) must be compatible with Psr\Container\ContainerInterface::has($id) in /shared/httpd/new_sheduler/vendor/symfony/dependency-injection/ServiceLocator.php on line 46

    Call Stack: 0.0001 421984 1. {main}() /shared/httpd/new_sheduler/vendor/lavary/crunz/crunz:0 0.0037 995328 2. Crunz\Application->__construct($appName = 'Crunz Command Line Interface', $appVersion = 'v2.2.1') /shared/httpd/new_sheduler/vendor/lavary/crunz/crunz:70 0.0040 1030008 3. Crunz\Application->initializeContainer() /shared/httpd/new_sheduler/vendor/lavary/crunz/src/Application.php:67 0.0044 1063584 4. Crunz\Application->buildContainer() /shared/httpd/new_sheduler/vendor/lavary/crunz/src/Application.php:119 0.0044 1063584 5. Composer\Autoload\ClassLoader->loadClass($class = 'Symfony\Component\DependencyInjection\ContainerBuilder') /shared/httpd/new_sheduler/vendor/lavary/crunz/src/Application.php:150 0.0044 1063712 6. Composer\Autoload\includeFile($file = '/shared/httpd/new_sheduler/vendor/composer/../symfony/dependency-injection/ContainerBuilder.php') /shared/httpd/new_sheduler/vendor/composer/ClassLoader.php:322 0.0059 1277920 7. include('/shared/httpd/new_sheduler/vendor/symfony/dependency-injection/ContainerBuilder.php') /shared/httpd/new_sheduler/vendor/composer/ClassLoader.php:444 0.0059 1277920 8. Composer\Autoload\ClassLoader->loadClass($class = 'Symfony\Component\DependencyInjection\Container') /shared/httpd/new_sheduler/vendor/symfony/dependency-injection/ContainerBuilder.php:53 0.0059 1278048 9. Composer\Autoload\includeFile($file = '/shared/httpd/new_sheduler/vendor/composer/../symfony/dependency-injection/Container.php') /shared/httpd/new_sheduler/vendor/composer/ClassLoader.php:322 0.0062 1330576 10. include('/shared/httpd/new_sheduler/vendor/symfony/dependency-injection/Container.php') /shared/httpd/new_sheduler/vendor/composer/ClassLoader.php:444 0.0063 1333912 11. class_exists($class = 'Symfony\Component\DependencyInjection\Argument\ServiceLocator') /shared/httpd/new_sheduler/vendor/symfony/dependency-injection/Container.php:29 0.0063 1334040 12. Composer\Autoload\ClassLoader->loadClass($class = 'Symfony\Component\DependencyInjection\Argument\ServiceLocator') /shared/httpd/new_sheduler/vendor/symfony/dependency-injection/Container.php:29 0.0063 1334168 13. Composer\Autoload\includeFile($file = '/shared/httpd/new_sheduler/vendor/composer/../symfony/dependency-injection/Argument/ServiceLocator.php') /shared/httpd/new_sheduler/vendor/composer/ClassLoader.php:322 0.0063 1339944 14. include('/shared/httpd/new_sheduler/vendor/symfony/dependency-injection/Argument/ServiceLocator.php') /shared/httpd/new_sheduler/vendor/composer/ClassLoader.php:444 0.0063 1339944 15. Composer\Autoload\ClassLoader->loadClass($class = 'Symfony\Component\DependencyInjection\ServiceLocator') /shared/httpd/new_sheduler/vendor/symfony/dependency-injection/Argument/ServiceLocator.php:21 0.0064 1340072 16. Composer\Autoload\includeFile($file = '/shared/httpd/new_sheduler/vendor/composer/../symfony/dependency-injection/ServiceLocator.php') /shared/httpd/new_sheduler/vendor/composer/ClassLoader.php:322 0.0066 1362368 17. include('/shared/httpd/new_sheduler/vendor/symfony/dependency-injection/ServiceLocator.php') /shared/httpd/new_sheduler/vendor/composer/ClassLoader.php:444

    image image image

    opened by ishicamiru 14
  • Execute tasks by using different timezone wise

    Execute tasks by using different timezone wise

    We have many users and they are using different timezone and so plan is that, send email to these users by their timezone wise. Is it possible to send email by different timezone?

    I have tried below but it is not working

    use Crunz\Schedule;
    
    $schedule = new Schedule();
    
    $task = $schedule->run(PHP_BINARY.' email.php'); 
    $task->on('14:35')
         ->timezone('Europe/Warsaw')
         ->description('Send email to users.');
    
    return $schedule;
    

    Could you please correct me what is I am doing wrong in it?

    opened by adrianbecker013 13
  • Crunz doesn't provide error log when emailing

    Crunz doesn't provide error log when emailing

    Crunz version: 1.10.1

    PHP version: 7.2.11

    Operating system type and version: Ubuntu 16.04

    Description
    It appeared recently. I don't get any error message by email when my script generates one. I do get an email with the first line in the body describing the job and its description, but afterwards there is nothing. I tried to run my script directly and it provides a fatal error, but crunz somewhat doesn't log it. I set log_errors & log_output to "true", and on both log files, there is no fatal error described as well. In the task log file, nothing appear, in the error log file, an error entry appears without the fatal error.

    [2018-11-06 09:01:02] crunz.ERROR: job description(job command) [] []

    When running my script manually, I get a fatal error: PHP Fatal error: Uncaught ArgumentCountError: Too few arguments to function....

    How to reproduce
    Create a php script that will generate a fatal error. Set email_errors to true in config. Try crunz. You should get an email for the error, but inside there is nothing about the error, just "job's description (command)".

    Possible Solution
    No idea but I didn't have this problem before, it appeared recently, maybe after an update. Since I fortunately don't have a lot of errors in my code, I couldn't see this before recently 😄

    bug 
    opened by kinoute 13
  • Crunz sends me an empty error email on every job

    Crunz sends me an empty error email on every job

    Crunz version: 1.11.0-rc.1

    PHP version: 7.3.0

    Operating system type and version: Ubuntu 16.04.5

    Description
    Despite generating no error, Crunz emails me on every task ("reporting error for event..."). With log_errors: true, we can confirm there is no error shown:

    [2018-12-26 17:45:07] crunz.ERROR: Results(cd xx; php xx.php) [] []

    How to reproduce
    Turn the email_errors to true on the latest version, add your email credentials, create some dummy task. Run it, it should email you with nothing.

    Possible Solution
    Haven't one sorry.

    opened by kinoute 12
  • New home for Crunz

    New home for Crunz

    Hello, I don't have admin rights in this repository and I'm unable to change default branch, disable AppVeyor and other things, this is why I decided to create https://github.com/crunzphp organization, as a new space for Crunz and create https://github.com/crunzphp/crunz as a new home for Crunz. Fork is indirect, but it is drop-in replacement. All new PRs and issues should be opened in new repository

    Migrating to new "home" is easy, just change lavary/crunz in your composer.json file to crunzphp/crunz and that's it.

    Also, please consider supporting further development of Crunz https://github.com/sponsors/PabloKowalczyk, with some funding I'll be able to spend more time on refactoring Crunz and add plugin system to it.

    opened by PabloKowalczyk 0
  • Allow the crunz.yml file to be in a subfolder

    Allow the crunz.yml file to be in a subfolder

    Description
    Please allow the crunz.yml file to be in a subfolder. I usually don't put the app configs in the root of the project, but into a dedicated folder (usually not checked in in git).

    Example
    Maybe adding a --config flag to the CLI may be sufficient for this use case. The result would be

    vendor/bin/crunz --config config/crunz.yml schedule:run
    
    opened by scollovati 1
  • Was issue #313: preventOverlapping for distinct tasks ever implemented?

    Was issue #313: preventOverlapping for distinct tasks ever implemented?

    Description
    I looked at issue #313 preventOverlapping for distinct tasks and there was a commit made by the author of the issue (f16fab5) on his own fork that seemed to implement it. The issue was subsequently closed, yet the changes was never merged with this repository. Was a pull request never submitted or why was it not implemented?

    opened by Donatello-za 1
  • [Deprecation] Since symfony/lock 5.2: Symfony\Component\Lock\Store\RetryTillSaveStore is deprecated

    [Deprecation] Since symfony/lock 5.2: Symfony\Component\Lock\Store\RetryTillSaveStore is deprecated

    Crunz version: 2.3.1

    PHP version: 7.3

    Operating system type and version: ubuntu 20.04

    Description
    [Deprecation] Since symfony/lock 5.2: Symfony\Component\Lock\Store\RetryTillSaveStore is deprecated

    How to reproduce
    use Symfony\Component\Lock\Store\RedisStore; use Symfony\Component\Lock\Store\RetryTillSaveStore;

    $redis = new Redis(); $redis->connect('localhost'); $persistingStore = new RedisStore($redis); $blockingStore = new RetryTillSaveStore($persistingStore);

    $task = $schedule->run(PHP_BINARY . ' email.php'); $task ->everyFiveMinutes() ->preventOverlapping($blockingStore);

    Possible Solution

    Additional context

    opened by sverdier 3
  • Unlock locked task

    Unlock locked task

    I noticed my tasks weren't running and that removing preventOverlapping() solved the issue. However, I would like to keep preventOverlapping.

    I used ps and saw that I had a /vendor/bin/crunz process running for more than a week. A killed the processes, thinking that would free the lock, but that didn't help. How can I free this lock?

    Also, is there any mechanism in Crunz that would have prevented this from happening? Maybe kill the lock after X amount of time passed, or after X runs were skipped?

    opened by danielbattat 1
  • set_exception_handler() inside event closure is ignored

    set_exception_handler() inside event closure is ignored

    Crunz version: 3.0.1

    PHP version: 7.4.24

    Operating system type and version: Ubuntu

    Description
    set_exception_handler() inside event closures isn't called.

    We set up a global error handler (Sentry) and missed uncaught exceptions, as we weren't looking at the logs.

    set_error_handler works just fine.

    How to reproduce

    <?php
    
    $sch = new Crunz\Schedule();
    
    $sch->run(function () {
    	set_exception_handler(static function (Throwable $e) {
    		// report $e
    	});
    	
    	throw new Exception('Uh-Oh SpaghettiOs');
    })
    	->name("Where are teh errors?")
    	->everyMinute()
    ;
    
    return $sch;
    

    Additional context
    This is not due to the Opis Closure serialization.

    Does crunz closure:run set up its own exception handler?

    opened by drjayvee 0
Releases(v3.2.1)
  • v3.2.1(Jan 12, 2022)

  • v3.2.0(Jan 9, 2022)

    v3.1.0...v3.2.0

    Changelog

    Added

    • [#398] Add hourlyAt()
    • [#390] Symfony 6 Support, thanks to @bashgeek

    Changed

    • [#396] Remove "opis/closure" and use "laravel/serializable-closure" instead

    Removed

    • [#393] Drop Symfony 5.2 support
    • [#394] Drop Symfony 5.3 support

    PRs

    • [#390] Symfony 6 Support
    • [#393] Drop Symfony 5.2 support
    • [#394] Drop Symfony 5.3 support
    • [#396] Remove "opis/closure" and use "laravel/serializable-closure" instead
    • [#397] Test PHP 8.1 in CI
    • [#395] Rework CI jobs
    • [#398] Add hourlyAt()
    • [#399] Release v3.2.0
    Source code(tar.gz)
    Source code(zip)
  • v3.1.0(Nov 24, 2021)

  • v3.0.1(May 25, 2021)

  • v2.3.1(May 25, 2021)

  • v3.0.0(Apr 25, 2021)

    v2.3.0...v3.0.0

    Summary

    This is first release of v3.x branch, it removes deprecated "every*" API (#354) and also change, slightly, "day" interpretation of CRON expression (#356). Finally Symfony v3.4 support was removed.

    Changelog

    Changed

    • [#349] Require at least PHP v7.4
    • [#356] Require package "dragonmantank/cron-expression" at least "v3.1"

    Removed

    • [#351] Drop Symfony v3.4 support
    • [#352] Drop Symfony v5.1 support
    • [#354] Remove most "Crunz\Event::every*" methods

    PRs

    • [#349] Require at least PHP v7.4
    • [#350] Migrate Windows builds to GitHub Actions
    • [#351] Drop Symfony v3.4 support
    • [#352] Drop Symfony v5.1 support
    • [#354] Remove most "Crunz\Event::every*" methods
    • [#355] Remove Symfony BC layer
    • [#356] Require package "dragonmantank/cron-expression" at least "v3.1"
    • [#360] Release v3.0.0
    Source code(tar.gz)
    Source code(zip)
  • v2.3.0(Mar 14, 2021)

    v2.2.4...v2.3.0

    Changelog

    Deprecated

    • [#344] Deprecate most "Event::every*" methods

    Removed

    • [#323] Drop Symfony 4.3 support
    • [#324] Drop Symfony 5.0 support

    PRs

    • [#323] Drop Symfony 4.3 support
    • [#324] Drop Symfony 5.0 support
    • [#335] Add "code_checks" workflow
    • [#336] Fix missing "composer version" command in CI
    • [#337] Fix dependencies versions in "static_analysis" job
    • [#338] Do not test PHP v8.1
    • [#344] Deprecate most "Event::every*" methods
    • [#347] Update dev dependencies
    • [#348] Release v2.3.0
    Source code(tar.gz)
    Source code(zip)
  • v2.2.4(Dec 18, 2020)

  • v2.2.3(Nov 29, 2020)

    v2.2.2...v2.2.3

    Changelog

    Fixed

    • [#334] Fix disabling logger not working

    PRs

    • [#329] Full PHP v8 support
    • [#334] Fix disabling logger not working
    • [#339] Add GitHub actions
    • [#340] Fix workflows syntax
    • [#341] Update dev tools
    • [#342] Release v2.2.3
    Source code(tar.gz)
    Source code(zip)
  • v2.2.2(Oct 12, 2020)

  • v2.2.1(Oct 8, 2020)

    v2.2.0...v2.2.1

    Changes

    Fixed

    • [#321] Add PHP8 support

    PRs

    • [#319] Remove "Event::monthlyOn" from documentation because method is not implemented
    • [#320] Use composer v2
    • [#321] Add PHP8 support
    • [#322] Release v2.2.1
    Source code(tar.gz)
    Source code(zip)
  • v2.2.0(Jun 18, 2020)

    v2.1.0...v2.2.0

    Changes

    Added

    • [#287] Add task:debug command
    • [#233] Add option to ignore empty context in monolog, thanks to @rrushton
    • [#298] Add logger_factory config option

    Removed

    • [#292] Drop Symfony 4.2 support

    PRs

    • [#287] Add task:debug command
    • [#288] Improve TravisCI configuration
    • [#290] Remove "dev_tools" service from docker-compose
    • [#291] Remove box from vendor bin
    • [#292] Drop Symfony 4.2 support
    • [#294] Update docs for Symfony 5 locking, thanks to @hashnz
    • [#233] Add option to ignore empty context in monolog
    • [#297] Add ConfigurationInterface
    • [#299] Migrate to opis\closure
    • [#300] Update dev tools
    • [#298] Implement logger factory rfc
    • [#304] Add "status" column to roadmap
    • [#305] Test Symfony 5.1 compatibility
    Source code(tar.gz)
    Source code(zip)
  • v2.1.0(Feb 2, 2020)

    v2.0.4...v2.1.0

    Changes

    Added

    • [#274] Symfony 5 support

    Changed

    • [#240] cron-expression package, thanks to @mareksuscak
    • [#280] Hide closure:run command

    PRs

    • [#231] Move config to resources directory
    • [#236] Typos in README.md, thanks to @davidsneighbour
    • [#240] Swap out the cron-expression package, thanks to @mareksuscak
    • [#255] Documentation/reorder/update, thanks to @simmonspaul
    • [#256] Suggest using PHP_BINARY const
    • [#274] Add Symfony 5 support
    • [#276] Remove "changelog-linker" dependency
    • [#277] Update dev tools
    • [#278] Update phpstan
    • [#279] Update PHPUnit to v8.5
    • [#280] Hide closure:run command
    • [#283] Release v2.1.0
    Source code(tar.gz)
    Source code(zip)
  • v2.0.4(Dec 8, 2019)

    v2.0.3...v2.0.4

    Changes:

    Fixed

    • [#268] Fix Symfony 4.4 deprecations

    PRs:

    • [#268] Fix Symfony 4.4 deprecations
    • [#270] Update symfony/phpunit-bridge
    • [#271] Move PHPUnit to main composer.json
    • [#272] Test against all supported Symfony versions
    • [#273] Release v2.0.4
    Source code(tar.gz)
    Source code(zip)
  • v1.12.4(Dec 8, 2019)

  • v2.0.3(Nov 17, 2019)

  • v1.12.3(Nov 17, 2019)

  • v2.0.2(Oct 6, 2019)

  • v1.12.2(Oct 6, 2019)

  • v2.0.1(May 10, 2019)

    This release fixes regression about recursive tasks' directory scan (https://github.com/lavary/crunz/issues/228).

    Changes:

    Fixed

    • [#229] Fix recursive tasks scan

    PRs:

    • [#229] Fix recursive tasks scan
    • [#232] Release v2.0.1
    Source code(tar.gz)
    Source code(zip)
  • v1.12.1(May 1, 2019)

    This release fixes regression about recursive tasks' directory scan (https://github.com/lavary/crunz/issues/228).

    Changes:

    Fixed

    • [#229] Fix recursive tasks scan

    PRs:

    • [#229] Fix recursive tasks scan
    • [#230] Release v1.12.1
    Source code(tar.gz)
    Source code(zip)
  • v2.0.0(Apr 24, 2019)

    First v2 release :tada:

    This release basically removes BC layer from v1.12, removes some old code and add some strict typing. There is no new features, it will land in v2.1.

    Minimum required PHP version is 7.2 and required Symfony components version are ^3.4 || ^4.2, it may seems to be "aggresive" today, but i hope they won't change until Crunz v3 release (around 2021-04).

    To ease migration to v2 there is UPGRADE.md file.

    Changes:

    Changed

    • [#101] Throw exception on empty timezone
    • [#204] More than five parts cron expressions will throw exception
    • [#221] Throw Crunz\Task\WrongTaskInstanceException when task is not Schedule instance
    • [#222] Make \Crunz\Event::setProcess private
    • [#225] Bump dependencies

    Removed

    • [#103] Removed Crunz\Output\VerbosityAwareOutput class
    • [#206] Remove legacy paths recognition
    • [#224] Remove mail transport

    PRs:

    • [#95] Added timezone option (#94)
    • [#100] Upgrade dependencies in v2
    • [#101] Throw exception on empty timezone
    • [#102] PHP7 migration
    • [#107] Do not run tests in unsupported PHP versions
    • [#141] Add GitHub issue templates
    • [#142] Update issue templates
    • [#202] Cleanup dead code
    • [#203] Move symfony/debug to dev dependencies
    • [#204] More than five parts cron expressions will throw exception
    • [#206] Remove legacy paths recognition
    • [#221] Throw "Crunz\Task\WrongTaskInstanceException" when task is not "Schedule" instance
    • [#222] Make "\Crunz\Event::setProcess" private
    • [#223] Remove PHP 5.6 development environment
    • [#224] Remove 'mail' transport
    • [#225] Bump dependencies
    • [#226] Readme improvements
    Source code(tar.gz)
    Source code(zip)
  • v1.12.0(Apr 7, 2019)

    This is the last minor release of v1.x branch, from now all new features will go to v2.x branch. Bug support for v1.x will be provided until april 2020.

    Upgrade guide is available here: https://github.com/lavary/crunz/blob/1.12.x/UPGRADE.md

    Changes:

    Added

    • [#178], [#217] timezone_log configuration option to decide whether configured timezone should be used for logs, thanks to [@SadeghPM]

    Deprecated

    • Using \Crunz\Event::setProcess is deprecated, this method was intended to be private, but for some reason is public. In v2.0 this method will became private and result in exception if you call it.
    • [#199] Not returning \Crunz\Schedule instance from your task is deprecated. In v2 this will result in exception.

    PRs:

    • [#178] fix incorrect timezone in log files
    • [#188] Add humbug/box to dev tools
    • [#189] Introduce Crunz\Process\Process
    • [#184] Make "container debug" configurable
    • [#194] Add missing upgrade guides
    • [#199] Deprecate task files which do not return Schedule instance
    • [#212] Introduce PHPStan
    • [#217] Fallback to system's timezone instead of 'UTC'
    Source code(tar.gz)
    Source code(zip)
  • v1.11.2(Mar 16, 2019)

    This release fixes https://github.com/lavary/crunz/issues/207 - now autoloader will be found even if Crunz's bin is hard copied to vendor/bin.

    PRs:

    • [#209] Add Vendor/Bin as source for Autoload discovery
    • [#210] Fix DIR const name
    Source code(tar.gz)
    Source code(zip)
  • v1.11.1(Jan 27, 2019)

    This release fixes (PR https://github.com/lavary/crunz/pull/190) running closures, broken in v1.11.0. More at https://github.com/lavary/crunz/issues/135.

    Source code(tar.gz)
    Source code(zip)
  • v1.11.0(Jan 24, 2019)

    First release in 2019 :tada:

    In the past Crunz tries to look for tasks/config in paths related to bin, this behavior is deprecated, now you should cd to the directory with crunz.yml and then run command. The same way as in PHPUnit, Composer and other PHP tools.

    PHAR fixes - PR #146.

    Date of v2 release was moved to April 2019 (PR - #147) to give more time to stabilize Crunz API and fix bugs.

    DI config was converted from XML to plain PHP (PR #148) to remove hidden dependency on DOMDocument class.

    Legacy Helpers/Utils code was removed, PR #150. Recently PHP nightly on Travis CI was changed to 7.4-dev, so there is need to define tests on 7.3 explicitly - PR #157.

    Long awaited serious locking landed in this release, thanks to the @digilist. Now custom LockStore can be passed to preventOverlapping method - PR #153.

    First RC of v1.11 fixes bug with new lock mechanism (#171), also Symfony 4.2 deprecations were fixed (#173).

    Along with PHAR fixes, and to reduce PHAR size, some not necessary needed dependencies was removed, and replaced with own code if needed:

    • symfony/property-access, PR #149
    • symfony/finder, PR #151
    • nesbot/carbon, PR #155
    Source code(tar.gz)
    Source code(zip)
    crunz.phar(596.95 KB)
    md5sum(45 bytes)
  • v1.11.0-rc.1(Dec 22, 2018)

    First RC of v1.11 fixes bug with new lock mechanism (#171), also Symfony 4.2 deprecations were fixed (#173). Probably this is last release before stable v1.11, i hope so.

    Changes:

    Fixed

    • [#171] Fix lock storage bug
    • [#173] Remove Symfony 4.2 deprecations
    • [#166] Improve task collection debugging
    Source code(tar.gz)
    Source code(zip)
    crunz.phar(756.59 KB)
  • v1.11.0-beta.2(Nov 10, 2018)

  • v1.11.0-beta.1(Oct 23, 2018)

    This is maintenance/clean-up release, marked as beta because this is first release with PHAR included - it will definitely needs some tests in the wild. PHAR fixes - PR #146.

    Date of v2 release was moved to April 2019 (PR - #147) to give more time to stabilize Crunz API and fix bugs.

    DI config was converted from XML to plain PHP (PR #148) to remove hidden dependency on DOMDocument class.

    Legacy Helpers/Utils code was removed, PR #150. Recently PHP nightly on Travis CI was changed to 7.4-dev, so there is need to define tests on 7.3 explicitly - PR #157.

    Long awaited serious locking landed in this release, thanks to the @digilist. Now custom LockStore can be passed to preventOverlapping method - PR #153.

    Along with PHAR fixes, and to reduce PHAR size, some not necessary needed dependencies was removed, and replaced with own code if needed:

    • symfony\property-access, PR #149
    • symfony\finder, PR #151
    • nesbot/carbon, PR #155
    Source code(tar.gz)
    Source code(zip)
    crunz.phar(614.10 KB)
    crunz.phar.md5(45 bytes)
  • v1.10.1(Sep 22, 2018)

    This release fixes possible incompatibility on system without ext-curl installed/enabled. cURL is no longer required and if ping is used \Crunz\HttpClient\FallbackHttpClient will try to fallback to fopen (requires enabled allow_url_fopen).

    Changelog:

    Fixed

    • Incompatibility for users without cURL extension but with enabled allow_url_fopen - PR #139 by @PabloKowalczyk
    Source code(tar.gz)
    Source code(zip)
Owner
Reza Lavarian
Reza Lavarian
Manage all your cron jobs without modifying crontab. Handles locking, logging, error emails, and more.

Jobby, a PHP cron job manager Install the master jobby cron job, and it will manage all your offline tasks. Add jobs without modifying crontab. Jobby

null 1k Dec 25, 2022
Laravel Cron Scheduling - The ability to run the Laravel task scheduler using different crons

Laravel Cron Scheduling Laravel Task Scheduling is a great way to manage the cron. But the documentation contains the following warning: By default, m

Sergey Zhidkov 4 Sep 9, 2022
Dispatcher is a Laravel artisan command scheduling tool used to schedule artisan commands within your project so you don't need to touch your crontab when deploying.

Dispatcher Dispatcher allows you to schedule your artisan commands within your Laravel project, eliminating the need to touch the crontab when deployi

Indatus 1.1k Jan 5, 2023
Manage Your Laravel Schedule From A Web Dashboard

Introduction Manage your Laravel Schedule from a pretty dashboard. Schedule your Laravel Console Commands to your liking. Enable/Disable scheduled tas

ⓒⓞⓓⓔ ⓢⓣⓤⓓⓘⓞ 1.6k Jan 5, 2023
Manage Your Laravel Schedule From A Web Dashboard

Introduction Manage your Laravel Schedule from a pretty dashboard. Schedule your Laravel Console Commands to your liking. Enable/Disable scheduled tas

ⓒⓞⓓⓔ ⓢⓣⓤⓓⓘⓞ 1.6k Jan 1, 2023
A course database lookup tool and schedule building web application for use at Rochester Institute of Technology.

CSH ScheduleMaker A course database lookup tool and schedule building web application for use at Rochester Institute of Technology. Built, maintained

Computer Science House 55 Nov 8, 2022
PHP cron job scheduler

PHP Cron Scheduler This is a framework agnostic cron jobs scheduler that can be easily integrated with your project or run as a standalone command sch

Giuseppe Occhipinti 698 Jan 1, 2023
Cron expression generator built on php8

The most powerful and extendable tool for Cron expression generation Cron expression generator is a beautiful tool for PHP applications. Of course, th

Pavel Buchnev 46 Nov 27, 2022
Task Scheduling with Cron Job in Laravel

About Laravel Laravel is a web application framework with expressive, elegant syntax. We believe development must be an enjoyable and creative experie

Shariful Islam 1 Oct 16, 2021
Cron Job Manager for Magento 2

EthanYehuda_CronJobManager A Cron Job Management and Scheduling tool for Magento 2 Control Your Cron Installation In your Magento2 root directory, you

Ethan Yehuda 265 Nov 24, 2022
xcron - the souped up, modernized cron/Task Scheduler for Windows, Mac OSX, Linux, and FreeBSD server and desktop operating systems.

xcron is the souped up, modernized cron/Task Scheduler for Windows, Mac OSX, Linux, and FreeBSD server and desktop operating systems. MIT or LGPL.

CubicleSoft 7 Nov 30, 2022
Fluent API for Gulp.

Laravel Elixir Please note that this project has been archived. Instead, we recommend that you transition to Laravel Mix. Introduction Laravel Elixir

The Laravel Framework 1.1k Jan 5, 2023
Elegant SSH tasks for PHP.

Laravel Envoy Introduction Laravel Envoy provides a clean, minimal syntax for defining common tasks you run on your remote servers. Using Blade style

The Laravel Framework 1.5k Jan 1, 2023
Modern and simple PHP task runner inspired by Gulp and Rake aimed to automate common tasks

RoboTask Modern and simple PHP task runner inspired by Gulp and Rake aimed to automate common tasks: writing cross-platform scripts processing assets

Consolidation 2.6k Jan 3, 2023
Laravel-Tasks is a Complete Build of Laravel 5.2 with Individual User Task Lists

An app of tasks lists for each individual user. Built on Laravel 5.2, using 5.2 authentication and middleware. This has robust verbose examples using Laravel best practices.

Jeremy Kenedy 26 Aug 27, 2022
Create a docker container where various tasks are performed with different frequencies

?? Docker with task scheduler Introduction The goal is to create a docker container where various tasks are performed with different frequencies. For

Green.Mod 3 Jun 7, 2022
Flow Framework Task Scheduler

This package provides a simple to use task scheduler for Neos Flow. Tasks are configured via settings, recurring tasks can be configured using cron syntax. Detailed options configure the first and last executions as well as options for the class handling the task.

Flowpack 11 Dec 21, 2022
Modern task runner for PHP

RoboTask Modern and simple PHP task runner inspired by Gulp and Rake aimed to automate common tasks: writing cross-platform scripts processing assets

Consolidation 2.6k Jan 3, 2023
Pure PHP task runner

task/task Got a PHP project? Heard of Grunt and Gulp but don't use NodeJS? Task is a pure PHP task runner. Leverage PHP as a scripting language, and a

null 184 Sep 28, 2022