Article
· May 3, 2018 4m read

The (somewhat limited) value of 'ccontrol default'

If you have ever issued the command ccontrol help to discover what ccontrol is capable of, perhaps you noticed this section:

Syntax:
        ccontrol default
Description:
        Display the name of the default Cache instance,
        if one has been designated.

Syntax:
        ccontrol default <instance name>
Description:
        Designate the default Cache instance.
Example:
        ccontrol default mystuff

Syntax:
        ccontrol default ""
Description:
        A default instance is not assigned.


But what does it mean to be "the default Cache instance"? My searches of documentation drew a blank.

It turns out to govern the cache command, a shorthand form of the csession <instance name> command, which in turn is a shorthand form of ccontrol session <instance name>

Here's the fruit of my investigation on a test server with five instances. They're actually Ensemble ones, but that doesn't matter.

[root@tra ~]# ccontrol list

Configuration 'DEV'   (default)
        directory: /demo/ensemble/DEV
        versionid: 2012.2.5.962.2
        conf file: cache.cpf  (SuperServer port = 1972, WebServer = 57772)
        status:    down, last used Thu Mar 15 01:30:07 2018

Configuration 'HOM'
        directory: /demo/ensemble/HOM
        versionid: 2012.2.5.962.2
        conf file: cache.cpf  (SuperServer port = 56773, WebServer = 57773)
        status:    down, last used Thu Mar 15 03:35:31 2018

Configuration 'PERSONAL1'
        directory: /demo/ensemble/PERSONAL1
        versionid: 2012.2.5.962.2
        conf file: cache.cpf  (SuperServer port = 56775, WebServer = 57775)
        status:    down, last used Thu Mar 15 03:35:08 2018

Configuration 'PERSONAL2'
        directory: /demo/ensemble/PERSONAL2
        versionid: 2012.2.5.962.2
        conf file: cache.cpf  (SuperServer port = 56776, WebServer = 57776)
        status:    down, last used Thu Mar 15 03:35:08 2018

Configuration 'PROD'
        directory: /demo/ensemble/PROD
        versionid: 2012.2.5.962.2
        conf file: cache.cpf  (SuperServer port = 56774, WebServer = 57774)
        status:    down, last used Thu Mar 15 03:35:06 2018
[root@tra ~]#

Let's see which is the default instance:
[root@tra ~]# ccontrol default
DEV
[root@tra ~]#

This means that I can use the cache command. You'll have to take my word that this would have connected me to the DEV instance. My instances aren't running because their temporary license keys have expired:

[root@tra ~]# cache
Instance is not running
[root@tra ~]#

By clearing the default we eliminate the cache command:

[root@tra ~]# ccontrol default ""
[root@tra ~]# cache
-bash: /usr/bin/cache: No such file or directory
[root@tra ~]#

Setting a default again reinstates the command:

[root@tra ~]# ccontrol default DEV
[root@tra ~]# cache
Instance is not running
[root@tra ~]#

What implements the command?

[root@tra ~]# which cache
/usr/bin/cache
[root@tra ~]# ls -l /usr/bin/cache
lrwxrwxrwx. 1 root root 32 May  3 12:34 /usr/bin/cache -> /usr/local/etc/cachesys/csession
[root@tra ~]# ls -l /usr/local/etc/cachesys/csession
-r-xr-xr-x. 1 cache-dev cacheusr 24325 Dec  1 13:26 /usr/local/etc/cachesys/csession
[root@tra ~]#

I sometimes wish the default instance had meaning on the other ccontrol commands. For example, wouldn't it be handy to be able to issue ccontrol stop without also having to enter an instance name? Particularly if you only have one instance on the server, or if you are trying to create scripts for use on environments where the actual instance name may vary.

Given that command such as ccontrol stop accept optional qualifiers, e.g.

ccontrol stop DEV quietly restart

it would probably be necessary to have a placeholder symbol to represent "default instance". How about this format?

ccontrol stop . quietly restart

Discussion (2)1
Log in or sign up to continue

The 'ccontrol default' facility has unfortunately fallen somewhat into disuse, possibly because we did not anticipate much customer interest in it after the product evolved from the old single-instance implementations preceding Cache (Open M etc) on Unix and VMS server platforms. The intent of the "default" instance was to provide a bridge between these older versions and first-time users of multi-instance configurations on a given machine under Cache. Many customers still had scripts and procedures that did not employ an instance name, and we wished to make the transition a bit easier. We expected that in time the "default" would be deprecated.

You are right that, for syntactical reasons, the other commands that could be used with a single-instance implementation did not (and still do not) provide a shorthand notation implying the default (or only) instance. We anticipated that if there were customer interest in such a permanent feature, it would be requested.

BTW, I apologize for the lack of detail about this in the current doc set. The documentation has been trimmed down over the years, and no longer contains a full set of ccontrol commands and detailed information about them. The 'ccontrol help' was merely intended to be a reminder of the available operations and what they do, but had not been intended to take the place of our doc set.

If you think that enhancing the "default" instance functionality would be useful -- and I like the suggestion of a "." (dot) or some such to be an abbreviation for it -- then by all means request its implementation. Making your life easier is what it is all about!