Best way of creating a scheduled Live/UC page

What is the best way of getting a page to go Live at say 4pm and then Under Construction at 8pm and get this to repeat daily.


(I've previously posted about this using triggers, slowly it slips out of sync so I'm looking for advice on a better way to do it)



Thanks


The only way I can think of doing it is with triggers, or custom development. You could perhaps write a piece of custom XML that triggers the change status trigger action on your asset(s) and then use crontab to fire it perhaps. This would be (ab)using the import_from_xml.php script, which essentially just runs XML-defined trigger actions.

This is an interesting approach but it think it would work.
Create 2 Triggers (trigger 1 and trigger 2):



Trigger 1



event: Asset Status Change,

condition: Assetid == page AND Asset Status is Live

Action: set Future status: Set status to Under Construction 4 hours after the trigger is fired.



Trigger 2



event: Asset Status Change,

condition: Assetid == page, AND Asset Status is Under Construction

Action: set Future status: Set status to Live 20 hours after the trigger is fired.



These triggers should be enabled the first time you set your page Live manually at 4PM on a particular day. This should repeat everyday, one fires after the other :wink:

Hi Huan,


That's pretty much what I had when I tried it before except I did not have the 'AND Asset Status is Live' in the condition which I have now added.



What I found was after the first time the page Live then UC 4 hours later the next days Live time had dropped back by two hours to 2pm, the following day it dropped back to 12pm, the next 10am and so on which is very strange.



I'll try again today and see what happens over the weekend.





Thanks for your help :slight_smile:

Hi, how often does your cron run? because i would say the cron would not change the status of the asset right away when it reaches 4 hours or 20 hours interval, rather it will run in the next cron iteration, which is 15, 30 or 60 minutes after (depends on how often your cron is setup to run), if your interval is 15 mins then probably in a day the schedule would be pushed back 30 minutes. So it would probably wiser to have an interval of 3 hours 45 minutes and 19 hours 45 minutes (instead of 4hours and 20 hours respectively). Please have a go and let me know if it works =).


Hi Huan,


over the weekend it has not slipped out of time :) - I'll keep an eye on it but so far so good.

hi Mat,
Glad to hear it's all working well =).