I have an app hosted on Heroku and this app need to run some task several times per day, lets say 4 times (and in the best way - I would like to set up, which hour will be the task run - eg. 1. task at 1AM, 2. at 5AM, 3. at 11AM and 4. at 8PM).
Heroku offers the addon called Scheduler. Is there any way to run tasks by the time scheme above?
You can run the scheduler hourly but you'd need to check what hour it currently is via;
[1,5,11,20].include?(Time.now.hour)
in the task that you want to run to have it run at 1am, 5am, 11am and 8pm as per your question.
Related
I am using Advanced Scheduler to schedule a cron job daily once at 12 PM. But the code executes automatically even though I have disabled the trigger and disconnected my GitHub repository. So far the code has executed three times in an interval of 2 hours.
I don't understand why it is executing automatically?
Any idea?
I try to run a task withoutOverlapping but the task still called every minute even if i add
->withoutOverlapping()
Here is my task i have a sleep(240) to force the task to be longer than 1 min but the mails is still sent every minutes
$schedule->call(function() {
$user = User::find(4);
Mail::to('john.doe#gmail.com')->queue(new AccountConfirmation($user));
sleep(240);
})->name('update_game')->withoutOverlapping(20);
I use heroku with a scheduler here are the logs : the task "update_game" run every minutes even if the task takes more than 1 minute (with the sleep(240)) i wonder why
The Heroku scheduler starts a brand new dyno (basically, a server) every time it runs.
->withoutOverlapping() only applies to the current server, so it's not doing anything, because the next minute another server is running.
You'll want to call ->onOneServer() too, but to do that, you'll need to move off the file driver onto something like redis for your caching system, or you'll have the same problem - one server not knowing anything about the other, because they each have their own set of files.
I want to run a load test on my server. I have built couple of different test plans and I need to execute all the test plans at the same time.
I'm using a few instances of JMeter on three different machines and I'm trying to figure out whether I can schedule my JMeter scripts to be started at a certain time?
One way would be to run, on each of my machines, a script in which I run my JMeter test plans at a certain time
The reason I decided to not use JMeter in master/slave mode is that each of my test plans would generate a load from different parts of my application. So I need each of my JMeter instances to run a different Thread Group.
If you don't want to install software as Jenkins
You can schedule jmeter execution in exact time using crontab, example:
Schedule a cron to execute at 2am daily.
This will be useful for scheduling database backup on a daily basis.
0 2 * * * /bin/sh backup.sh
Depending on your operating system:
Windows: Task Scheduler
Linux: crontab
MacOS: launchd
You can also consider installing a CI/CD solution like Jenkins, BuiltBot or CruiseControl which provide VCS system integration as well as possibility to schedule builds at the specific time or run basing on various triggers.
a solution to my question is to use "at" command which allows us to schedule a job at a certain time. Since I needed my test script to be executed only once, I decided to take this approach.
For example, following command would schedule a task at 12:01 PM (you need to make sure that your user is assigned all the required permissions to run this job)
echo "JMETER_HOME/jmeter -n -t MT_TEST_PLAN.jmx -l MY_TEST_RESULT.jtl" | at 12:01 PM
Although, I do not support the usage of Jmeter GUI for executing load tests, it depends with how many users you are executing. If the user load is small, you can use Start Time/End Time in the Threadgroup.
If you are using windows machines to execute load test, you can use windows task scheduler to run load tests at some specific time.
I used heroku scheduler to automate tasks but it seems it's not working as it described
see this
although the frequency is set to hourly
the interval between last run and next due is 5 hours
what's going on here?
Any help is appreciated!
In my case, i just had to create another task, hourly from the beginning, and it worked. The old schedule was removed as the new one started to work.
In the selection of how often I want to run my action the only options are "Daily", "Hourly" and "Every 10 minutes".
Thanks! I want to run the Scheduler for my Rails 3.1 app.
Not an elegant solution, but you could schedule it to run daily and check the date is the first of the month at the start of your job before actually doing the work.