Utility Type Guide

From ControlTier

(Redirected from Coreutils)
Jump to: navigation, search
Technical documentation

The coreutils library provides a set of utility modules in the spirit of the GNU coreutils package. Modules within coreutils contain commands that can be used standalone or incorporated in defined commands or called from ad-hoc scripts.

davutil various WebDAV utilities
fileutil various file utilities
netutil various network utilities
shellutil various shell utilities
textutil various text utilities
modelutil various model management utilities (experimental)
logicutil various scripting logic utilities (experimental)

Contents

Usage

Utility type commands are "static" and therefore are called outside of an object context.

Command line:

All commands defined in Utility types are run like so:

ctl -p project -m util -c command [-- command-args]

Ant call:

You can invoke utility type commands from your own defined commands via the controller Ant task.

<controller>
    <execute>
      <context depot="${context.depot}"/>
      <command name="<command>" module="<util>"/>
      <arg line="<command-args>"/>
    </execute>
</controller>

Installation

The utility types are included with the other core types and will exist on your server for each project. You can use the Managed-Entity#Install-Module command to install it to the local client:

ctl -p demo -m Managed-Entity -c Install-Module -- -module <utiltype>

For example, to load "netutil" into the local project name named "demo" run:

ctl -p demo -m Managed-Entity -c Install-Module -- -module netutil

Automation with utility modules

Modules are libraries of executable commands that you can execute via the ctl shell command. These commands can be executed locally or across a set of nodes by using the -I,-X node filtering options. The ControlTier distribution includes coreutils, a library of utilities containing a variety of useful commands that work across platforms as well as provide interfaces to the facilities within the ControlTier infrastructure.

Here are a few command examples from some of the coreutils modules:

Example: Use netutil listening to check if something is responding to port "8080". Wait up to 10 seconds:

ctl -p project -m netutil -c listening -- -port 8080 -maxwait 10

Example: Use fileutil newer to check if file2 is newer than file1

ctl -p project -m fileutil -c newer -- -file file2 -target file1

Example: Use textutil replace to replace all occurrences of the string 8080 with 28080 in all files in the basedir:

ctl -p project -m textutil -c replace -- -basedir /basedir -token 8080 -value 28080

Example: Use shellutil pkill to kill all processes named "myproc":

ctl -p project -m shellutil -c pkill -- -pname myproc

Custom utilities

Of course, you are not limited to using just the commands provided by the modules here. You can create your own utilities to formalize some of your routine procedures and share them with others as a module (see First type module).

Personal tools
Namespaces
Variants
Actions
Navigation
Communication
Development
Toolbox
Print/export