Book Image

OpenShift Cookbook

By : Shekhar Gulati
Book Image

OpenShift Cookbook

By: Shekhar Gulati

Overview of this book

Table of Contents (19 chapters)
OpenShift Cookbook
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Running OpenShift on a Virtual Machine
Index

Adding a cron cartridge to an application


In this recipe, you will learn how to add the cron add-on cartridge to your application. The cron cartridge will write the output of the quota command to a file every hour. The database and other cartridges will be covered later in this book.

Getting ready

To prepare for this recipe, you will need rhc installed on your machine. Also, we will make use of the OpenShift application created in the Creating an OpenShift application using the rhc command-line client recipe.

How to do it…

Perform the following steps to add a cron cartridge to your application:

  1. Open a new command-line terminal and run the following command:

    $ rhc add-cartridge --cartridge cron --app myapp
    
  2. Create a new file quota.txt in the application root directory and populate it with the following code. On a *nix machine, you can use the cat command, as shown in the following command line:

    $ echo "# Quote File" >> quota.txt
    

    On Windows machines, you can use filesystem explorer to create...