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

Running a command in the application's SSH session using rhc


In this recipe, you will learn how to view the gear directory listing without performing SSH into the server using rhc.

Getting ready

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

How to do it…

To run the ls command without performing SSH into the application server, you should run the following command:

$ rhc app-ssh --app myapp --command ls

The rhc ssh command is a short hand for rhc app-ssh. Both these commands allow you to SSH into an application gear.

How it works…

The rhc app-ssh command internally uses the SSH command-line client to connect with the application gear. With the SSH command-line client, you can specify the command:

$ ssh [email protected] command

The rhc command-line client provides a --command option that allows you to specify a command you want to run...