Copied to clipboard

Flag this post as spam?

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


  • Robin Hansen 135 posts 368 karma points
    Jan 28, 2013 @ 12:16
    Robin Hansen
    0

    Delete text-strings as a scheduled job/cron job

    I´ve created a VERY simple page to write a newsletter in - this page generates a simple rss feed from where an external partner creates the newsletter.

    My question is - can I somehow have the content in the two text-fields (Title, Description) deleted on a daily basis as a scheduled task, lets say at 12:00 pm each day...?

    Have this kind of customization ever been made to the API...?

     

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

    Hi Robin

    I believe it's a matter of writing a service or something that is instructed to delete the content in the above fields and the configure the scheduled task in the umbracoSettings.config section <scheduledTasks>.

    But be aware that if for some reason the webserver is down the tasks of course won't run.

    Hope this answers your question.

    /Jan

  • Nigel Wilson 945 posts 2077 karma points
    Jan 28, 2013 @ 18:55
    Nigel Wilson
    0

    Further to Jan's post, the scheduled Task that he describes will only work when the application pool is active (as opposed to the server being down). 

    So if your site does not get much traffic it is likely that the application pool will be "asleep" and the scheduled task will only run once someone browses your site. 

    To "fudge" site activity you could use something like pingdom to ensure the site is working.

    However the above is a bit clunky.

    The alternative would be to create a scheduled task on the server to run a URL at a specified time each day.

    If you are on a shared hosting environment sometimes you have an option to load a scheduled task within your control panel. I have never done this personally.

     

    If you have access to the server then "Administrative Tools" - "Task Scheduler" is where you can load a task. The way I have achieved this is to write a visual basic script to run the webpage - the scheduled task is then loaded to the run the VB script. The code below is what I use for this process.

    Call LogEntry()
    Sub LogEntry()

    'Force the script to finish on an error.
    On Error Resume Next

    'Declare variables
    Dim objRequest

    Dim URL
    Set objRequest = CreateObject("Microsoft.XMLHTTP")

    URL = "http://www.mysite.com/base/restExtReporting/reportWeekly.aspx"
    objRequest.open "POST", URL , false
    objRequest.Send

    'Set the object to nothing
    Set objRequest = Nothing

    End Sub

    The file should be saved with a "vbs" file suffix

    Hope this helps.

    Nigel

  • Robin Hansen 135 posts 368 karma points
    Jan 30, 2013 @ 12:25
    Robin Hansen
    0

    Hm - I need some additional infoes to this... - the names of the textfields is: rssTitle and rssDescription.

    The website is getting enough visits pr. day - so I would'nt worry about that.

    Can I write the script in c# and put it in the App_Code folder - if yes, how would the script look like...?

  • Tam 1 post 21 karma points
    Dec 29, 2013 @ 05:29
    Tam
    0

    Sometimes external scheduled task service like http://www.easycron.com built with many enhanced features is handy for use and powerful too.

  • Richard Soeteman 4049 posts 12922 karma points MVP 2x
    Dec 31, 2013 @ 07:37
    Richard Soeteman
    0

    You could try using my taskscheduler package, maybe?

Please Sign in or register to post replies

Write your reply to:

Draft