Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

openshift application goes idle and halts its cron jobs

Tags:

openshift

I use openshift to run a script from time to time with the cron cartridge. however, as my application has no web activity (yet) it goes idle and my process doesn't run.

one could think of an ugly solution to generate fake web-load by using another service (such as ifttt to retrieve a page constantly but this sounds wrong.

could there be a better solution?

like image 905
akiva Avatar asked Nov 12 '13 16:11

akiva


2 Answers

apparently the only way is to trick openshift to have out-coming traffic, I used a free account of https://www.site24x7.com for that

like image 166
akiva Avatar answered Nov 04 '22 15:11

akiva


OpenShift will idle your application after 24 hours of inactivity1, but you can add an hourly cron job to your app to keep itself alive.

.openshift/cron/hourly/ping.sh

#!/bin/bash

PATH=/bin:/usr/bin:/usr/sbin
app_url=http://$OPENSHIFT_APP_DNS/

curl --insecure --location --silent --fail "$app_url" >/dev/null

Assuming your app isn't already idled and won't run the cron job :-)


1 Apparently the idle period used to be 48 hours before, but now it is 24 hours according to the OpenShift pricing table. In other words, a daily pinger cron job won't do it for you.

OpenShift Pricing Chart—Free gears get idled after 24 hours of inactivity

like image 27
mxxk Avatar answered Nov 04 '22 15:11

mxxk