Why Cron cartridge does not have access to mysql cartridge environment variables in OpenShift?

Solution Verified - Updated -

Issue

After write a cron job that uses OPENSHIFT_MYSQL_* environment variables it returned an error because they were not set. Below is the example script:

#!/bin/bash

env | grep OPENSHIFT_MYSQL >> ${OPENSHIFT_RUBY_LOG_DIR}/env.log

After the cron job runs the content of env.log is blank. This only happen when the application was set to autoscaling.

Is there a way to make this work?

Environment

  • Openshift Online
  • OpenShift Enterprise
    • 1.2
    • 2.0

Subscriber exclusive content

A Red Hat subscription provides unlimited access to our knowledgebase, tools, and much more.

Current Customers and Partners

Log in for full access

Log In

New to Red Hat?

Learn more about Red Hat subscriptions

Using a Red Hat product through a public cloud?

How to access this content