Starting the CogServer
It is assumed that you have already compiled and installed the CogServer. If not, this must be done first. Very briefly, this consists of the steps:
git clone https://github.com/opencog/cogserver cd cogserver; mkdir build; cd build cmake ..; make -j sudo make install
From the bash prompt
The cogserver binary usually installs in /usr/local/bin; make sure this is in your path. Then just say
or, optionally, specify a config file:
$ cogserver -c cogserver.conf
You should see the following output:
Listening on port 17001 ... ...
From the guile prompt
To run it from guile, the cogserver module must be loaded:
guile> (use-modules (opencog) (opencog cogserver)) guile> (start-cogserver)
or, with a config file:
guile> (start-cogserver "/etc/coserver.conf")
Note you can also stop it with (stop-cogserver). You can access documentation as:
guile> ,d start-cogserver
From the python prompt
Yes, this works. Someone should document it.
Connecting to the CogServer
telnet localhost 17001
Optionally, enable readline, which enables you to edit the shell's history run:
rlwrap telnet localhost 17001
This assumes that rlwrap is installed on your machine.
You should be presented with:
Trying 127.0.0.1... Connected to localhost. Escape character is '^]'. opencog>
"help"<enter> to get a list of commands. After additional modules are loaded, additional commands will appear.
Available commands: help: List the available commands or print the help for a specific command list: List atoms in the atomtable listmodules: List the currently loaded modules loadmodule: Load an opencog module py: Enter the python shell py-eval: Run some python code quit: Close the shell connection scm: Enter the scheme shell sexpr: Enter the s-expression shell shutdown: Shut down the cogserver stats: Print some diagnostic statistics about the server. unloadmodule: Unload an opencog module
To get information about any of the commands, use "help <name of command>". For example
opencog> help scm Usage: scm [hush|quiet|sync] Enter the scheme interpreter shell. This shell provides a rich and easy-to-use environment for creating, deleting and manipulating OpenCog atoms and truth values. It provides a full R5RS-compliant interactive scheme shell, based on the GNU Guile extension language. If 'hush' or 'quiet' is specified after the command, then the prompt will not be returned. This is nice when catting large scripts using netcat, as it avoids printing garbage when the scripts work well. If 'sync' is specified after the command, then the output is sync, instead of async.
Monitoring the CogServer
The CogServer will write log entries from various subsystems to the file
/tmp/cogserver.log. Some subsystems may have their own log files; refer to their respective documentations for details.
To keep an eye on the log file, start a new Terminal window and run
tail -f /tmp/cogserver.log
You should see some output similar to the following:
opencog@locahost:/opencog/build$ tail -f /tmp/cogserver.log [2016-02-23 09:16:27:289] [INFO] Loaded /usr/local/share/opencog/scm/utilities.scm [2016-02-23 09:16:27:295] [INFO] Loaded /usr/local/share/opencog/scm/apply.scm [2016-02-23 09:16:27:300] [INFO] Loaded /usr/local/share/opencog/scm/file-utils.scm [2016-02-23 09:16:27:300] [WARN] Failed to load file scm/persistence.scm: 2 No such file or directory [2016-02-23 09:16:27:305] [INFO] Loaded /usr/local/share/opencog/scm/config.scm [2016-02-23 09:16:27:317] [INFO] Loaded /usr/local/share/opencog/scm/repl-shell.scm [2016-02-23 09:16:27:323] [INFO] Loaded /usr/local/share/opencog/scm/av-tv.scm [2016-02-23 09:16:27:329] [INFO] Loaded /usr/local/share/opencog/scm/rule-engine-utils.scm [2016-02-23 09:16:27:335] [INFO] Loaded ..//opencog/cogserver/scm/config.scm [2016-02-23 09:16:27:336] [INFO] Starting CogServer loop.