How to run cypress tests at a particular time of the day? - time

I want to run a cypress test at a particular time of a day or I want to schedule the test to run every 30 minutes for example. How can we achieve this?

I think the only way to do this would be to deploy your tests to a server and run them on some sort of cron job. You could do this locally, as well, but it makes the most sense to run them inside of a container or virtual server.
Hope this helps, let us know how it goes!

Related

How to run command after hours from controller action in laravel?

I need to notify users of incoming end time of created data. Let's say need to notify the users after 3hrs of created data. But I dont want to run cron job every hour because this will slow down the system.
You can queue a command then add a delay to it.
use Illuminate\Support\Facades\Artisan;
Artisan::queue('your:command')->delay(60 * 60 * 3);
I haven't tried to delay a queue for hours. That's why I think a scheduled task is more reliable as you know the time when it runs.
Laravel has a Task Scheduler pretty efficient to work with cron.
You only have to configure it once to run once a minute and Laravel does the rest for checking when it needs to run.
The syntax is pretty simple and you find all available configurations on your codebase.
https://laravel.com/docs/9.x/scheduling
This hardly slows down the system since Laravel only runs the necessary.

How can you program a cronjob to run only ONCE after 12am and 12pm

I am given the following problem:
There are two shifts. One shift starts at 12am and the other at 12pm.
At the beginning of each shift, generate some tasks (details not important).
Ordinarily, this is a trivial problem that can be solved with crontab. However, my company is running on Heroku and the Heroku Scheduler has the following interesting properties:
It can only run every 10 mins, hour or daily,
You cannot time when the scheduler will actually start. If you scheduler is running every 10 mins, all you can expect is that it will run between 4:00am to 4:10am.
It is possible that the scheduler encounters some error and crash. When this happens, the scheduler will restart immediately. As an example, if the scheduler crashed at 4:00 while it was running, it might run again at 4:01.
Is it possible to implement a cronjob that:
executes once only once after 12am and 12pm
without needing a database to track its execution time?
One way I can think of doing this would be to have some cron server (not on Heroku) which runs a script at 12am and 12pm.
The script invoked by the cron could use the Heroku Platform API to spin up a one-off dyno in your Heroku app (using the Dyno Create endpoint).
This method satisfies your requirements of executing only once at 12am and at 12pm, WITHOUT using a DB to track execution times.
The drawback of this method is that it is not a "pure Heroku" solution, and requires you to maintain some "external" server to trigger your cron jobs.
If you don't like the ideas of maintaining your own cron server for that, you could use some cloud solution to schedule your script. For example, I would imagine you could do this for free using AWS Lambda with Scheduled Events.
In this case, you would schedule your lambda function to run each day at 12am and 12pm, and your lambda function would spin up your Heroku one off dyno.
Of course if you would be willing to add some form of DB to your Heroku app, you could easily create a "pure Heroku" solution.

joomla scheduled task run every second

how can I set a scheduled task that run every second on Joomla website?
I saw different extensions but they make only every minute, like minimum threshold.
Any idea?
If you do this with a plain extension you need enough traffic to trigger the task every second. Even then this would be unreliable. The best way to do this is using a CRON job directly on your web server. This CRON job can call a CLI script or a URL on your server.
https://en.wikipedia.org/wiki/Cron
Here are some useful pages to generate the necessary task entry:
https://crontab.guru/
http://crontab-generator.org/
If you want to run it every second you might want to check this:
Running a cron every 30 seconds
There are funny solution like using sleep to increase the cron time resolution. In addition there is a tiny script in one of the answers which might help as well.
Using a Joomla extension is not reliable at all, since someone must visit the actual website for the (fake) cron to run. So, this whole cron thing when it's a Joomla extension really depends on the traffic of your website, which makes it very unreliable especially if you are developing a mission critical functionality.
Your best option is to use a Linux cron, which cannot run every second, as the minimum for a cron to run is every minute. Any solution requiring the use of sleep or a for loop is not reliable - especially when you take into consideration that you want to run something every second. All the solutions on the Internet for running a cron every second (or less than a minute) are half baked and completely unreliable. In short, you cannot run a cron every second reliably.
An imaginary solution is to have 60 servers, each server is behind the other by 1 second, and then you run the cron from each of these servers every minute. It is important that all these servers are on the same network to prevent any lag.

Node.js Run service only at a suitable time

I made a service in Node.js which runs fine. But I've decided to make a change. Untill the time isn't between lets say 7pm and 5am, don't run the service - be in standby mode - or sleep.
Which command or method to use? Is there something specific for such cases?
NodeCron does the Job for you.
You can also try node-schedule to cron the jobs.
Thanks.

How to make a TeamCity build fail (timeout) if it takes too long?

How do we put a timeout on a TeamCity build?
We have a TeamCity build which runs some integration tests. These tests read/write data to a database and sometimes this is very slow (why it is slow is another open quesiton).
We currently have timeouts in our integration tests to check that e.g. the data has been written within 30 seconds, but these tests are randomly failing during periods of heavy use.
If we removed the timeouts from the tests, we would want to fail the build only if the entire run took more than some much larger timeout.
But I can't see how to do that.
On the first page of the build setup you will find the field highlights in my screenie - use that
In TeamCity v.9 and v.10 you should find it under the "Failure Conditions". See:

Resources