Is there anyway to schedule a macro in Umbraco or a .ascx file to run every hour?
thanks
Is there anyway to schedule a macro in Umbraco or a .ascx file to run every hour?
thanks
There are two ways to run scheduled tasks in Umbraco:
umbracoSettings.config
. See Scheduled Tasks from the Umbraco Wiki.TaskScheduler provides a nice interface to setup tasks in the Umbraco backend. You can schedule tasks to run at specific times and you can set the recurrence. It also can send emails when tasks are executed.
Adding tasks to umbracoSettings.config
may be simpler. Below is an example:
<scheduledTasks>
<!-- add tasks that should be called with an interval (seconds) -->
<task log="true" alias="test60" interval="60" url="http://localhost/umbraco/test.aspx"/>
</scheduledTasks>
If you want to run a macro, ascx (or cshtml for that matter) from code you can use the macroservice package. With this installed you can then run macros directly from code, using web services, WCF, setInterval/setTimeout from javascript etc. Would work well with @DouglasLudlow's (+1) suggestions for setting up Scheduled tasks.
Umbraco Macro Service exposes standard Umbraco Macros directly to the web for use in scripts or to provide direct data access to data using the already familiar Macro.
Similar to the Umbraco Base (and heavily borrowed against), Macro Service makes it easier to access your umbraco data for use in your javascript and other applications.
See the project page at http://our.umbraco.org/projects/backoffice-extensions/macroservice for more details.
© 2022 - 2024 — McMap. All rights reserved.