Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Gordon Saxby 1461 posts 1883 karma points
    Mar 26, 2013 @ 21:47
    Gordon Saxby
    0

    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?

     

  • Jan Skovgaard 11280 posts 23678 karma points MVP 11x admin c-trib
    Mar 26, 2013 @ 23:18
    Jan Skovgaard
    0

    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

  • Gordon Saxby 1461 posts 1883 karma points
    Mar 27, 2013 @ 11:53
    Gordon Saxby
    0

    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...

  • Tim 1193 posts 2675 karma points MVP 4x c-trib
    Mar 27, 2013 @ 12:14
    Tim
    0

    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!

  • Gordon Saxby 1461 posts 1883 karma points
    Mar 27, 2013 @ 12:35
    Gordon Saxby
    0

    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.

  • Richard Soeteman 4047 posts 12900 karma points MVP 2x
    Mar 27, 2013 @ 13:54
    Richard Soeteman
    0

    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

     

Please Sign in or register to post replies

Write your reply to:

Draft