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 of over 48,000 articles and solutions.

Current Customers and Partners

Log in for full access

Log In
Close

Welcome! Check out the Getting Started with Red Hat page for quick tours and guides for common tasks.