Note: Please go to docs.rightscale.com to access the current RightScale documentation set. Also, feel free to Chat with us!
Home > Guides > Dashboard Users Guide > Design > RightScripts > Actions > Run a RightScript on a Server

Run a RightScript on a Server

Objective

Manually run a RightScript on a running server(s). 

Notes: You cannot run a RightScript on an inactive or "stranded" server.  You can only run a RightScript on an instance that was launched using the ServerTemplates model.

Table of Contents

Prerequisites

An operational instance that was launched and configured with a ServerTemplate.

Overview

One of the more common tasks when managing a running server is modifying its Inputs and then executing (running) a RightScript that passes the new Input parameters to the server. You also have the ability to run a RunScript on multiple servers at the deployment level. 

A RightScript can be run at different levels:

  • Server - Run a script on a single running server
  • Deployment - Run a script on multiple/all running servers in a deployment
  • Server Array - Run a script on the oldest server or all servers in the array


A RightScript can either be run automatically or manually:

  • automatically - Boot and decommission scripts are run in sequential order when a server is launched or terminated, respectively.  A RightScript can also be executed using the 'run_rightscript' action of an Alert Escalation when an alert is triggered.
  • manually - There are several different ways to manually execute a script (on-demand) on a running server. 
    • Run a boot/operational/decommission script
    • Run a RightScript using the 'Any Script' option
    • Run a RightScript from the command line ('rs_run_right_script')

Steps

Run a boot/operational/decommission script

Any script listed under the boot/operational/decomission script list can be manually run on-demand. Go to a running server's Scripts tab.  (Manage -> Servers -> Active tab)

Execute (run) one of the listed boot/operational/decommission RightScripts by clicking the 'Run' action icon.  A server will inherit its list of available RightScripts from its ServerTemplate. 

screen-RunRightScript-v1.png

You can track the status of the executed action under the server's Audit Entries tab.

Run a RightScript using the 'Any Script' option

You also have the ability to use the 'Any Script' option to run any RightScript in the RightScale account on the running server that is not listed in its ServerTemplate.

See Run 'Any Script' on a Server(s).

Run a RightScript from the command line ('rs_run_right_script')

You can also SSH into an instance and run a RightScript from the command line of a server using the 'rs_run_right_script' command, although it is not a recommended best practice.  This option may be useful for users who are developing or testing RightScripts or ServerTemplates, but it should only be performed by advanced users.

Note: If you use rs_run_right_script with the -p option, you must pass a COMPLETE set of input values in which case the input values that are defined on the server are not merged. If you omit any inputs, e.g. do not use -p, then the values defined on the server are used. However we do not provide a way to mix and match

You can SSH into an instance and run the following command to manually run a script.  

Note: You will only be able to run a script that is currently listed in the server's ServerTemplate. You cannot use this command to run any script in the RightScale account.

# rs_run_right_script --name 'WEB Apache (re)start - 11H1'"

One of the problems with using this option to run a script is that a complete audit entry will not be generated. When a script is run using this method an audit entry is created and displayed in the dashboard, however the user who executed the script cannot be absolutely identified. Notice in the example screenshot below that the user who executed the script from the command line is listed as N/A.

screen-RunRightScriptAuditEntry-v1.png

You might argue that the user who ran the script is obviously the last person to SSH into the server, however it is possible to SSH into an instance outside of the RightScale system especially if a user has the right authentication information and the instance's firewall permissions are not set up to prevent it. Therefore, in such cases it's often impossible to positively identify who actually ran the script. 

Remember, one of the key benefits of using the RightScale cloud management platform is that fact that user actions are properly tracked and recorded. Therefore, as a best practice you should always perform manual actions from within the dashboard so that all user actions can be properly tracked and recorded.

You must to post a comment.
Last modified
22:34, 16 May 2013

Tags

Classifications

This page has no classifications.

Announcements

None


© 2006-2014 RightScale, Inc. All rights reserved.
RightScale is a registered trademark of RightScale, Inc. All other products and services may be trademarks or servicemarks of their respective owners.