Shell Scripts

The ability to deploy shell scripts into Corus and execute them remotely from the CLI has been introduced as of version 4.0. This feature is meant to further extend the centrally controlled execution of distributed processes offered by Corus.


The functionality allows:

  • Deploying a shell script into a Corus node (or multiple Corus nodes).
  • Triggering the execution of the shell script from the CLI (either in clustered or non-clustered mode).

There is no restriction on what the shell scripts do, their nature being left entirely to system administrators. One thing to note though is that the scripts are run under whichever user the Corus instance is itself being run. So if the scripts require specific permissions, it is important that these be granted to the Corus user.

Deployed shell scripts are kept under the $CORUS_HOME/files/scripts directory. This location is configurable, by modifying the corus.server.scripts.dir in the configuration file (itself under $CORUS_HOME/config directory).

Deploying Shell Scripts

A shell script is deployed to a Corus instance using the using the deploy command in the CLI, in conjunction with the following options:

  • s: the path to the shell script to deploy.
  • a: the script's alias, which is used to refer to the script later on, when executing it.
  • a: the description to associate to the script. That description is used for display purposes – not that this option is not required.

Here's an example:

deploy -s /home/jdoe/ -a restart-memcached -d “Restarts memcached"

Of course, as with any Corus command, using the -cluster option will have the effect of deploying the shell script across all nodes in the cluster:

deploy -s /home/jdoe/ -a restart-memcached -d “Restarts memcached" -cluster

Listing Deployed Shell Scripts

To view the currently deployed shell scripts, use the ls command in conjunction with the -s option:

ls -s

Executing a Shell Script

To execute a shell script, type the exec command with the -s option – the value to assign to the option should correspond to the alias of the script to execute:

exec -s restart-memcached

Undeploying Shell Scripts

To undeploy a shell script, type the undeploy command with the -s option specifying the alias of the script to undeploy:

undeploy -s restart-memcached

You call also use pattern matching to undeploy multiple scripts at once:

undeploy -s restart* -cluster