I have a scheduled rule that sends a email to users 30 mins prior to the value of a CCK date field in a node. The rule works correctly but cron only runs when a user makes a page request. I installed the ultimate cron module and set it to run cron every 1 minute but again it only runs when a user requests a page.
How can I run cron every minute so that the emails get sent without users having to visit the site for cron to run.
Not sure what version of drupal you use. For D7, when you go to Cron settings page you'll see something like:
Last run: 4 min 33 sec ago.
To run cron from outside the site, go to http://....
So, as it says, you should provide the way that this page is called by server cron service time to time and when that happens your site cron jobs will be executed.
I guess there must be some similar thing for D8 also.
And you can set server's cron from console or it may be doable from some control panel. Contact your host provider for details. There are some external cron services, some of them are even free:
https://cron-job.org/en/
Related
I'm planning on using WordPress as a headless CMS for a project and using the REST API to retrieve content. I have a few cron tasks that need to run fairly regularly within WordPress and I want to know if API calls are enough to trigger them, or if I'll need to add that functionality myself.
Edit: when I say cron I mean wp_cron
Tasks scheduled through WP_Cron are evaluated to determine if the task should be run each time the init hook is executed [1]. The init hook should be fired on every request for a URL that WordPress is configured to respond to, including REST API calls (although I can't find a definitive source to cite for this).
As such, calls to WordPress REST API should indeed trigger any code scheduled via WP_Cron and which is due to be executed per its configuration.
I have an asp.net web page which retrieves some data from database and send to the subscribed customers. And I want to do it first day of every month.
So is there anyway to call this web page every month except the windows task sheduler? My website is on AWS EC2. Can I use AWS Lambda function and cron to call this specific page every month?
You can create a Lambda function to sending a request to your site. And your site will send an subscription email to your customers.
Cloudwatch has a service call Schedule Expressions. It's do the same thing with cron but it has an option for you to trigger some AWS service at the time. In this case, you trigger the Lambda.
P.S. I think the CloudWatch's timezone is UTC, and you have to do calculate time different for it.
For more information : http://docs.aws.amazon.com/AmazonCloudWatch/latest/events/ScheduledEvents.html
I want to execute a action on the event of browser crash in asp.net. I want to destroy the item added in the cart and revert back to the original state of the application and database if the browser crashes.
How can I do this?
Sadly, not possible, due to several factors.
1) the net is stateless, that is to say that the web server has no idea about the web browser, other than that it requested something. After it's serviced the request, it has no way of communicating with the browser.
2) the browser has the same issue. Once it's asked the server for the content and got it, that's it. If the user closes their browser, or lets their session time out, or if the browser crashes, the server doesn't know about it, and the browser doesn't tell it.
3) if the browser crashes, it's crashed, so it can't send any information anywhere, on account of the fact that it isn't working any more.
You can hook into the session_end event, which will fire when a user's session ends (a session ends when the user hasn't asked for anything for a certain period of time, 20 minutes is the default for this), however there's no way to tell WHY the session ended. the users browser may have crashed, they may have closed their browser, or they may have got bored and gone to another site.
Normally I wouldn't update the application state until after a user checks out, so the basket would be the only thing I'd need to delete. To do that I set a datetime column on my cart table, and update it every time the cart is updated. I then run a scheduled task on the database every day that deletes all baskets that are older than the amount of time I keep the baskets for.
I'm building a project to send messages to users. The client wants a way to schedule these messages to be sent out at a certain time, for example, he creates the message at 2am but wants it to be sent out at 10am without his intervention, where do I begin with this sort of thing? I'm using ASP.NET MVC3, any help is appreciated.
Update
Darin has suggested Quartz.net, I've finally gotten around to attempting to set it up. But I'm not really understanding how to implement it with my web app.
I'm assuming I should be able to make an httprequest from my service to an action on my webapp, triggered by quartz. But I'm not sure how to communicate between the webapp and this service, such as sending instructions to the quartz server.
So far, I've created a windows service, set up the installers, and added the Quartz.net server 2010 solution to my service project, am I on the right track?
Using a managed Windows Service with Quartz.NET or a console application which you would schedule with the Windows task scheduler seems like a good approaches to achieve that.
Welp, there are scheduled tasks... either make a localhost request at a specific time, or write an executable/service to be called.
A possible alternative if you can't use scheduled tasks (but may be dependent upon the website being available to the Internet) is to make a remote request-maker program or use a website monitoring service. Have either of those make a request to a particular page/querystring on your site periodically. Then, make the web application perform a particular task (send an email) whenever that resource is requested.
A few free monitoring services are limited to one request every hour or half-hour, or you can pay to have it checked more often. The resource's code could be made to record the message-sending event, (thus making them only get sent once, regardless of how often the request is made)
I'm trying to model a request submission/ approval /completion scenario. I'm using a flowchart workflow hosted as a service in a console app using WorkflowServiceHost. The workflow has a service reference to a WCF Service hosted in IIS this second service interacts with the application database. I have an aspnet front end with a service reference to the hosted workflow service and call its methods from a proxy client.
The workflow is using a persistence database that I have created using the scripts provided.
The scenario is that a request for a service is made by a user. The request must be approved once by a specific person (I'm using a pick with a delay in one branch to remind the person if no decision arrives, the other branch is receive decision). For some services the request must have a second approval which can be done by any one of a pool of approvers. Once approval is all finished the request goes to a different pool of people for completion.
I have it working but 3 questions:
In the aspnet home page I have a list of requests with links to pages to approve/complete as appropriate and call methods on the proxy after which they redirect back but because it's all asynchronous I am having to manually refresh the home page to see the changed list. Am I stuck with forcing the page to refresh itself every x seconds to get around this or is there a way to make it synchronous/check state of workflow/wait for a message back? It's not terribly interactive just hitting a button and not knowing whether the action succeeded or not.
Is there a way to stop someone approving a request just after someone else in the pool has approved it? At the moment nothing happens for the second person when they hit the button (which is good). In the workflow persistence database I can see that the blocking bookmark is the next activity along (presumably set by the person who got there first) so it looks as though the second receive just doesn't happen. I have concurrency checking code in the WCF data service but this never fires because there is no attempt to update the database. I would like to be able to warn the second person that another user got there first.
My homepage list in the web app is built by querying the application database, but is it possible to query the workflow to find the status of each item, passing the item's id (I'm using the id as the correlation handle)? Is it normal to do this or do people usually just query the application database?
I guess you could create an Ajax call that would check if any state change occurs and only refresh the page when that is the case.
If you send a WCF request for an operation that is no longer valid you should receive an error, unless you are using one way messaging because there is no message to send the error back. Mind you that due to a bug in WF4 the message could be a timeout after 60 seconds. There is no real way to avoid the problem because you are checking the workflow state as persisted and letting the user do an action based on that. Even when you query the state the workflow could have been resumes but not saved yet.
Either can work but I normally query the workflow instance store as that is the closest to the actual workflow state.