Creating a cron job to start plone

I need to create a cron job to restart my plone site. I have this so far:

10,30,50 * * * */home/lwhsboosters/webapps/boosters/zinstance/bin/./instance start

I know the path is right and I know is SSH the "./instance start" is the proper command from the 'bin' directory.

Will this work as a cron job?

I think you likely want "restart" instead of "start" as your zctl command.

My recommendation is to consider using supervisor, plus maybe superlance if either: (a) you have more than one instance; (b) you have a need to manage restarts in any way other than manually. These can easily be integrated with your buildout.

Sean

2 Likes

supervisor is what I've been seeing lately

For old sites on old Linux distros, I used to make my own restart scripts.

Definitely do not start your sites on a schedule; REstart them maybe. Even then, you shouldn't have to restart them frequently... a long time ago there were more memory growth issues but not lately.

as @seanupton mentioned, you must use supervisor AND superlance.

there are 2 main reasons you may want to restart an instance automatically:

you should try to avoid doing it in the first case because, as we discussed on a previous thread, this is a costly process; you better adjust the number of objects in the ZODB cache.

be careful with httpok: I run it only once an hour, because it can restart your instance under some heavy load circumstances and things can get ugly; also, Zope is rock-solid and it's quite difficult to find a blocked instance.

we have instances that have been running for many months, or even years, without restarting them.

here you have a typical buildout configuration for it: