agilord / cron Goto Github PK
View Code? Open in Web Editor NEWA cron-like time-based job scheduler for Dart
License: BSD 3-Clause "New" or "Revised" License
A cron-like time-based job scheduler for Dart
License: BSD 3-Clause "New" or "Revised" License
Hi isoos! Thx for this great package and I have some question about it.
Can this package support os side cron schedule? For example, I have a task to do and I turned on notification with cron, then I will wait for notify. But before I start my task, there's something more important that I have to cancel this task.
As #4 said, cancel a schedule is easy, but I want to know if it's possible to set a schedule or cancel schedule after reopen the app?
does cron plugin support windows desktop app?
I'm trying to schedule a job that runs every weekday at 7:00, and this is the corn string I'm using: 0 0 7 ? * MON-FRI * which should work but I get an error when scheduling, example:
final cronString = '0 0 7 ? * MON-FRI *';
final cron = Cron();
cron.schedule(Schedule.parse(cronString), () async {
// do something
});
When I run the above code this is the error:
Exception: Unable to parse: ?
#0 parseConstraint (package:cron/src/constraint_parser.dart:36:3)
#1 new Schedule (package:cron/cron.dart:76:9)
#2 new Schedule.parse (package:cron/cron.dart:96:12)
#3 main (package:dart_oil_job_sync/main.dart:13:26)
#4 _startIsolate.<anonymous closure> (dart:isolate-patch/isolate_patch.dart:299:32)
#5 _RawReceivePortImpl._handleMessage (dart:isolate-patch/isolate_patch.dart:168:12)
Should I use some other syntax? Is there an example?
How to schedule cron to run on mid night every day 12am?
main() {
final cron = Cron();
cron.schedule(Schedule.parse('*/3 * * * * *'), () async {
print('every 3 sec');
});
cron.schedule(Schedule.parse('*/5 * * * *'), () async {
print('every 5 min');
});
}
The every 3 seconds cron won't work in above code. Seems like if there is a minute scheduled task in the same cron then seconds scheduled task is ignored.
If i dont need to, then what time zone it will be?
Hi, I have a question: if the screen goes off/screen is locked, does the cron job still execute every X minutes?
新增秒功能,请问如何使用秒?有实例吗?
Hi Isoos,
Thanks for the package and sorry bothering, but I am not a cron expert, so I've got a couple of questions...
Cron job is not working in background.I scheduled the
Parse does not support special characters such as '?' or 'L' and 7-part string format (0 30 9 ? * 4,7 *)
hi.
thank you for your package help me a lot.
can you add/release please new method to check if isRunning ?
regards,
Tomer.
I want to give my users the ability to set the cron job to run at their day and time specifications. I have that working properly, but I'm left with multiple scheduled cron jobs. I would like to invalidate the previous cron job so that it doesn't run anymore at all. I had hoped that calling close() would kill the old process, but, as stated in the docs, it only prevents that instance from getting new scheduling.
I have a cronjob class that has the variable final cron = new Cron() and I schedule from another class.
How can I completely kill any previous scheduling so I can start fresh for scheduling?
add support to execute task in isolated (in background outside the main thread)
First of all, I'm not asking it to be work in the background.
There was already a closed issue #9 , but I believe it shouldn't have been closed.
The question asked there is what I want to learn.
Q:
Hi. Does this plugin run process in background, when the app is closed?
Or does it run when app is in foreground only?
Not much information is given.
A:
Hi, this package is for server-side apps, which run for a longer time. I'm sorry, but I have no idea how to achieve the same in a mobile app.
The answer assumes the user wants to use this in background and tries to achieve that functionality. However, question simply wanted to learn the behavior.
I think this information is crucial and should be in the readme.
Cron is doing the most different and new thing, Thanks to the @agilord
There is no other software, better than Cron, in the pub. dev.
People are coming to use cron
as for background processes,
People are loving the foreground processes of the cron,
I am a developer who loves to work with cron and its easy-to-use interface.
People are giving the signal, that they want background processes as soon, because there are not better packages that are efficient like cron,
Why Don't we develop Cron to background Processes,
Just ask ourselves, for how long we are gonna say Cron as Server-side Development Package?
@agilord has developed a great technology and it is the best in the field,
By using Different Packages that already exist, ex, work manager, move_to_background, flutter_background we can achieve this easily.
People are giving the signal, that they want background processes as soon, because there are not better packages that are efficient like cron,
Hello, i cannot understand how to do a cron job to run every second or every 5 seconds. You help would be very much appreciated. Thanks.
Current method:
bool shouldRunAt(DateTime time) {
if (seconds?.contains(time.second) == false) return false;
if (minutes?.contains(time.minute) == false) return false;
if (hours?.contains(time.hour) == false) return false;
if (days?.contains(time.day) == false) return false;
if (months?.contains(time.month) == false) return false;
return true;
}
Shouldn't it be more like:
bool shouldRunAt(DateTime time) {
if (seconds?.contains(time.second) == false) return false;
if (minutes?.contains(time.minute) == false) return false;
if (hours?.contains(time.hour) == false) return false;
if (days?.contains(time.day) == false) return false;
if (weekdays?.contains(time.weekday) == false) return false;
if (months?.contains(time.month) == false) return false;
return true;
}
Hello, First of all, This Plug-in is just awesome and thanks a lot for that.
Please can you let me know that if the Cron will still run if the App is terminated (Force Stopped) or the Mobile is restarted?
I am using your library to auto-update data on a schedule in a web page: https://mixolyde.github.io/blaseballstatus/.
It works great, but I would like to be able to get the next time that the cron job is scheduled to go off so I could display something like 'Next Update Time: Oct 5 2145' or whatever.
hi , why when i start two cron use one Cron instance like below:
one cron is every twenty seconds to print something; anothre cron is every two minutes to print something
then the print is unexpected, the two minutes print will print 60 times every two minute;the twenty seconds print seems ok
Isn't it a bug??? it should print one time at every two minutes, why it print so many times at every two minutes???
Hi. Does this plugin run process in background, when the app is closed?
Or does it run when app is in foreground only?
Not much information is given.
Thank you.
How can i schedule crone
After 15 minutes the first time
And than after each hour
until it is closed by user
Hi
So I need to get call back every 5 seconds
How can I manage to do that?!
Currently when parsing a schedule the cron library throws an Exception when a parse fails.
This is difficult to catch as it is too generic.
Can we replace this with a specific exception such as:
ScheduleParseException
ParseException
or maybe FormatException - not my preferred as it is used by other functions.
Hi amazing developers,
The functionality of this package seems complete, but the structure of the package appears somewhat complex.
So shouldn't it be refactored to the extent that there are no destructive changes?
For example, most implementations are currently in cron.dart
under the lib
folder, but these should be splitted per class and stored in lib/src
.
This alone would make the package much more maintainable.
Thank you.
Hey, love the cron package, perfect for what I need and easy to use apart from this one question -
is there a manager or viewer for cron jobs?
I created a cron schedule in my flutter app but as I'm testing I have made changes to it, in affect I assume, creating a new schedule (maybe?) Now the command seems to trigger at a time I've never set so I'm wondering how can I view/edit/delete schedules?
working in fore ground and back ground properly but not working in Terminated / Kill state
cron.schedule(Schedule.parse('0 * * * *'), () async {
//my code
});
above code is always throwing exception
clock (https://pub.dev/packages/clock) + fake_async (https://pub.dev/packages/fake_async) allows mocking of current time. It would be nice if cron could use clock.now()
instead of DateTime.now()
to allow the same.
If you are interested in this but have no available time right now, I can try to implement it myself.
I want run core after 30 seconds how can i do that
As I understand it, the scheduler works by setting a timer to go off every second.
The problem with this is that in an async environment, a compute-heavy workload can result in the timer being delayed.
When doing a seconds-based schedule this can mean that the task may never be run as the scheduler checks that the current time = the schedule no. of seconds.
The result is that cron is unreliable for seconds based scheduling and may be unreliable for minutes based scheduling if a very heavy process is run.
Ideally, we need to guarantee that tasks are run, even if they are late.
When Device is Screen Off, it not works . How should I do it?
Currently, it is not possible to set :
15/2 => Every 2 hours starting at 3pm....
For example :
'* 15/2 23 12 *' => Should be : Every 2 hours, starting from 23/12 at 3PM...
Is it scheduled for a next release ?
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.