I need to create a job that runs daily and looks for nodes that have a date (user data, not published date) a set number of days in the future (e.g. 40 days).
The clients previous site did this with a SQL stored procedure (non Umbraco site).
What options are there and is there one "best" option? I know Umbraco has scheduled tasks, but I've read that it relies on the site (hence Umbraco) being frequently accessed. The job needs to collect nodes that match and send emails out using data collected from those nodes.
Create an aspx page? Write a C# / C++ program? Could I use /Base?
I think you should be able to make a service (.ashx) and then use the built in windows scheduler to set up a job that is run at a certain interval calling your service so it can do it's magic.
That way you're not relying on the website being hit.
Unfortuantely, if you want to check Umbraco nodes etc, you currently have to do it within the context of the Umbraco site, as you need the umbraco site context to do it.
I know that there was some work done to try and make it possible to call API methods without needing to be in the site the site, but I don't think that it's part of the core yet. The way we normally do stuff like this is to write a web page that runs the script, and put it into a folder on the site that the anonymous IIS account doesn't have access to, and then write a simple command line app that calls the URL, passing int the correct windows authentication. That works pretty well and is reasonably secure as it's behind a windows login.
Run a scheduled job
I need to create a job that runs daily and looks for nodes that have a date (user data, not published date) a set number of days in the future (e.g. 40 days).
The clients previous site did this with a SQL stored procedure (non Umbraco site).
What options are there and is there one "best" option? I know Umbraco has scheduled tasks, but I've read that it relies on the site (hence Umbraco) being frequently accessed. The job needs to collect nodes that match and send emails out using data collected from those nodes.
Create an aspx page? Write a C# / C++ program? Could I use /Base?
Hi Gordon
I think you should be able to make a service (.ashx) and then use the built in windows scheduler to set up a job that is run at a certain interval calling your service so it can do it's magic.
That way you're not relying on the website being hit.
Hope this helps.
/Jan
I'm thinking that a C# program might be the best option ... it should run faster (?) and it won't be Internet facing, making it secure / private...
Unfortuantely, if you want to check Umbraco nodes etc, you currently have to do it within the context of the Umbraco site, as you need the umbraco site context to do it.
I know that there was some work done to try and make it possible to call API methods without needing to be in the site the site, but I don't think that it's part of the core yet. The way we normally do stuff like this is to write a web page that runs the script, and put it into a folder on the site that the anonymous IIS account doesn't have access to, and then write a simple command line app that calls the URL, passing int the correct windows authentication. That works pretty well and is reasonably secure as it's behind a windows login.
Hope that helps!
Ah, OK, good point! I guess one (bad) work-around would be to access the DB directly! (nah, too scary / complicated ;-)
I already do something simiar to that (call a web page from the scheduler) on other (non-Umbraco) projects, so maybe that is the best way to go.
Hi Gordon,
You might want toc checkout this taskscheduler package I wrote ages ago also http://our.umbraco.org/projects/developer-tools/taskscheduler Just schedule an url.
Cheers,
Richard
is working on a reply...