phpgt / cron Goto Github PK
View Code? Open in Web Editor NEWRun scripts or static functions at regular intervals.
Home Page: https://www.php.gt/cron
License: MIT License
Run scripts or static functions at regular intervals.
Home Page: https://www.php.gt/cron
License: MIT License
Allow a configuration option to set a particular command to run after each cron task has completed.
This will be totally optional, but will allow for monitoring of cron's health without having to implement any additional services.
This is non-standard, but it would be nice to be able to schedule a script for every 10 seconds. At the moment, * * * * *
is equal to once per minute, which is currently the most frequent cron setting.
Setting */10 * * * *
will trigger every 10 minutes.
My proposed syntax for every 10 seconds:
*:10 * * * *
The colon is obviously different than the slash, and is already used in time formats, so it shouldn't be too difficult to understand what this does without reading the docs.
An --explain
flag would be brilliant. It would list out the cron jobs you have in the crontab file and explain when they will run.
Example output:
0 0 * * FRI /backup At 12:00 AM, only on Friday
0 * * * * /clean-cache Every hour
05 01 * * SUN#1 At 01:05 AM, on the first Sunday of the month
The validate command has been created to output OK on no errors and pass the original parse exception on error. There are currently no tests in place for this.
This is a weird one, but very reproducable by running gt create
(which puts a blank crontab) and then gt run
.
Linux crontab supports replacing the date/time columns with @reboot
to indicate that the script should be run once on reboot.
As a new feature, @background
can be used to indicate that the script should be run forever in the background (waiting for the process to finish before starting again).
@start
can be used to indicate that the script should be run once at the start of the server starting.
This may already be the case, but it's worth double checking and putting in the documentation.
The way the Linux cron system works is that all tasks are run concurrently. This needs to be the case for this project too.
Imagine there are some background scripts that take 20 seconds to run. Put them in on the crontab to run every minute, and they should be completed concurrently within their 20 second execution time... however if they are not run concurrently, more than three scripts will overlap into the next minute, and things will catch fire rather quickly.
Dependabot needs to be tamed, as per PhpGt/WebEngine#568
A bin file in the vendor/bin
directory should be created that allows creating and installing the relevant .service
file for the systemd process to call the correct cron processing script.
It's fine to not have a crontab file. There shouldn't be an error.
Just ran 1 job, next job at: 21:16:00.
It would be nicer if it said "Just ran 1 job (script/cache/refresh)"
The "next job at" can be on its own line.
On the second and subsequent task runs, the "next job at" time is incorrectly showing the first job's time.
Pass a flag such as --all
to run all of the cron tasks instantly when cron is called. Useful for local development.
It would be nice to be able to treat cron scripts in the same way as we do Page Logic files, almost as if (or maybe completely as if) the scripts are being routed.
Inside the crontab file, we could have something like the following:
0 5 * * * /cache?type=db&mode=daily
This would be triggered at 0500 every day, and it makes sense to store this script in the cron/cache.php
file.
Inside the file, it can behave completely like any other go function:
<?php
use Gt\Input\Input;
function go(Input $input, Database $db):void {
if($input->getString("type") === "db") {
$db->clean(); // or whatever...
}
}
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.