Quantcast

Re: Running a script at regular intervals

classic Classic list List threaded Threaded
5 messages Options
redcor redcor
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Running a script at regular intervals

Gareth Adams wrote:

> As the title suggests, how can I run a Plone script every half-hour,
> for example? This script will update content which has multiple view
> actions, so I don't want to tie this to a view which checks if the
> script has been run recently - because there will be more than one
> view to keep track of in that case.
>
> All thoughts appreciated.
> Gareth
>
>
> -------------------------------------------------------
> This SF.Net email is sponsored by:
> Power Architecture Resource Center: Free content, downloads, discussions,
> and more. http://solutions.newsforge.com/ibmarch.tmpl
> _______________________________________________
> Plone-users mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/plone-users
>
there is no "official" way to do this.
There are some attempts to provide tools for such tasks, which I never
looked at in detail. I use cron jobs that call a Python Script or such
in the site.

Here is an example of file system based script that is called nightly to
do cleaup tasks.
doClenupTasks is a python script in the bowels of the site that performs
the needed chores.
You must make sure that anonymous is allowed to execute this script and
has all the rights it needs (by way of proxy roles)

Robert

#!/usr/bin/env python

"""
 URL      = call this URL
"""

import sys, os, urllib
EXIT_TEMPFAIL = 75
# Get the url to call
callURL   = 'http://xyz.fh-aargau.ch/Scripts/doClenupTasks'

try:
    f = urllib.urlopen(callURL)
    print f.read()
    f.close()
except:
    # Server is probably down or something is misconfigured.
    sys.exit(EXIT_TEMPFAIL)



-------------------------------------------------------
This SF.Net email is sponsored by:
Power Architecture Resource Center: Free content, downloads, discussions,
and more. http://solutions.newsforge.com/ibmarch.tmpl
_______________________________________________
Plone-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/plone-users
Tom Lazar Tom Lazar
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Running a script at regular intervals

hi gareth,

as mentioned in my previous response to your other post, ask yourself, if  
plone really needs to do something regularily (i.e. PROACTIVELY) or if you  
just want it to react to something in a timely manner (i.e. REACTIVELY).

in the latter case you can easily go down the path that robert suggests by  
triggering either through calling special urls (might want to pass some  
credentials, or else even search engine bots might trigger it!! See also  
my post on passing credentials via URL in plone[1])

The other trigger method is to upload stuff via ftp/webdav and then use  
the PUT method of the content object that's created to do the magic.

hth,

tom

[1] http://tomster.org/geek/plonezope/url-auth

On Sun, 16 Oct 2005 03:30:06 +0200, Gareth Adams  
<[hidden email]> wrote:

> As the title suggests, how can I run a Plone script every half-hour, for  
> example? This script will update content which has multiple view  
> actions, so I don't want to tie this to a view which checks if the  
> script has been run recently - because there will be more than one view  
> to keep track of in that case.
>
> All thoughts appreciated.
> Gareth
>
>
> -------------------------------------------------------
> This SF.Net email is sponsored by:
> Power Architecture Resource Center: Free content, downloads, discussions,
> and more. http://solutions.newsforge.com/ibmarch.tmpl



--
Tom Lazar
http://tomster.org/blog



-------------------------------------------------------
This SF.Net email is sponsored by:
Power Architecture Resource Center: Free content, downloads, discussions,
and more. http://solutions.newsforge.com/ibmarch.tmpl
_______________________________________________
Plone-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/plone-users
Jonas Nielsen Jonas Nielsen
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Running a script at regular intervals

In reply to this post by redcor
Gareth Adams wrote:
> As the title suggests, how can I run a Plone script every half-hour, for
> example? This script will update content which has multiple view
> actions, so I don't want to tie this to a view which checks if the
> script has been run recently - because there will be more than one view
> to keep track of in that case.

You can use curl. If you use a unix system you can insert something like
this in the crontab:

30 * * * *  curl --silent -u admin:adminpassword
http://127.0.0.1:8080/your_site/your_script -o /dev/null

To protect the password, you can also call curl in a script with
restricted access.



-------------------------------------------------------
This SF.Net email is sponsored by:
Power Architecture Resource Center: Free content, downloads, discussions,
and more. http://solutions.newsforge.com/ibmarch.tmpl
_______________________________________________
Plone-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/plone-users
Encolpe Degoute-2 Encolpe Degoute-2
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Running a script at regular intervals

In reply to this post by redcor
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Gareth Adams a écrit :
| As the title suggests, how can I run a Plone script every half-hour, for
| example? This script will update content which has multiple view
| actions, so I don't want to tie this to a view which checks if the
| script has been run recently - because there will be more than one view
| to keep track of in that case.

You can use TimerService et ZopeScheduler products to do this. Like it's
only Zope oriented stuff, you can put PloneMaintenance above them.

Regards,
- --
Encolpe Degoute
INGENIWEB (TM) - S.A.S 50000 Euros - RC B 438 725 632
2 cours du 14 Juillet - 78300 Poissy France - +331 300 601 41
web : www.ingeniweb.com - « les Services Web Ingénieux »
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.2 (GNU/Linux)

iD8DBQFDUnyzvFPzBBlIZMMRAlcSAJ40QodSvmI+ZWgLr+EEAHxeVSlrvACfcomv
wYEIzbUoucR0jN1IDb20Chg=
=Ycfa
-----END PGP SIGNATURE-----


-------------------------------------------------------
This SF.Net email is sponsored by:
Power Architecture Resource Center: Free content, downloads, discussions,
and more. http://solutions.newsforge.com/ibmarch.tmpl
_______________________________________________
Plone-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/plone-users
Raphael Ritz Raphael Ritz
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Running a script at regular intervals

In reply to this post by redcor
Gareth Adams wrote:
> As the title suggests, how can I run a Plone script every half-hour, for
> example? This script will update content which has multiple view
> actions, so I don't want to tie this to a view which checks if the
> script has been run recently - because there will be more than one view
> to keep track of in that case.
>
> All thoughts appreciated.

http://www.plope.com/software/ClockServer/

is another option of yours

Raphael

> Gareth
>
>
> -------------------------------------------------------
> This SF.Net email is sponsored by:
> Power Architecture Resource Center: Free content, downloads, discussions,
> and more. http://solutions.newsforge.com/ibmarch.tmpl



-------------------------------------------------------
This SF.Net email is sponsored by:
Power Architecture Resource Center: Free content, downloads, discussions,
and more. http://solutions.newsforge.com/ibmarch.tmpl
_______________________________________________
Plone-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/plone-users
Loading...