Jump to:

22977 Posts in 11742 Topics by 2826 members

General Questions

SilverStripe Forums » General Questions » How to run an admin task as a scheduled task on Windows [SUSSED]

General questions about getting started with SilverStripe that don't fit in any of the categories above.

Moderators: martimiz, Sean, biapar, Willr, Ingo, swaiba, simon_w

Page: 1
Go to End
Author Topic: 270 Views
  • simples
    Avatar
    Community Member
    76 Posts

    How to run an admin task as a scheduled task on Windows [SUSSED] Link to this post

    Does anyone know how I could run

    dev/buildcache?flush=1&force

    each night on a PC which is running Windows 2003?

    Thanks.

  • simples
    Avatar
    Community Member
    76 Posts

    Re: How to run an admin task as a scheduled task on Windows [SUSSED] Link to this post

    I did not expect this to be so challenging!

    The following command

    d:/wamp/bin/php/php5.2.11/php d:/vhosts/buckfastleigh/sapphire/cli-script.php dev/buildcache flush=1 force=1

    which I have issued at a dos prompt has so far taken 6 hours to publish 14 out of 17 pages. This operation takes seconds when issued in the browser after logging in.

    Rather than trying to jump though all the hoops which running cli-script.php involves I think my preferred option would now be to run the command from my browser by bypassing authentication through checking IP address and script name.

    However even this appears to be difficult in so far as I am struggling to find in which script I can add logic to stop the login page from appearing.

    I will probably get there in the end but why does this have to be so time consuming? So far I have spent all day on this.

  • simples
    Avatar
    Community Member
    76 Posts

    Re: How to run an admin task as a scheduled task on Windows [SUSSED] Link to this post

    Ok, after 2 whole days of trying various things I think I have this sussed.

    I inserted the following line at the top of Security::permissionFailure

    if(stristr($_SERVER['QUERY_STRING'],'buildcache') && $_SERVER['REMOTE_ADDR']==$exempt_ip)return;

    where $exempt_ip is the IP address which runs the script.

    I am running Version 2.4.7.

    PS. For some reason the script would only complete and create the cache files if the script's url contained a trailing slash.

    e.g. dev/buildcache/?flush=1&force

    270 Views
Page: 1
Go to Top

Want to know more about the company that brought you SilverStripe? Then check out SilverStripe.com

Comments on this website? Please give feedback.