<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://techwiki.neosys.com/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Gregory</id>
	<title>NEOSYS Technical Support Wiki - User contributions [en]</title>
	<link rel="self" type="application/atom+xml" href="https://techwiki.neosys.com/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Gregory"/>
	<link rel="alternate" type="text/html" href="https://techwiki.neosys.com/index.php/Special:Contributions/Gregory"/>
	<updated>2026-04-19T06:15:59Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.43.3</generator>
	<entry>
		<id>https://techwiki.neosys.com/index.php?title=EXODUS_Knowledge&amp;diff=4085</id>
		<title>EXODUS Knowledge</title>
		<link rel="alternate" type="text/html" href="https://techwiki.neosys.com/index.php?title=EXODUS_Knowledge&amp;diff=4085"/>
		<updated>2025-12-30T10:29:51Z</updated>

		<summary type="html">&lt;p&gt;Gregory: /* Processes */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==TMUX Screens==&lt;br /&gt;
&lt;br /&gt;
To create the EXODUS maintenance/programming environment&lt;br /&gt;
 exodus#: ./tmux.exodus&lt;br /&gt;
&lt;br /&gt;
===Screens===&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
0: /&lt;br /&gt;
    General work for server services/configs. i.e /etc/nagios, /etc/apache2, /var/log/mail.log or general networking.&lt;br /&gt;
&lt;br /&gt;
1: /root/exodus/&lt;br /&gt;
    Exodus core is installed. Contains build and make libraries here ./libexodus&lt;br /&gt;
&lt;br /&gt;
2: /root/exodus/libexodus/exodus&lt;br /&gt;
    Core exodus library source code which emulate the AREV system e.g var.cpp&lt;br /&gt;
    &lt;br /&gt;
3: /root/exodus/cli/src&lt;br /&gt;
    Exodus Command Line Interface E.g edir, edic, list, listfiles, delete, createdb, deletedb.&lt;br /&gt;
    &lt;br /&gt;
4: root/exodus/service&lt;br /&gt;
    EXODUS core default host directory but also contains scripts that create/manage requirements of a service (create_service, create_db, create_site, backup_db, restore_db, start, stop, status)&lt;br /&gt;
    The www/3/exodus has generic .htm, php and .js which provide basic website functionality i.e Login page, Support Menu, User details, Authorization.&lt;br /&gt;
    NEOSYS www files linked into ./www, from /root/neosys/web, which pulled from NEOSYS www git.&lt;br /&gt;
&lt;br /&gt;
5: /root/exodus/service/src&lt;br /&gt;
    Exodus core service programs (programs that are not related to NEOSYS agency operations and can be used to support other non-NEOSYS services) eg listen, usersubs, sendmail, openfile, select, sort, list,.&lt;br /&gt;
&lt;br /&gt;
    Extra info:    &lt;br /&gt;
    The dat/ has generic dictionary files. (See Section Dictionaries &amp;amp; Psql Functions)&lt;br /&gt;
    TODO: compall currently throws few warnings. Read them and familiarise. In case new warnings appear, notify Steve.    &lt;br /&gt;
        &lt;br /&gt;
6: /root/neosys&lt;br /&gt;
    NEOSYS specific client installation &amp;amp; management scripts e.g .doall, import_db and import_files (from AREV), ./run ./test (see below for these two commands)&lt;br /&gt;
    &lt;br /&gt;
7: /root/neosys/src&lt;br /&gt;
    NEOSYS Agency programs (see section How AREV programs are distributed in EXODUS src/*.cpp&lt;br /&gt;
    /root/neosys has the neosys .git&lt;br /&gt;
&lt;br /&gt;
8: /root/hosts&lt;br /&gt;
    client specific files  e.g logs, images, (shared ./www -&amp;gt; root/exodus/service/www&lt;br /&gt;
&lt;br /&gt;
9: /root/exodus/test/src&lt;br /&gt;
    series of programs that test whether subroutines (specifically Exodus core libraries) work as they should eg for the var lib - &amp;quot;assert( var(&amp;quot;11111&amp;quot;).isnum());&amp;quot;&lt;br /&gt;
&lt;br /&gt;
10: bash /bin/top&lt;br /&gt;
    Monitor for NEOSYS client processes&lt;br /&gt;
    Displays customised format: sorted by total time spend and by processor time.&lt;br /&gt;
     Press &amp;quot;=&amp;quot; : to change to standard top format&lt;br /&gt;
     Press shift + w : to save format settings, replacing the old customised top format&lt;br /&gt;
     To go back to the customised format do:&lt;br /&gt;
        Press &amp;quot;o&amp;quot;&lt;br /&gt;
        Type &amp;quot;COMMAND=serve_agy&amp;quot;&lt;br /&gt;
        shift + t : this sorts by total time spent&lt;br /&gt;
        shift + p : this sorts by processor time&lt;br /&gt;
        shift + w : to save this setting and enter  &#039;y&#039; to confirm&lt;br /&gt;
&lt;br /&gt;
11: /var/log/syslog&lt;br /&gt;
     Log of NEOSYS client requests&lt;br /&gt;
&lt;br /&gt;
12: /root/exodus/service/quick&lt;br /&gt;
     Displays the last time the svr file (in /root/hosts/&amp;lt;client&amp;gt;/data/&amp;lt;dbname&amp;gt;) was updated.&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Object Code/Libraries==&lt;br /&gt;
LIVE and TEST processes use different sets of object code.&lt;br /&gt;
TEST processes use libraries in ~/lib/, whereas LIVE processes use object code in ~/neo/lib&lt;br /&gt;
&lt;br /&gt;
This means development &amp;amp; testing can be done stress free on TEST database, as opposed to testing on production databases.&lt;br /&gt;
&lt;br /&gt;
When compiling using edic, the TEST object code is updated if the compilation is successful. (~/lib)&lt;br /&gt;
&lt;br /&gt;
==Dictionaries &amp;amp; Psql Functions==&lt;br /&gt;
&lt;br /&gt;
Dictionaries - data used to describe other data; specifically the fields of other files. &lt;br /&gt;
&lt;br /&gt;
There are three types of fields: &amp;lt;pre&amp;gt;&lt;br /&gt;
(F) Field for raw data E.g &amp;quot;Office 44 Building Rush&amp;quot;&lt;br /&gt;
(S) Symbolic or calculated E.g for total ans=field1+field2&lt;br /&gt;
(G) General or Group E.g &amp;quot;@CRT&amp;quot; which contains always contains the default columns to show on the output of the list program; if no columns provided in list command.&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Show dictionary using &amp;quot;EXO_DATA=test list dict.clients&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
===Development and deployment using &#039;dat&#039; files===&lt;br /&gt;
&lt;br /&gt;
====Rationale====&lt;br /&gt;
&lt;br /&gt;
Part of system development is the creation of various data that is neither programs nor layout i.e. not cpp, h, html, js, php files etc.&lt;br /&gt;
&lt;br /&gt;
For example:&lt;br /&gt;
&lt;br /&gt;
*Dictionaries are data about data.&lt;br /&gt;
*Language files are data about text to use for various languages.&lt;br /&gt;
*“Change logs” are data about changes in the system.&lt;br /&gt;
&lt;br /&gt;
Historically, in EXODUS and NEOSYS, the above data has been deployed in exodus database files using SQL text files. However SQL files are not convenient for development.&lt;br /&gt;
&lt;br /&gt;
Therefore, &#039;dat&#039; text files will be used now so that standard development tools including editors and git can be fully exploited.&lt;br /&gt;
&lt;br /&gt;
====&#039;dat&#039; files====&lt;br /&gt;
&lt;br /&gt;
Each database file is represented by an os directory of the same name.&lt;br /&gt;
&lt;br /&gt;
Each record in the database file is represented by an os text file where filename is the primary key.&lt;br /&gt;
&lt;br /&gt;
For example a record with key &#039;&#039;&#039;DEADLINE&#039;&#039;&#039; in a dat file &#039;&#039;&#039;dict.materials&#039;&#039;&#039; would be represented as an os text file &#039;&#039;&#039;dat/dict.materials/DEADLINE&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Each line in the os text file represents one field in the db record. In other words, db record FM characters are represented by new line characters in &#039;dat&#039; files. Any actual new line characters required in the record, and any backslashes, are escaped and appear as &#039;\n&#039; and &#039;\\&#039; in &#039;dat&#039; files. Other database field separator characters such as VM, SM, TM and STM are stored without any conversion.&lt;br /&gt;
&lt;br /&gt;
====Location of dat files====&lt;br /&gt;
&lt;br /&gt;
The development versions are stored in exodus and neosys src/dat dirs. They form part of the standard git repositories in parallel with cpp files.&lt;br /&gt;
&lt;br /&gt;
The operational versions are stored in ~/dat and ~/live/dat alongside bin and lib dirs and are automatically installed into databases as database files on service startup. Any database functions embedded in the text files (pgsql) are also automatically installed at the same time.&lt;br /&gt;
&lt;br /&gt;
===Delete Database dictionary file===&lt;br /&gt;
&lt;br /&gt;
cli syncdat deletes database files if the dat dir is empty or contains a file &#039;SYNCDAT_DELETE&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
touch neosys/src/dat/dict.users/SYNC_DELETE&lt;br /&gt;
neosys/src~: syncdat&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====Editing and deploying a &#039;dat&#039; file====&lt;br /&gt;
&lt;br /&gt;
It is currently a three step process to edit and deploy such &#039;dat&#039; files. &lt;br /&gt;
&lt;br /&gt;
=====Edit the &#039;dat&#039; file (i.e dict.file record)=====&lt;br /&gt;
&lt;br /&gt;
Note that EXODUS service and NEOSYS service have different src/dat folders.&lt;br /&gt;
&lt;br /&gt;
Editing language items:&lt;br /&gt;
&lt;br /&gt;
 edir dat/alanguage/SCHEDULES*ARABIC&lt;br /&gt;
&lt;br /&gt;
Editing a dictionary item:&lt;br /&gt;
&lt;br /&gt;
 edir dat/dict.materials/DEADLINE&lt;br /&gt;
&lt;br /&gt;
Editing a pgsql function in a dictionary:&lt;br /&gt;
&lt;br /&gt;
 edir dat/dict.materials/DEADLINE 8&lt;br /&gt;
&lt;br /&gt;
=====Copy all &#039;dat&#039; files to ~/dat =====&lt;br /&gt;
&lt;br /&gt;
This step might be removed at a later date.&lt;br /&gt;
&lt;br /&gt;
This will cause all test databases to immediately restart and load any &#039;dat&#039; file changes into dictionaries and data files and also create any new or modified pgsql functions.&lt;br /&gt;
&lt;br /&gt;
If any ~/neosys/src/dat files were edited:&lt;br /&gt;
&lt;br /&gt;
 cd ~/neosys/src&lt;br /&gt;
 &lt;br /&gt;
 ./compall dat&lt;br /&gt;
&lt;br /&gt;
and/or, if exodus/service/dat files were edited&lt;br /&gt;
&lt;br /&gt;
 cd ~/exodus/service/src&lt;br /&gt;
 &lt;br /&gt;
 ./compall dat&lt;br /&gt;
&lt;br /&gt;
=====Copy all programs and &#039;dat&#039; files to ~/live/bin|lib|dat=====&lt;br /&gt;
&lt;br /&gt;
This should only be run after testing. It will cause all live databases to automatically restart and do the same as the test databases mentioned above.&lt;br /&gt;
&lt;br /&gt;
 cd ~/exodus/service&lt;br /&gt;
 &lt;br /&gt;
 ./copyall CONFIRM&lt;br /&gt;
&lt;br /&gt;
=====Delete dat record =====&lt;br /&gt;
&lt;br /&gt;
Simply open the corresponding dat file, remove all lines and save.&lt;br /&gt;
&lt;br /&gt;
===Psql unaccent extension===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The unaccent extension and the immutable_unaccent function are created in the db ‘template1’ during exodus installation while user is postgres which is a superuser.&lt;br /&gt;
&lt;br /&gt;
Thereafter all new databases are created as copies of template1 so they contain the extension and function&lt;br /&gt;
&lt;br /&gt;
====Error====&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
MVDBException:ERROR: function immutable_unaccent(text) does not exist&lt;br /&gt;
ERROR:  permission denied to create extension &amp;quot;unaccent&amp;quot;&lt;br /&gt;
HINT:  Must be superuser to create this extension. &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====Solution====&lt;br /&gt;
sudo -u postgres psql -c &#039;ALTER USER exodus WITH SUPERUSER;&#039;&lt;br /&gt;
&lt;br /&gt;
==Processes==&lt;br /&gt;
The TEST process for all database use the same object code stored in /root/lib, whereas all LIVE process use the object code in /root/live/lib.&lt;br /&gt;
&lt;br /&gt;
==Postgres==&lt;br /&gt;
Connect into postgres shell:&lt;br /&gt;
 alias psql=&#039;sudo -u postgres psql&#039;&lt;br /&gt;
&lt;br /&gt;
Delete a database:&lt;br /&gt;
 dbdelete &amp;lt;dbcode&amp;gt;  #exodus cli program&lt;br /&gt;
OR&lt;br /&gt;
 sudo -u postgres dropdb &amp;lt;dbcode&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Debugging Exodus==&lt;br /&gt;
&lt;br /&gt;
===Debugging Live/Test services===&lt;br /&gt;
&lt;br /&gt;
./test &amp;lt;dbname&amp;gt; - execute test programs on _test database.&lt;br /&gt;
&lt;br /&gt;
./run &amp;lt;dbname&amp;gt;  - execute test programs on live database.&lt;br /&gt;
&lt;br /&gt;
===Debugging EXODUS var type variables===&lt;br /&gt;
&lt;br /&gt;
The Exodus var mimics JS var in that you can assign it multiple types.&lt;br /&gt;
&lt;br /&gt;
 var v1 = &amp;quot;hello&amp;quot;;&lt;br /&gt;
 var v2 = 999&lt;br /&gt;
 var v3 = 9.99;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
(gdb) print v1                                                        &lt;br /&gt;
$1 = {var_str = &amp;quot;hello&amp;quot;, var_int = 0,   var_dbl = 0,    var_typ = {flags_ = 1}}&lt;br /&gt;
&lt;br /&gt;
(gdb) print v2&lt;br /&gt;
$2 = {var_str = &amp;quot;&amp;quot;,      var_int = 999, var_dbl = 0,    var_typ = {flags_ = 2}}&lt;br /&gt;
&lt;br /&gt;
(gdb) print v3&lt;br /&gt;
$3 = {var_str = &amp;quot;&amp;quot;,      var_int = 0,   var_dbl = 9.99, var_typ = {flags_ = 3}}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=====Internals of a var explained:=====&lt;br /&gt;
&lt;br /&gt;
var_str  is type std::string&lt;br /&gt;
&lt;br /&gt;
var_int  is type int&lt;br /&gt;
&lt;br /&gt;
var_dbl  is type long double&lt;br /&gt;
&lt;br /&gt;
var_type is type int (the var type flag)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Type flag explained:&lt;br /&gt;
&lt;br /&gt;
The first 3 bits of var_typ (flags_) are used to signify which of the other variables are assigned.&lt;br /&gt;
Examples: &lt;br /&gt;
&lt;br /&gt;
000 (binary) =  0 (flags_) = none are assigned.&lt;br /&gt;
&lt;br /&gt;
100 (binary) =  1 (flags_) = var_str is assigned. (others are not)&lt;br /&gt;
&lt;br /&gt;
010 (binary) =  2 (flags_) = var_int is assigned. (ditto)&lt;br /&gt;
&lt;br /&gt;
001 (binary) =  4 (flags_) = var_dbl is assigned. (ditto)&lt;br /&gt;
&lt;br /&gt;
Combinations:&lt;br /&gt;
&lt;br /&gt;
110 (binary) =  3 (flags_) = var_str &amp;amp; var_int are assigned. (var_dbl is not)&lt;br /&gt;
&lt;br /&gt;
 v1 = &amp;quot;10&amp;quot;;&lt;br /&gt;
 (gdb) p v1&lt;br /&gt;
 $1 = {var_str = &amp;quot;10&amp;quot;, var_int = &amp;quot;&amp;quot;, var_dbl = &amp;quot;&amp;quot;, var_typ = {flags_ = 1}}&lt;br /&gt;
&lt;br /&gt;
 v1 = v1 + 0;&lt;br /&gt;
 (gdb) n #execute that code&lt;br /&gt;
 (gdb) p v1&lt;br /&gt;
 $1 = {var_str = &amp;quot;10&amp;quot;, var_int = &amp;quot;10&amp;quot;, var_dbl = &amp;quot;&amp;quot;, var_typ = {flags_ = 2}}&lt;br /&gt;
&lt;br /&gt;
What happened during &#039;v1 = v1 + 0;&#039;:&lt;br /&gt;
   1. v1&#039;s flag was 1, i.e only var_str was assigned.&lt;br /&gt;
   2. Numeric operator (+) invoked&lt;br /&gt;
   3. Attempt string to numerical type conversion either int or double.&lt;br /&gt;
   4. Yes var_str = &amp;quot;10&amp;quot; -&amp;gt; var_int = 10.&lt;br /&gt;
   5. Update flag to 2 (both var_str/int now assigned)&lt;br /&gt;
   6. var_int = 10, + 0 = 10;&lt;br /&gt;
   &lt;br /&gt;
&lt;br /&gt;
====To inspect a &amp;quot;common&amp;quot; variable (i.e those found in e.g ba_common.h)====&lt;br /&gt;
&lt;br /&gt;
e.g. a variable called ba.ledgern&lt;br /&gt;
&lt;br /&gt;
 p ba.ledgern&lt;br /&gt;
&lt;br /&gt;
OLD METHOD:&lt;br /&gt;
 p ((subExodusProgram::&amp;lt;b&amp;gt;ba&amp;lt;/b&amp;gt;_common)&amp;lt;b&amp;gt;ba&amp;lt;/b&amp;gt;).&amp;lt;b&amp;gt;ledgern&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====To dump all variables in a common====&lt;br /&gt;
&lt;br /&gt;
e.g all variables in ba&lt;br /&gt;
&lt;br /&gt;
 p (subExodusProgram::ba_common)ba&lt;br /&gt;
&lt;br /&gt;
====What types are available in a program?====&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;info types common&lt;br /&gt;
info types subExodus&lt;br /&gt;
info types libexodus&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====Other commands====&lt;br /&gt;
&lt;br /&gt;
 explore subExodusProgram::ba_common&lt;br /&gt;
&lt;br /&gt;
===Process Hung or consuming +100% CPU===&lt;br /&gt;
If process is consuming +100% CPU then it is likely stuck in an infinite loop.&lt;br /&gt;
&lt;br /&gt;
 ./doall &amp;lt;CLIENT&amp;gt; stop&lt;br /&gt;
&lt;br /&gt;
 ./run &amp;lt;CLIENT&amp;gt; &lt;br /&gt;
&lt;br /&gt;
 ./test &amp;lt;CLIENT&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Search through recent logs for &amp;lt;CLIENT&amp;gt; looking for requests that didn&#039;t return OK at the time nagios alerted of Hung process.&lt;br /&gt;
&lt;br /&gt;
A user may also instigate the error again, so monitor the CLIENT&#039;s service CPU usage.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
If cause found recreate it in test and once test process hit +100% break in test debugger.&lt;br /&gt;
&lt;br /&gt;
If cause not found, you will have to continue checking logs for the request that caused it or hope a user recreates the issue in live debugged service.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Once you&#039;ve broken in the debugged with the error, enter &amp;quot;n&amp;quot; and hold the enter key until you just seeing line repeat.&lt;br /&gt;
&lt;br /&gt;
Pay attention to start of loops code. E.g WHILE or FOR. (there is likely an error is there)&lt;br /&gt;
&lt;br /&gt;
==./doall==&lt;br /&gt;
====General====&lt;br /&gt;
&lt;br /&gt;
~/neosys/doall [LIVE|TEST] &amp;lt;DBCODE|ALL&amp;gt; &amp;lt; ACTION [OPTIONS,..]  | bash -- COMMAND ]&lt;br /&gt;
&lt;br /&gt;
Example: &lt;br /&gt;
 ./doall TEST ALL create_site t-&lt;br /&gt;
Result:&lt;br /&gt;
Create site for ALL TEST databases, using domain name prefix option &amp;quot;t-&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Screen 6: ./doall script contains all the necessary information(codes) to setup an installation.&lt;br /&gt;
It includes scripts to backup, restore, create an Apache site, create/start/stop/status a service, import an AREV database into postgres and more.&lt;br /&gt;
&lt;br /&gt;
====backup_db====&lt;br /&gt;
&lt;br /&gt;
*Does a backup &amp;amp; restore of a LIVE database into the corresponding TEST database.&lt;br /&gt;
*Backup &amp;lt;dbcode&amp;gt;.sql file is written to /root/backups/sql; which is rsynced to nl19:/backups/current/exodus/&lt;br /&gt;
*Unlike AREV, postgres can perform a &amp;quot;backup&amp;quot; of a database whilst the system is in use.&lt;br /&gt;
&lt;br /&gt;
==Git==&lt;br /&gt;
&lt;br /&gt;
There are two repositories, one for EXODUS and the other for NEOSYS.&lt;br /&gt;
&lt;br /&gt;
===Using git to make changes===&lt;br /&gt;
&lt;br /&gt;
Before following steps you must have a tested updated to a program/file/script. Do not commit untested changes to avoid a messy git history of reverts.&lt;br /&gt;
&lt;br /&gt;
Update your local repo before committing to local repo using the g alias for &amp;quot;git pull --ff-only ; git push &amp;amp;&amp;amp; git status&#039;&amp;quot;:&lt;br /&gt;
&amp;lt;pre&amp;gt;g&amp;lt;/pre&amp;gt;&lt;br /&gt;
Check which updates/files have not yet been staged and/or committed:&lt;br /&gt;
Add your updates to the staged area:&lt;br /&gt;
&amp;lt;pre&amp;gt;git add &amp;lt;filename&amp;gt;&amp;lt;/pre&amp;gt;&lt;br /&gt;
or if all the changes made need to be staged:&lt;br /&gt;
&amp;lt;pre&amp;gt;git add -a&amp;lt;/pre&amp;gt;&lt;br /&gt;
Make a commit with a descriptive message on purpose of updates:&lt;br /&gt;
&amp;lt;pre&amp;gt;git commit -m &amp;lt;description n purpose of changes&amp;gt;&amp;lt;/pre&amp;gt;&lt;br /&gt;
Again use g alias:&lt;br /&gt;
&amp;lt;pre&amp;gt;g&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Other useful git cmds===&lt;br /&gt;
&lt;br /&gt;
Do not use this commands unless you know what WILL happen. &lt;br /&gt;
*git pull - Instead use the safe &amp;quot;git pull --ff-only&amp;quot;&lt;br /&gt;
Stick to the alias &amp;quot;g&amp;quot; which does &amp;quot;git pull --ff-only ; git push &amp;amp;&amp;amp; git status&#039;&amp;quot;&lt;br /&gt;
&lt;br /&gt;
*git log - display history of commits to master branch&lt;br /&gt;
*git diff - display the differences in files between working files and files in local repo.&lt;br /&gt;
*git status - display: which updated files are staged/not staged(tracked)&lt;br /&gt;
*git stash - &lt;br /&gt;
*git branch - switch to a new branch&lt;br /&gt;
*git branch &amp;lt;branchname&amp;gt; - will switch to this branch only if it exists&lt;br /&gt;
*git checkout - DESTROYS/Updates the state of local working directory with the state of the files in the local repo. (YOU WILL LOSE non staged updates)&lt;br /&gt;
*git restore &amp;lt;filename&amp;gt; - DESTROYS/Updates the file with the version in the local repo. (like with git checkout but for a specific file)&lt;br /&gt;
*git checkin - &lt;br /&gt;
*git revert &amp;lt;commitHash&amp;gt; - reverses a specific commit (use git log to get the chosen commit hash)&lt;br /&gt;
*git ..&lt;br /&gt;
&lt;br /&gt;
==Converting AREV programs to EXODUS==&lt;br /&gt;
===Decompile AREV to C++===&lt;br /&gt;
&lt;br /&gt;
Do in Master AREV Installation Maintenance mode: (win7)&lt;br /&gt;
&lt;br /&gt;
#ATTACH ADECOMC &lt;br /&gt;
#*ADECOM &amp;lt;programname&amp;gt;   *single program&lt;br /&gt;
#*ADECOM &amp;lt;prog1&amp;gt; &amp;lt;prog2&amp;gt; &lt;br /&gt;
#*ADECOMALL              *all programs   (CHECK FIRST)&lt;br /&gt;
&lt;br /&gt;
Include the option &amp;quot;(V)&amp;quot; in the command to print the C++ to a notepad, which can easily be copy and pasted.&lt;br /&gt;
&lt;br /&gt;
===Getting C++ program to Exodus Installation===&lt;br /&gt;
&lt;br /&gt;
Two methods: (use the first for one off programs)&lt;br /&gt;
&lt;br /&gt;
====Copy &amp;amp; Paste====&lt;br /&gt;
&lt;br /&gt;
Compile program and open source code in notepad&lt;br /&gt;
&lt;br /&gt;
 ADECOM &amp;lt;programname&amp;gt; (V)&lt;br /&gt;
&lt;br /&gt;
Find which directory the program belongs. e.g fin/med/job/sys e.t&lt;br /&gt;
&lt;br /&gt;
 find /cygdrive/d/exodus/pickos | grep &amp;lt;program name&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If cpp in SYS, the program belongs in ~/exodus/service/src OR if in MED JOB FIN GEN AGY the program belongs in ~/neosys/src&lt;br /&gt;
&lt;br /&gt;
Copy the source code in the text file from the first command.&lt;br /&gt;
&lt;br /&gt;
In Exodus, create a new .cpp (in correct directory) and paste the source code.&lt;br /&gt;
&lt;br /&gt;
Compile &amp;amp; Test&lt;br /&gt;
&lt;br /&gt;
====Rsync====&lt;br /&gt;
&lt;br /&gt;
 /d/exodus/arev/syncup.sh&lt;br /&gt;
&lt;br /&gt;
If cpp in SYS then: ~/exodus/service/src ./getpickos&lt;br /&gt;
&lt;br /&gt;
If cpp in MED JOB FIN GEN AGY then: *~/neosys/src&lt;br /&gt;
&lt;br /&gt;
===Compile C++ files to TEST system===&lt;br /&gt;
&lt;br /&gt;
#*./test &amp;lt;DBNAME&amp;gt;&lt;br /&gt;
#*~/neosys ./doall TEST &amp;lt;DBNAME&amp;gt; restart    #to get one service to start start using the new lib files&lt;br /&gt;
#*~/neosys ./doall TEST all restart         #to get all the services to start start using the new lib files&lt;br /&gt;
&lt;br /&gt;
===Install C++ files to LIVE System===&lt;br /&gt;
&lt;br /&gt;
#~/exodus/service/ ./copyall            #to copy all the ~/lib and bin files to ~/live/lib and bin ... which is used by all exodus/live services&lt;br /&gt;
&lt;br /&gt;
==Writing Standard Exodus Core Function/Method Testing==&lt;br /&gt;
Screen 9: ~/exodus/test/src/&lt;br /&gt;
There are a series of test programs that check whether methods/functions behave as intended.&lt;br /&gt;
They do this using the function, assert.. a 1 or more argument values produce one and only one output)&lt;br /&gt;
&lt;br /&gt;
e.g test_multilang.cpp or test_sort.cpp&lt;br /&gt;
&lt;br /&gt;
Two methods of running test programs:&lt;br /&gt;
*Screen 9: make test&lt;br /&gt;
*after compiling using edic/compile/c, enter test_prog_name. (Since compile has moved it to ~/bin)&lt;br /&gt;
&lt;br /&gt;
Difference between the two methods is make calls gdb directly;&lt;br /&gt;
whereas ~/bin/test_prog_name uses exodus compile program&lt;br /&gt;
#~/neosys ./doall LIVE all restart&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Upgrading Exodus==&lt;br /&gt;
&lt;br /&gt;
#Develop patch in Dev system &lt;br /&gt;
&lt;br /&gt;
===Patching neosys/src or exodus/service/src===&lt;br /&gt;
&lt;br /&gt;
#Manually insert patches and compile into test programs.&lt;br /&gt;
#If patch dat files then run neosys/compall to get dat files into ~/dat&lt;br /&gt;
*If Patsalides:&lt;br /&gt;
*#SITE_DIR=ptcy ./test basic &lt;br /&gt;
*#login to BASIC_TEST and test&lt;br /&gt;
*Other clients:&lt;br /&gt;
*#./test DBCODE&lt;br /&gt;
*#login to DBCODE and test patches works&lt;br /&gt;
#run exodus/service/copyall and check only the patched programs are listed. (if not, see Troubleshoot below)&lt;br /&gt;
#Inform users to log off for 10mins. As a rule of thumb, live services must be stopped before copying test programs to live.&lt;br /&gt;
#exodus/service/copyall CONFIRM&lt;br /&gt;
&lt;br /&gt;
====Troubleshoot====&lt;br /&gt;
&lt;br /&gt;
=====./copyall lists programs you have not patched=====&lt;br /&gt;
Use exodus/service/copyone to copy only your patched programs one by one. (./copyone will not copy dat files)&lt;br /&gt;
&lt;br /&gt;
===Upgrading to new version===&lt;br /&gt;
&lt;br /&gt;
READ: remember there is no test version of libexodus programs. This means that if libexodus programs are compiled and installed, neosys/src and exodus/services LIVE programs MUST BE UPGRADED.&lt;br /&gt;
&lt;br /&gt;
#Upgrade test system to test&lt;br /&gt;
##If a dev system like de2, git stash any uncommitted changes other staff may be working on.&lt;br /&gt;
##Run &amp;quot;g&amp;quot; in ~/exodus (to do git pull --ff-only)&lt;br /&gt;
##Run &amp;quot;m&amp;quot; in ~/exodus (to compile and install libexodus)&lt;br /&gt;
##Run &amp;quot;~/neosys/upgrade.all.sh live&amp;quot; in ~/neosys (to upgrade exodus/service and neosys/src live programs)&lt;br /&gt;
##Begin testing&lt;br /&gt;
#Upgrade clients&lt;br /&gt;
##*Client hosted - Schedule a planned upgrade with client.&lt;br /&gt;
##*NEOSYS hosted - Inform all clients/users of planned morning upgrade, 24hours in advanced.      (TODO: &#039;What&#039;s New in NEOSYS&#039;) AND (emailallusers.cpp)&lt;br /&gt;
##Day of upgrade, check USB backup was successful &amp;amp; make a container snapshot, otherwise do not proceed.&lt;br /&gt;
##Stop services&lt;br /&gt;
##Run &amp;quot;g&amp;quot; in ~/exodus (to do git pull --ff-only)&lt;br /&gt;
##Run &amp;quot;m&amp;quot; in ~/exodus (to compile and install libexodus)&lt;br /&gt;
##Run &amp;quot;~/neosys/upgrade.all.sh live&amp;quot;. &lt;br /&gt;
##Check services started automatically without issues.&lt;br /&gt;
#Inform users their system has been upgraded and they can login.&lt;br /&gt;
&lt;br /&gt;
===Roll Back Upgrade===&lt;br /&gt;
&lt;br /&gt;
If for any reason the entire upgrade needs to be reverted (excludes clients database), follow steps below:&lt;br /&gt;
&lt;br /&gt;
#Inform users that there is a problem and services need to be stopped.&lt;br /&gt;
#Stop all exodus processes.&lt;br /&gt;
#Restore the morning&#039;s USB backup by: (Note this backup contains:  source/obj code, /etc, neosys scripts but not client data)&lt;br /&gt;
##Login into container&#039;s host and rsync the morning&#039;s usb backup to the container&#039;s /:&lt;br /&gt;
#*&amp;lt;pre&amp;gt;rsync --dry-run -avz -e &#039;ssh -p &amp;lt;C_SSHPORT&amp;gt;&#039; /backups/usb/&amp;lt;C_CODE&amp;gt; &amp;lt;C_CODE&amp;gt;:/      (Example: rsync --dry-run -avz -e &#039;ssh -p 19582&#039; /backups/usb/ad1 ad1:/&amp;lt;/pre&amp;gt;)&lt;br /&gt;
#Quick sane check, the latest git commit is not the latest git commit in the remote repo.&lt;br /&gt;
#Inform users they can login.&lt;br /&gt;
&lt;br /&gt;
==Configuring services to autostart during login==&lt;br /&gt;
For PTCY,&lt;br /&gt;
&lt;br /&gt;
#Create a file &#039;autostart.cfg&#039; in the data folder &lt;br /&gt;
&lt;br /&gt;
 touch /root/hosts/&amp;lt;dbname&amp;gt;/data/autostart.cfg&lt;br /&gt;
&lt;br /&gt;
This will autostart a database service as long as at least one database service in that directory is running.&lt;br /&gt;
&lt;br /&gt;
For example, demo service will autostart during login if,&lt;br /&gt;
#/root/hosts/demo/data/autostart.cfg exists and&lt;br /&gt;
#demo_test service is running&lt;br /&gt;
&lt;br /&gt;
==Speedup postgresql importing databases==&lt;br /&gt;
&lt;br /&gt;
Can be sped up by a factor of 10 BUT may result in corrupt files in case of hard OS crash where the dirty memory is not flushed to storage.&lt;br /&gt;
&lt;br /&gt;
Therefore it is advisable to use this feature only briefly and REMEMBER TO REMOVE IT! &lt;br /&gt;
&lt;br /&gt;
Email to support@neosys.com whenever using it or use personal notes not memory.&lt;br /&gt;
&lt;br /&gt;
nano /etc/postgresql/12/main/postgresql.conf&lt;br /&gt;
&lt;br /&gt;
Uncomment or add a line&lt;br /&gt;
 fsync = off&lt;br /&gt;
Restart postgres … will break any neosys/exodus running processes.&lt;br /&gt;
 r postgresql&lt;br /&gt;
or reload postgres may also work&lt;br /&gt;
&lt;br /&gt;
==Database Attach==&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
root@exodus:~/exodus/cli/src# dbattach&lt;br /&gt;
dbattach - Attach foreign database files to the current default database&lt;br /&gt;
&lt;br /&gt;
Syntax is dbattach TARGETDB [FILENAME,...] {OPTION...}&lt;br /&gt;
&lt;br /&gt;
Options:&lt;br /&gt;
&lt;br /&gt;
  F   Forcibly delete any normal files in the current default database.&lt;br /&gt;
&lt;br /&gt;
  R   Detach foreign files&lt;br /&gt;
  RR  Remove foreign database connection.&lt;br /&gt;
  RRR Remove all foreign database connections and attachments.&lt;br /&gt;
&lt;br /&gt;
  L   List attached foreign files in the current default database&lt;br /&gt;
&lt;br /&gt;
If no filenames are provided then a database connection is created.&lt;br /&gt;
This is *required* before filenames can be provided and attached.&lt;br /&gt;
&lt;br /&gt;
Notes:&lt;br /&gt;
&lt;br /&gt;
Attachments are permanent until re-attached or removed.&lt;br /&gt;
&lt;br /&gt;
Indexes on attached files behave strangely.&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Issues:&lt;br /&gt;
&lt;br /&gt;
TARGETDB must be on the same connection as the current default database.&lt;br /&gt;
&lt;br /&gt;
Current user must have access to the foreign database.&lt;br /&gt;
&lt;br /&gt;
If EXO_USER and EXO_PASS are not set then exodus defaults are used.&lt;br /&gt;
&lt;br /&gt;
exodus .config file is not used currently.&lt;/div&gt;</summary>
		<author><name>Gregory</name></author>
	</entry>
	<entry>
		<id>https://techwiki.neosys.com/index.php?title=EXODUS_Knowledge&amp;diff=4084</id>
		<title>EXODUS Knowledge</title>
		<link rel="alternate" type="text/html" href="https://techwiki.neosys.com/index.php?title=EXODUS_Knowledge&amp;diff=4084"/>
		<updated>2025-12-12T08:23:27Z</updated>

		<summary type="html">&lt;p&gt;Gregory: /* Debugging EXODUS var type variables */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==TMUX Screens==&lt;br /&gt;
&lt;br /&gt;
To create the EXODUS maintenance/programming environment&lt;br /&gt;
 exodus#: ./tmux.exodus&lt;br /&gt;
&lt;br /&gt;
===Screens===&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
0: /&lt;br /&gt;
    General work for server services/configs. i.e /etc/nagios, /etc/apache2, /var/log/mail.log or general networking.&lt;br /&gt;
&lt;br /&gt;
1: /root/exodus/&lt;br /&gt;
    Exodus core is installed. Contains build and make libraries here ./libexodus&lt;br /&gt;
&lt;br /&gt;
2: /root/exodus/libexodus/exodus&lt;br /&gt;
    Core exodus library source code which emulate the AREV system e.g var.cpp&lt;br /&gt;
    &lt;br /&gt;
3: /root/exodus/cli/src&lt;br /&gt;
    Exodus Command Line Interface E.g edir, edic, list, listfiles, delete, createdb, deletedb.&lt;br /&gt;
    &lt;br /&gt;
4: root/exodus/service&lt;br /&gt;
    EXODUS core default host directory but also contains scripts that create/manage requirements of a service (create_service, create_db, create_site, backup_db, restore_db, start, stop, status)&lt;br /&gt;
    The www/3/exodus has generic .htm, php and .js which provide basic website functionality i.e Login page, Support Menu, User details, Authorization.&lt;br /&gt;
    NEOSYS www files linked into ./www, from /root/neosys/web, which pulled from NEOSYS www git.&lt;br /&gt;
&lt;br /&gt;
5: /root/exodus/service/src&lt;br /&gt;
    Exodus core service programs (programs that are not related to NEOSYS agency operations and can be used to support other non-NEOSYS services) eg listen, usersubs, sendmail, openfile, select, sort, list,.&lt;br /&gt;
&lt;br /&gt;
    Extra info:    &lt;br /&gt;
    The dat/ has generic dictionary files. (See Section Dictionaries &amp;amp; Psql Functions)&lt;br /&gt;
    TODO: compall currently throws few warnings. Read them and familiarise. In case new warnings appear, notify Steve.    &lt;br /&gt;
        &lt;br /&gt;
6: /root/neosys&lt;br /&gt;
    NEOSYS specific client installation &amp;amp; management scripts e.g .doall, import_db and import_files (from AREV), ./run ./test (see below for these two commands)&lt;br /&gt;
    &lt;br /&gt;
7: /root/neosys/src&lt;br /&gt;
    NEOSYS Agency programs (see section How AREV programs are distributed in EXODUS src/*.cpp&lt;br /&gt;
    /root/neosys has the neosys .git&lt;br /&gt;
&lt;br /&gt;
8: /root/hosts&lt;br /&gt;
    client specific files  e.g logs, images, (shared ./www -&amp;gt; root/exodus/service/www&lt;br /&gt;
&lt;br /&gt;
9: /root/exodus/test/src&lt;br /&gt;
    series of programs that test whether subroutines (specifically Exodus core libraries) work as they should eg for the var lib - &amp;quot;assert( var(&amp;quot;11111&amp;quot;).isnum());&amp;quot;&lt;br /&gt;
&lt;br /&gt;
10: bash /bin/top&lt;br /&gt;
    Monitor for NEOSYS client processes&lt;br /&gt;
    Displays customised format: sorted by total time spend and by processor time.&lt;br /&gt;
     Press &amp;quot;=&amp;quot; : to change to standard top format&lt;br /&gt;
     Press shift + w : to save format settings, replacing the old customised top format&lt;br /&gt;
     To go back to the customised format do:&lt;br /&gt;
        Press &amp;quot;o&amp;quot;&lt;br /&gt;
        Type &amp;quot;COMMAND=serve_agy&amp;quot;&lt;br /&gt;
        shift + t : this sorts by total time spent&lt;br /&gt;
        shift + p : this sorts by processor time&lt;br /&gt;
        shift + w : to save this setting and enter  &#039;y&#039; to confirm&lt;br /&gt;
&lt;br /&gt;
11: /var/log/syslog&lt;br /&gt;
     Log of NEOSYS client requests&lt;br /&gt;
&lt;br /&gt;
12: /root/exodus/service/quick&lt;br /&gt;
     Displays the last time the svr file (in /root/hosts/&amp;lt;client&amp;gt;/data/&amp;lt;dbname&amp;gt;) was updated.&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Object Code/Libraries==&lt;br /&gt;
LIVE and TEST processes use different sets of object code.&lt;br /&gt;
TEST processes use libraries in ~/lib/, whereas LIVE processes use object code in ~/neo/lib&lt;br /&gt;
&lt;br /&gt;
This means development &amp;amp; testing can be done stress free on TEST database, as opposed to testing on production databases.&lt;br /&gt;
&lt;br /&gt;
When compiling using edic, the TEST object code is updated if the compilation is successful. (~/lib)&lt;br /&gt;
&lt;br /&gt;
==Dictionaries &amp;amp; Psql Functions==&lt;br /&gt;
&lt;br /&gt;
Dictionaries - data used to describe other data; specifically the fields of other files. &lt;br /&gt;
&lt;br /&gt;
There are three types of fields: &amp;lt;pre&amp;gt;&lt;br /&gt;
(F) Field for raw data E.g &amp;quot;Office 44 Building Rush&amp;quot;&lt;br /&gt;
(S) Symbolic or calculated E.g for total ans=field1+field2&lt;br /&gt;
(G) General or Group E.g &amp;quot;@CRT&amp;quot; which contains always contains the default columns to show on the output of the list program; if no columns provided in list command.&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Show dictionary using &amp;quot;EXO_DATA=test list dict.clients&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
===Development and deployment using &#039;dat&#039; files===&lt;br /&gt;
&lt;br /&gt;
====Rationale====&lt;br /&gt;
&lt;br /&gt;
Part of system development is the creation of various data that is neither programs nor layout i.e. not cpp, h, html, js, php files etc.&lt;br /&gt;
&lt;br /&gt;
For example:&lt;br /&gt;
&lt;br /&gt;
*Dictionaries are data about data.&lt;br /&gt;
*Language files are data about text to use for various languages.&lt;br /&gt;
*“Change logs” are data about changes in the system.&lt;br /&gt;
&lt;br /&gt;
Historically, in EXODUS and NEOSYS, the above data has been deployed in exodus database files using SQL text files. However SQL files are not convenient for development.&lt;br /&gt;
&lt;br /&gt;
Therefore, &#039;dat&#039; text files will be used now so that standard development tools including editors and git can be fully exploited.&lt;br /&gt;
&lt;br /&gt;
====&#039;dat&#039; files====&lt;br /&gt;
&lt;br /&gt;
Each database file is represented by an os directory of the same name.&lt;br /&gt;
&lt;br /&gt;
Each record in the database file is represented by an os text file where filename is the primary key.&lt;br /&gt;
&lt;br /&gt;
For example a record with key &#039;&#039;&#039;DEADLINE&#039;&#039;&#039; in a dat file &#039;&#039;&#039;dict.materials&#039;&#039;&#039; would be represented as an os text file &#039;&#039;&#039;dat/dict.materials/DEADLINE&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Each line in the os text file represents one field in the db record. In other words, db record FM characters are represented by new line characters in &#039;dat&#039; files. Any actual new line characters required in the record, and any backslashes, are escaped and appear as &#039;\n&#039; and &#039;\\&#039; in &#039;dat&#039; files. Other database field separator characters such as VM, SM, TM and STM are stored without any conversion.&lt;br /&gt;
&lt;br /&gt;
====Location of dat files====&lt;br /&gt;
&lt;br /&gt;
The development versions are stored in exodus and neosys src/dat dirs. They form part of the standard git repositories in parallel with cpp files.&lt;br /&gt;
&lt;br /&gt;
The operational versions are stored in ~/dat and ~/live/dat alongside bin and lib dirs and are automatically installed into databases as database files on service startup. Any database functions embedded in the text files (pgsql) are also automatically installed at the same time.&lt;br /&gt;
&lt;br /&gt;
===Delete Database dictionary file===&lt;br /&gt;
&lt;br /&gt;
cli syncdat deletes database files if the dat dir is empty or contains a file &#039;SYNCDAT_DELETE&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
touch neosys/src/dat/dict.users/SYNC_DELETE&lt;br /&gt;
neosys/src~: syncdat&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====Editing and deploying a &#039;dat&#039; file====&lt;br /&gt;
&lt;br /&gt;
It is currently a three step process to edit and deploy such &#039;dat&#039; files. &lt;br /&gt;
&lt;br /&gt;
=====Edit the &#039;dat&#039; file (i.e dict.file record)=====&lt;br /&gt;
&lt;br /&gt;
Note that EXODUS service and NEOSYS service have different src/dat folders.&lt;br /&gt;
&lt;br /&gt;
Editing language items:&lt;br /&gt;
&lt;br /&gt;
 edir dat/alanguage/SCHEDULES*ARABIC&lt;br /&gt;
&lt;br /&gt;
Editing a dictionary item:&lt;br /&gt;
&lt;br /&gt;
 edir dat/dict.materials/DEADLINE&lt;br /&gt;
&lt;br /&gt;
Editing a pgsql function in a dictionary:&lt;br /&gt;
&lt;br /&gt;
 edir dat/dict.materials/DEADLINE 8&lt;br /&gt;
&lt;br /&gt;
=====Copy all &#039;dat&#039; files to ~/dat =====&lt;br /&gt;
&lt;br /&gt;
This step might be removed at a later date.&lt;br /&gt;
&lt;br /&gt;
This will cause all test databases to immediately restart and load any &#039;dat&#039; file changes into dictionaries and data files and also create any new or modified pgsql functions.&lt;br /&gt;
&lt;br /&gt;
If any ~/neosys/src/dat files were edited:&lt;br /&gt;
&lt;br /&gt;
 cd ~/neosys/src&lt;br /&gt;
 &lt;br /&gt;
 ./compall dat&lt;br /&gt;
&lt;br /&gt;
and/or, if exodus/service/dat files were edited&lt;br /&gt;
&lt;br /&gt;
 cd ~/exodus/service/src&lt;br /&gt;
 &lt;br /&gt;
 ./compall dat&lt;br /&gt;
&lt;br /&gt;
=====Copy all programs and &#039;dat&#039; files to ~/live/bin|lib|dat=====&lt;br /&gt;
&lt;br /&gt;
This should only be run after testing. It will cause all live databases to automatically restart and do the same as the test databases mentioned above.&lt;br /&gt;
&lt;br /&gt;
 cd ~/exodus/service&lt;br /&gt;
 &lt;br /&gt;
 ./copyall CONFIRM&lt;br /&gt;
&lt;br /&gt;
=====Delete dat record =====&lt;br /&gt;
&lt;br /&gt;
Simply open the corresponding dat file, remove all lines and save.&lt;br /&gt;
&lt;br /&gt;
===Psql unaccent extension===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The unaccent extension and the immutable_unaccent function are created in the db ‘template1’ during exodus installation while user is postgres which is a superuser.&lt;br /&gt;
&lt;br /&gt;
Thereafter all new databases are created as copies of template1 so they contain the extension and function&lt;br /&gt;
&lt;br /&gt;
====Error====&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
MVDBException:ERROR: function immutable_unaccent(text) does not exist&lt;br /&gt;
ERROR:  permission denied to create extension &amp;quot;unaccent&amp;quot;&lt;br /&gt;
HINT:  Must be superuser to create this extension. &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====Solution====&lt;br /&gt;
sudo -u postgres psql -c &#039;ALTER USER exodus WITH SUPERUSER;&#039;&lt;br /&gt;
&lt;br /&gt;
==Processes==&lt;br /&gt;
The TEST process for all database use the same object code stored in /root/lib, whereas all LIVE process use the object code in /root/neo/.&lt;br /&gt;
&lt;br /&gt;
==Postgres==&lt;br /&gt;
Connect into postgres shell:&lt;br /&gt;
 alias psql=&#039;sudo -u postgres psql&#039;&lt;br /&gt;
&lt;br /&gt;
Delete a database:&lt;br /&gt;
 dbdelete &amp;lt;dbcode&amp;gt;  #exodus cli program&lt;br /&gt;
OR&lt;br /&gt;
 sudo -u postgres dropdb &amp;lt;dbcode&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Debugging Exodus==&lt;br /&gt;
&lt;br /&gt;
===Debugging Live/Test services===&lt;br /&gt;
&lt;br /&gt;
./test &amp;lt;dbname&amp;gt; - execute test programs on _test database.&lt;br /&gt;
&lt;br /&gt;
./run &amp;lt;dbname&amp;gt;  - execute test programs on live database.&lt;br /&gt;
&lt;br /&gt;
===Debugging EXODUS var type variables===&lt;br /&gt;
&lt;br /&gt;
The Exodus var mimics JS var in that you can assign it multiple types.&lt;br /&gt;
&lt;br /&gt;
 var v1 = &amp;quot;hello&amp;quot;;&lt;br /&gt;
 var v2 = 999&lt;br /&gt;
 var v3 = 9.99;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
(gdb) print v1                                                        &lt;br /&gt;
$1 = {var_str = &amp;quot;hello&amp;quot;, var_int = 0,   var_dbl = 0,    var_typ = {flags_ = 1}}&lt;br /&gt;
&lt;br /&gt;
(gdb) print v2&lt;br /&gt;
$2 = {var_str = &amp;quot;&amp;quot;,      var_int = 999, var_dbl = 0,    var_typ = {flags_ = 2}}&lt;br /&gt;
&lt;br /&gt;
(gdb) print v3&lt;br /&gt;
$3 = {var_str = &amp;quot;&amp;quot;,      var_int = 0,   var_dbl = 9.99, var_typ = {flags_ = 3}}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=====Internals of a var explained:=====&lt;br /&gt;
&lt;br /&gt;
var_str  is type std::string&lt;br /&gt;
&lt;br /&gt;
var_int  is type int&lt;br /&gt;
&lt;br /&gt;
var_dbl  is type long double&lt;br /&gt;
&lt;br /&gt;
var_type is type int (the var type flag)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Type flag explained:&lt;br /&gt;
&lt;br /&gt;
The first 3 bits of var_typ (flags_) are used to signify which of the other variables are assigned.&lt;br /&gt;
Examples: &lt;br /&gt;
&lt;br /&gt;
000 (binary) =  0 (flags_) = none are assigned.&lt;br /&gt;
&lt;br /&gt;
100 (binary) =  1 (flags_) = var_str is assigned. (others are not)&lt;br /&gt;
&lt;br /&gt;
010 (binary) =  2 (flags_) = var_int is assigned. (ditto)&lt;br /&gt;
&lt;br /&gt;
001 (binary) =  4 (flags_) = var_dbl is assigned. (ditto)&lt;br /&gt;
&lt;br /&gt;
Combinations:&lt;br /&gt;
&lt;br /&gt;
110 (binary) =  3 (flags_) = var_str &amp;amp; var_int are assigned. (var_dbl is not)&lt;br /&gt;
&lt;br /&gt;
 v1 = &amp;quot;10&amp;quot;;&lt;br /&gt;
 (gdb) p v1&lt;br /&gt;
 $1 = {var_str = &amp;quot;10&amp;quot;, var_int = &amp;quot;&amp;quot;, var_dbl = &amp;quot;&amp;quot;, var_typ = {flags_ = 1}}&lt;br /&gt;
&lt;br /&gt;
 v1 = v1 + 0;&lt;br /&gt;
 (gdb) n #execute that code&lt;br /&gt;
 (gdb) p v1&lt;br /&gt;
 $1 = {var_str = &amp;quot;10&amp;quot;, var_int = &amp;quot;10&amp;quot;, var_dbl = &amp;quot;&amp;quot;, var_typ = {flags_ = 2}}&lt;br /&gt;
&lt;br /&gt;
What happened during &#039;v1 = v1 + 0;&#039;:&lt;br /&gt;
   1. v1&#039;s flag was 1, i.e only var_str was assigned.&lt;br /&gt;
   2. Numeric operator (+) invoked&lt;br /&gt;
   3. Attempt string to numerical type conversion either int or double.&lt;br /&gt;
   4. Yes var_str = &amp;quot;10&amp;quot; -&amp;gt; var_int = 10.&lt;br /&gt;
   5. Update flag to 2 (both var_str/int now assigned)&lt;br /&gt;
   6. var_int = 10, + 0 = 10;&lt;br /&gt;
   &lt;br /&gt;
&lt;br /&gt;
====To inspect a &amp;quot;common&amp;quot; variable (i.e those found in e.g ba_common.h)====&lt;br /&gt;
&lt;br /&gt;
e.g. a variable called ba.ledgern&lt;br /&gt;
&lt;br /&gt;
 p ba.ledgern&lt;br /&gt;
&lt;br /&gt;
OLD METHOD:&lt;br /&gt;
 p ((subExodusProgram::&amp;lt;b&amp;gt;ba&amp;lt;/b&amp;gt;_common)&amp;lt;b&amp;gt;ba&amp;lt;/b&amp;gt;).&amp;lt;b&amp;gt;ledgern&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====To dump all variables in a common====&lt;br /&gt;
&lt;br /&gt;
e.g all variables in ba&lt;br /&gt;
&lt;br /&gt;
 p (subExodusProgram::ba_common)ba&lt;br /&gt;
&lt;br /&gt;
====What types are available in a program?====&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;info types common&lt;br /&gt;
info types subExodus&lt;br /&gt;
info types libexodus&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====Other commands====&lt;br /&gt;
&lt;br /&gt;
 explore subExodusProgram::ba_common&lt;br /&gt;
&lt;br /&gt;
===Process Hung or consuming +100% CPU===&lt;br /&gt;
If process is consuming +100% CPU then it is likely stuck in an infinite loop.&lt;br /&gt;
&lt;br /&gt;
 ./doall &amp;lt;CLIENT&amp;gt; stop&lt;br /&gt;
&lt;br /&gt;
 ./run &amp;lt;CLIENT&amp;gt; &lt;br /&gt;
&lt;br /&gt;
 ./test &amp;lt;CLIENT&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Search through recent logs for &amp;lt;CLIENT&amp;gt; looking for requests that didn&#039;t return OK at the time nagios alerted of Hung process.&lt;br /&gt;
&lt;br /&gt;
A user may also instigate the error again, so monitor the CLIENT&#039;s service CPU usage.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
If cause found recreate it in test and once test process hit +100% break in test debugger.&lt;br /&gt;
&lt;br /&gt;
If cause not found, you will have to continue checking logs for the request that caused it or hope a user recreates the issue in live debugged service.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Once you&#039;ve broken in the debugged with the error, enter &amp;quot;n&amp;quot; and hold the enter key until you just seeing line repeat.&lt;br /&gt;
&lt;br /&gt;
Pay attention to start of loops code. E.g WHILE or FOR. (there is likely an error is there)&lt;br /&gt;
&lt;br /&gt;
==./doall==&lt;br /&gt;
====General====&lt;br /&gt;
&lt;br /&gt;
~/neosys/doall [LIVE|TEST] &amp;lt;DBCODE|ALL&amp;gt; &amp;lt; ACTION [OPTIONS,..]  | bash -- COMMAND ]&lt;br /&gt;
&lt;br /&gt;
Example: &lt;br /&gt;
 ./doall TEST ALL create_site t-&lt;br /&gt;
Result:&lt;br /&gt;
Create site for ALL TEST databases, using domain name prefix option &amp;quot;t-&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Screen 6: ./doall script contains all the necessary information(codes) to setup an installation.&lt;br /&gt;
It includes scripts to backup, restore, create an Apache site, create/start/stop/status a service, import an AREV database into postgres and more.&lt;br /&gt;
&lt;br /&gt;
====backup_db====&lt;br /&gt;
&lt;br /&gt;
*Does a backup &amp;amp; restore of a LIVE database into the corresponding TEST database.&lt;br /&gt;
*Backup &amp;lt;dbcode&amp;gt;.sql file is written to /root/backups/sql; which is rsynced to nl19:/backups/current/exodus/&lt;br /&gt;
*Unlike AREV, postgres can perform a &amp;quot;backup&amp;quot; of a database whilst the system is in use.&lt;br /&gt;
&lt;br /&gt;
==Git==&lt;br /&gt;
&lt;br /&gt;
There are two repositories, one for EXODUS and the other for NEOSYS.&lt;br /&gt;
&lt;br /&gt;
===Using git to make changes===&lt;br /&gt;
&lt;br /&gt;
Before following steps you must have a tested updated to a program/file/script. Do not commit untested changes to avoid a messy git history of reverts.&lt;br /&gt;
&lt;br /&gt;
Update your local repo before committing to local repo using the g alias for &amp;quot;git pull --ff-only ; git push &amp;amp;&amp;amp; git status&#039;&amp;quot;:&lt;br /&gt;
&amp;lt;pre&amp;gt;g&amp;lt;/pre&amp;gt;&lt;br /&gt;
Check which updates/files have not yet been staged and/or committed:&lt;br /&gt;
Add your updates to the staged area:&lt;br /&gt;
&amp;lt;pre&amp;gt;git add &amp;lt;filename&amp;gt;&amp;lt;/pre&amp;gt;&lt;br /&gt;
or if all the changes made need to be staged:&lt;br /&gt;
&amp;lt;pre&amp;gt;git add -a&amp;lt;/pre&amp;gt;&lt;br /&gt;
Make a commit with a descriptive message on purpose of updates:&lt;br /&gt;
&amp;lt;pre&amp;gt;git commit -m &amp;lt;description n purpose of changes&amp;gt;&amp;lt;/pre&amp;gt;&lt;br /&gt;
Again use g alias:&lt;br /&gt;
&amp;lt;pre&amp;gt;g&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Other useful git cmds===&lt;br /&gt;
&lt;br /&gt;
Do not use this commands unless you know what WILL happen. &lt;br /&gt;
*git pull - Instead use the safe &amp;quot;git pull --ff-only&amp;quot;&lt;br /&gt;
Stick to the alias &amp;quot;g&amp;quot; which does &amp;quot;git pull --ff-only ; git push &amp;amp;&amp;amp; git status&#039;&amp;quot;&lt;br /&gt;
&lt;br /&gt;
*git log - display history of commits to master branch&lt;br /&gt;
*git diff - display the differences in files between working files and files in local repo.&lt;br /&gt;
*git status - display: which updated files are staged/not staged(tracked)&lt;br /&gt;
*git stash - &lt;br /&gt;
*git branch - switch to a new branch&lt;br /&gt;
*git branch &amp;lt;branchname&amp;gt; - will switch to this branch only if it exists&lt;br /&gt;
*git checkout - DESTROYS/Updates the state of local working directory with the state of the files in the local repo. (YOU WILL LOSE non staged updates)&lt;br /&gt;
*git restore &amp;lt;filename&amp;gt; - DESTROYS/Updates the file with the version in the local repo. (like with git checkout but for a specific file)&lt;br /&gt;
*git checkin - &lt;br /&gt;
*git revert &amp;lt;commitHash&amp;gt; - reverses a specific commit (use git log to get the chosen commit hash)&lt;br /&gt;
*git ..&lt;br /&gt;
&lt;br /&gt;
==Converting AREV programs to EXODUS==&lt;br /&gt;
===Decompile AREV to C++===&lt;br /&gt;
&lt;br /&gt;
Do in Master AREV Installation Maintenance mode: (win7)&lt;br /&gt;
&lt;br /&gt;
#ATTACH ADECOMC &lt;br /&gt;
#*ADECOM &amp;lt;programname&amp;gt;   *single program&lt;br /&gt;
#*ADECOM &amp;lt;prog1&amp;gt; &amp;lt;prog2&amp;gt; &lt;br /&gt;
#*ADECOMALL              *all programs   (CHECK FIRST)&lt;br /&gt;
&lt;br /&gt;
Include the option &amp;quot;(V)&amp;quot; in the command to print the C++ to a notepad, which can easily be copy and pasted.&lt;br /&gt;
&lt;br /&gt;
===Getting C++ program to Exodus Installation===&lt;br /&gt;
&lt;br /&gt;
Two methods: (use the first for one off programs)&lt;br /&gt;
&lt;br /&gt;
====Copy &amp;amp; Paste====&lt;br /&gt;
&lt;br /&gt;
Compile program and open source code in notepad&lt;br /&gt;
&lt;br /&gt;
 ADECOM &amp;lt;programname&amp;gt; (V)&lt;br /&gt;
&lt;br /&gt;
Find which directory the program belongs. e.g fin/med/job/sys e.t&lt;br /&gt;
&lt;br /&gt;
 find /cygdrive/d/exodus/pickos | grep &amp;lt;program name&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If cpp in SYS, the program belongs in ~/exodus/service/src OR if in MED JOB FIN GEN AGY the program belongs in ~/neosys/src&lt;br /&gt;
&lt;br /&gt;
Copy the source code in the text file from the first command.&lt;br /&gt;
&lt;br /&gt;
In Exodus, create a new .cpp (in correct directory) and paste the source code.&lt;br /&gt;
&lt;br /&gt;
Compile &amp;amp; Test&lt;br /&gt;
&lt;br /&gt;
====Rsync====&lt;br /&gt;
&lt;br /&gt;
 /d/exodus/arev/syncup.sh&lt;br /&gt;
&lt;br /&gt;
If cpp in SYS then: ~/exodus/service/src ./getpickos&lt;br /&gt;
&lt;br /&gt;
If cpp in MED JOB FIN GEN AGY then: *~/neosys/src&lt;br /&gt;
&lt;br /&gt;
===Compile C++ files to TEST system===&lt;br /&gt;
&lt;br /&gt;
#*./test &amp;lt;DBNAME&amp;gt;&lt;br /&gt;
#*~/neosys ./doall TEST &amp;lt;DBNAME&amp;gt; restart    #to get one service to start start using the new lib files&lt;br /&gt;
#*~/neosys ./doall TEST all restart         #to get all the services to start start using the new lib files&lt;br /&gt;
&lt;br /&gt;
===Install C++ files to LIVE System===&lt;br /&gt;
&lt;br /&gt;
#~/exodus/service/ ./copyall            #to copy all the ~/lib and bin files to ~/live/lib and bin ... which is used by all exodus/live services&lt;br /&gt;
&lt;br /&gt;
==Writing Standard Exodus Core Function/Method Testing==&lt;br /&gt;
Screen 9: ~/exodus/test/src/&lt;br /&gt;
There are a series of test programs that check whether methods/functions behave as intended.&lt;br /&gt;
They do this using the function, assert.. a 1 or more argument values produce one and only one output)&lt;br /&gt;
&lt;br /&gt;
e.g test_multilang.cpp or test_sort.cpp&lt;br /&gt;
&lt;br /&gt;
Two methods of running test programs:&lt;br /&gt;
*Screen 9: make test&lt;br /&gt;
*after compiling using edic/compile/c, enter test_prog_name. (Since compile has moved it to ~/bin)&lt;br /&gt;
&lt;br /&gt;
Difference between the two methods is make calls gdb directly;&lt;br /&gt;
whereas ~/bin/test_prog_name uses exodus compile program&lt;br /&gt;
#~/neosys ./doall LIVE all restart&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Upgrading Exodus==&lt;br /&gt;
&lt;br /&gt;
#Develop patch in Dev system &lt;br /&gt;
&lt;br /&gt;
===Patching neosys/src or exodus/service/src===&lt;br /&gt;
&lt;br /&gt;
#Manually insert patches and compile into test programs.&lt;br /&gt;
#If patch dat files then run neosys/compall to get dat files into ~/dat&lt;br /&gt;
*If Patsalides:&lt;br /&gt;
*#SITE_DIR=ptcy ./test basic &lt;br /&gt;
*#login to BASIC_TEST and test&lt;br /&gt;
*Other clients:&lt;br /&gt;
*#./test DBCODE&lt;br /&gt;
*#login to DBCODE and test patches works&lt;br /&gt;
#run exodus/service/copyall and check only the patched programs are listed. (if not, see Troubleshoot below)&lt;br /&gt;
#Inform users to log off for 10mins. As a rule of thumb, live services must be stopped before copying test programs to live.&lt;br /&gt;
#exodus/service/copyall CONFIRM&lt;br /&gt;
&lt;br /&gt;
====Troubleshoot====&lt;br /&gt;
&lt;br /&gt;
=====./copyall lists programs you have not patched=====&lt;br /&gt;
Use exodus/service/copyone to copy only your patched programs one by one. (./copyone will not copy dat files)&lt;br /&gt;
&lt;br /&gt;
===Upgrading to new version===&lt;br /&gt;
&lt;br /&gt;
READ: remember there is no test version of libexodus programs. This means that if libexodus programs are compiled and installed, neosys/src and exodus/services LIVE programs MUST BE UPGRADED.&lt;br /&gt;
&lt;br /&gt;
#Upgrade test system to test&lt;br /&gt;
##If a dev system like de2, git stash any uncommitted changes other staff may be working on.&lt;br /&gt;
##Run &amp;quot;g&amp;quot; in ~/exodus (to do git pull --ff-only)&lt;br /&gt;
##Run &amp;quot;m&amp;quot; in ~/exodus (to compile and install libexodus)&lt;br /&gt;
##Run &amp;quot;~/neosys/upgrade.all.sh live&amp;quot; in ~/neosys (to upgrade exodus/service and neosys/src live programs)&lt;br /&gt;
##Begin testing&lt;br /&gt;
#Upgrade clients&lt;br /&gt;
##*Client hosted - Schedule a planned upgrade with client.&lt;br /&gt;
##*NEOSYS hosted - Inform all clients/users of planned morning upgrade, 24hours in advanced.      (TODO: &#039;What&#039;s New in NEOSYS&#039;) AND (emailallusers.cpp)&lt;br /&gt;
##Day of upgrade, check USB backup was successful &amp;amp; make a container snapshot, otherwise do not proceed.&lt;br /&gt;
##Stop services&lt;br /&gt;
##Run &amp;quot;g&amp;quot; in ~/exodus (to do git pull --ff-only)&lt;br /&gt;
##Run &amp;quot;m&amp;quot; in ~/exodus (to compile and install libexodus)&lt;br /&gt;
##Run &amp;quot;~/neosys/upgrade.all.sh live&amp;quot;. &lt;br /&gt;
##Check services started automatically without issues.&lt;br /&gt;
#Inform users their system has been upgraded and they can login.&lt;br /&gt;
&lt;br /&gt;
===Roll Back Upgrade===&lt;br /&gt;
&lt;br /&gt;
If for any reason the entire upgrade needs to be reverted (excludes clients database), follow steps below:&lt;br /&gt;
&lt;br /&gt;
#Inform users that there is a problem and services need to be stopped.&lt;br /&gt;
#Stop all exodus processes.&lt;br /&gt;
#Restore the morning&#039;s USB backup by: (Note this backup contains:  source/obj code, /etc, neosys scripts but not client data)&lt;br /&gt;
##Login into container&#039;s host and rsync the morning&#039;s usb backup to the container&#039;s /:&lt;br /&gt;
#*&amp;lt;pre&amp;gt;rsync --dry-run -avz -e &#039;ssh -p &amp;lt;C_SSHPORT&amp;gt;&#039; /backups/usb/&amp;lt;C_CODE&amp;gt; &amp;lt;C_CODE&amp;gt;:/      (Example: rsync --dry-run -avz -e &#039;ssh -p 19582&#039; /backups/usb/ad1 ad1:/&amp;lt;/pre&amp;gt;)&lt;br /&gt;
#Quick sane check, the latest git commit is not the latest git commit in the remote repo.&lt;br /&gt;
#Inform users they can login.&lt;br /&gt;
&lt;br /&gt;
==Configuring services to autostart during login==&lt;br /&gt;
For PTCY,&lt;br /&gt;
&lt;br /&gt;
#Create a file &#039;autostart.cfg&#039; in the data folder &lt;br /&gt;
&lt;br /&gt;
 touch /root/hosts/&amp;lt;dbname&amp;gt;/data/autostart.cfg&lt;br /&gt;
&lt;br /&gt;
This will autostart a database service as long as at least one database service in that directory is running.&lt;br /&gt;
&lt;br /&gt;
For example, demo service will autostart during login if,&lt;br /&gt;
#/root/hosts/demo/data/autostart.cfg exists and&lt;br /&gt;
#demo_test service is running&lt;br /&gt;
&lt;br /&gt;
==Speedup postgresql importing databases==&lt;br /&gt;
&lt;br /&gt;
Can be sped up by a factor of 10 BUT may result in corrupt files in case of hard OS crash where the dirty memory is not flushed to storage.&lt;br /&gt;
&lt;br /&gt;
Therefore it is advisable to use this feature only briefly and REMEMBER TO REMOVE IT! &lt;br /&gt;
&lt;br /&gt;
Email to support@neosys.com whenever using it or use personal notes not memory.&lt;br /&gt;
&lt;br /&gt;
nano /etc/postgresql/12/main/postgresql.conf&lt;br /&gt;
&lt;br /&gt;
Uncomment or add a line&lt;br /&gt;
 fsync = off&lt;br /&gt;
Restart postgres … will break any neosys/exodus running processes.&lt;br /&gt;
 r postgresql&lt;br /&gt;
or reload postgres may also work&lt;br /&gt;
&lt;br /&gt;
==Database Attach==&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
root@exodus:~/exodus/cli/src# dbattach&lt;br /&gt;
dbattach - Attach foreign database files to the current default database&lt;br /&gt;
&lt;br /&gt;
Syntax is dbattach TARGETDB [FILENAME,...] {OPTION...}&lt;br /&gt;
&lt;br /&gt;
Options:&lt;br /&gt;
&lt;br /&gt;
  F   Forcibly delete any normal files in the current default database.&lt;br /&gt;
&lt;br /&gt;
  R   Detach foreign files&lt;br /&gt;
  RR  Remove foreign database connection.&lt;br /&gt;
  RRR Remove all foreign database connections and attachments.&lt;br /&gt;
&lt;br /&gt;
  L   List attached foreign files in the current default database&lt;br /&gt;
&lt;br /&gt;
If no filenames are provided then a database connection is created.&lt;br /&gt;
This is *required* before filenames can be provided and attached.&lt;br /&gt;
&lt;br /&gt;
Notes:&lt;br /&gt;
&lt;br /&gt;
Attachments are permanent until re-attached or removed.&lt;br /&gt;
&lt;br /&gt;
Indexes on attached files behave strangely.&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Issues:&lt;br /&gt;
&lt;br /&gt;
TARGETDB must be on the same connection as the current default database.&lt;br /&gt;
&lt;br /&gt;
Current user must have access to the foreign database.&lt;br /&gt;
&lt;br /&gt;
If EXO_USER and EXO_PASS are not set then exodus defaults are used.&lt;br /&gt;
&lt;br /&gt;
exodus .config file is not used currently.&lt;/div&gt;</summary>
		<author><name>Gregory</name></author>
	</entry>
	<entry>
		<id>https://techwiki.neosys.com/index.php?title=EXODUS_Knowledge&amp;diff=4083</id>
		<title>EXODUS Knowledge</title>
		<link rel="alternate" type="text/html" href="https://techwiki.neosys.com/index.php?title=EXODUS_Knowledge&amp;diff=4083"/>
		<updated>2025-12-12T08:17:34Z</updated>

		<summary type="html">&lt;p&gt;Gregory: /* Postgres */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==TMUX Screens==&lt;br /&gt;
&lt;br /&gt;
To create the EXODUS maintenance/programming environment&lt;br /&gt;
 exodus#: ./tmux.exodus&lt;br /&gt;
&lt;br /&gt;
===Screens===&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
0: /&lt;br /&gt;
    General work for server services/configs. i.e /etc/nagios, /etc/apache2, /var/log/mail.log or general networking.&lt;br /&gt;
&lt;br /&gt;
1: /root/exodus/&lt;br /&gt;
    Exodus core is installed. Contains build and make libraries here ./libexodus&lt;br /&gt;
&lt;br /&gt;
2: /root/exodus/libexodus/exodus&lt;br /&gt;
    Core exodus library source code which emulate the AREV system e.g var.cpp&lt;br /&gt;
    &lt;br /&gt;
3: /root/exodus/cli/src&lt;br /&gt;
    Exodus Command Line Interface E.g edir, edic, list, listfiles, delete, createdb, deletedb.&lt;br /&gt;
    &lt;br /&gt;
4: root/exodus/service&lt;br /&gt;
    EXODUS core default host directory but also contains scripts that create/manage requirements of a service (create_service, create_db, create_site, backup_db, restore_db, start, stop, status)&lt;br /&gt;
    The www/3/exodus has generic .htm, php and .js which provide basic website functionality i.e Login page, Support Menu, User details, Authorization.&lt;br /&gt;
    NEOSYS www files linked into ./www, from /root/neosys/web, which pulled from NEOSYS www git.&lt;br /&gt;
&lt;br /&gt;
5: /root/exodus/service/src&lt;br /&gt;
    Exodus core service programs (programs that are not related to NEOSYS agency operations and can be used to support other non-NEOSYS services) eg listen, usersubs, sendmail, openfile, select, sort, list,.&lt;br /&gt;
&lt;br /&gt;
    Extra info:    &lt;br /&gt;
    The dat/ has generic dictionary files. (See Section Dictionaries &amp;amp; Psql Functions)&lt;br /&gt;
    TODO: compall currently throws few warnings. Read them and familiarise. In case new warnings appear, notify Steve.    &lt;br /&gt;
        &lt;br /&gt;
6: /root/neosys&lt;br /&gt;
    NEOSYS specific client installation &amp;amp; management scripts e.g .doall, import_db and import_files (from AREV), ./run ./test (see below for these two commands)&lt;br /&gt;
    &lt;br /&gt;
7: /root/neosys/src&lt;br /&gt;
    NEOSYS Agency programs (see section How AREV programs are distributed in EXODUS src/*.cpp&lt;br /&gt;
    /root/neosys has the neosys .git&lt;br /&gt;
&lt;br /&gt;
8: /root/hosts&lt;br /&gt;
    client specific files  e.g logs, images, (shared ./www -&amp;gt; root/exodus/service/www&lt;br /&gt;
&lt;br /&gt;
9: /root/exodus/test/src&lt;br /&gt;
    series of programs that test whether subroutines (specifically Exodus core libraries) work as they should eg for the var lib - &amp;quot;assert( var(&amp;quot;11111&amp;quot;).isnum());&amp;quot;&lt;br /&gt;
&lt;br /&gt;
10: bash /bin/top&lt;br /&gt;
    Monitor for NEOSYS client processes&lt;br /&gt;
    Displays customised format: sorted by total time spend and by processor time.&lt;br /&gt;
     Press &amp;quot;=&amp;quot; : to change to standard top format&lt;br /&gt;
     Press shift + w : to save format settings, replacing the old customised top format&lt;br /&gt;
     To go back to the customised format do:&lt;br /&gt;
        Press &amp;quot;o&amp;quot;&lt;br /&gt;
        Type &amp;quot;COMMAND=serve_agy&amp;quot;&lt;br /&gt;
        shift + t : this sorts by total time spent&lt;br /&gt;
        shift + p : this sorts by processor time&lt;br /&gt;
        shift + w : to save this setting and enter  &#039;y&#039; to confirm&lt;br /&gt;
&lt;br /&gt;
11: /var/log/syslog&lt;br /&gt;
     Log of NEOSYS client requests&lt;br /&gt;
&lt;br /&gt;
12: /root/exodus/service/quick&lt;br /&gt;
     Displays the last time the svr file (in /root/hosts/&amp;lt;client&amp;gt;/data/&amp;lt;dbname&amp;gt;) was updated.&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Object Code/Libraries==&lt;br /&gt;
LIVE and TEST processes use different sets of object code.&lt;br /&gt;
TEST processes use libraries in ~/lib/, whereas LIVE processes use object code in ~/neo/lib&lt;br /&gt;
&lt;br /&gt;
This means development &amp;amp; testing can be done stress free on TEST database, as opposed to testing on production databases.&lt;br /&gt;
&lt;br /&gt;
When compiling using edic, the TEST object code is updated if the compilation is successful. (~/lib)&lt;br /&gt;
&lt;br /&gt;
==Dictionaries &amp;amp; Psql Functions==&lt;br /&gt;
&lt;br /&gt;
Dictionaries - data used to describe other data; specifically the fields of other files. &lt;br /&gt;
&lt;br /&gt;
There are three types of fields: &amp;lt;pre&amp;gt;&lt;br /&gt;
(F) Field for raw data E.g &amp;quot;Office 44 Building Rush&amp;quot;&lt;br /&gt;
(S) Symbolic or calculated E.g for total ans=field1+field2&lt;br /&gt;
(G) General or Group E.g &amp;quot;@CRT&amp;quot; which contains always contains the default columns to show on the output of the list program; if no columns provided in list command.&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Show dictionary using &amp;quot;EXO_DATA=test list dict.clients&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
===Development and deployment using &#039;dat&#039; files===&lt;br /&gt;
&lt;br /&gt;
====Rationale====&lt;br /&gt;
&lt;br /&gt;
Part of system development is the creation of various data that is neither programs nor layout i.e. not cpp, h, html, js, php files etc.&lt;br /&gt;
&lt;br /&gt;
For example:&lt;br /&gt;
&lt;br /&gt;
*Dictionaries are data about data.&lt;br /&gt;
*Language files are data about text to use for various languages.&lt;br /&gt;
*“Change logs” are data about changes in the system.&lt;br /&gt;
&lt;br /&gt;
Historically, in EXODUS and NEOSYS, the above data has been deployed in exodus database files using SQL text files. However SQL files are not convenient for development.&lt;br /&gt;
&lt;br /&gt;
Therefore, &#039;dat&#039; text files will be used now so that standard development tools including editors and git can be fully exploited.&lt;br /&gt;
&lt;br /&gt;
====&#039;dat&#039; files====&lt;br /&gt;
&lt;br /&gt;
Each database file is represented by an os directory of the same name.&lt;br /&gt;
&lt;br /&gt;
Each record in the database file is represented by an os text file where filename is the primary key.&lt;br /&gt;
&lt;br /&gt;
For example a record with key &#039;&#039;&#039;DEADLINE&#039;&#039;&#039; in a dat file &#039;&#039;&#039;dict.materials&#039;&#039;&#039; would be represented as an os text file &#039;&#039;&#039;dat/dict.materials/DEADLINE&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Each line in the os text file represents one field in the db record. In other words, db record FM characters are represented by new line characters in &#039;dat&#039; files. Any actual new line characters required in the record, and any backslashes, are escaped and appear as &#039;\n&#039; and &#039;\\&#039; in &#039;dat&#039; files. Other database field separator characters such as VM, SM, TM and STM are stored without any conversion.&lt;br /&gt;
&lt;br /&gt;
====Location of dat files====&lt;br /&gt;
&lt;br /&gt;
The development versions are stored in exodus and neosys src/dat dirs. They form part of the standard git repositories in parallel with cpp files.&lt;br /&gt;
&lt;br /&gt;
The operational versions are stored in ~/dat and ~/live/dat alongside bin and lib dirs and are automatically installed into databases as database files on service startup. Any database functions embedded in the text files (pgsql) are also automatically installed at the same time.&lt;br /&gt;
&lt;br /&gt;
===Delete Database dictionary file===&lt;br /&gt;
&lt;br /&gt;
cli syncdat deletes database files if the dat dir is empty or contains a file &#039;SYNCDAT_DELETE&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
touch neosys/src/dat/dict.users/SYNC_DELETE&lt;br /&gt;
neosys/src~: syncdat&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====Editing and deploying a &#039;dat&#039; file====&lt;br /&gt;
&lt;br /&gt;
It is currently a three step process to edit and deploy such &#039;dat&#039; files. &lt;br /&gt;
&lt;br /&gt;
=====Edit the &#039;dat&#039; file (i.e dict.file record)=====&lt;br /&gt;
&lt;br /&gt;
Note that EXODUS service and NEOSYS service have different src/dat folders.&lt;br /&gt;
&lt;br /&gt;
Editing language items:&lt;br /&gt;
&lt;br /&gt;
 edir dat/alanguage/SCHEDULES*ARABIC&lt;br /&gt;
&lt;br /&gt;
Editing a dictionary item:&lt;br /&gt;
&lt;br /&gt;
 edir dat/dict.materials/DEADLINE&lt;br /&gt;
&lt;br /&gt;
Editing a pgsql function in a dictionary:&lt;br /&gt;
&lt;br /&gt;
 edir dat/dict.materials/DEADLINE 8&lt;br /&gt;
&lt;br /&gt;
=====Copy all &#039;dat&#039; files to ~/dat =====&lt;br /&gt;
&lt;br /&gt;
This step might be removed at a later date.&lt;br /&gt;
&lt;br /&gt;
This will cause all test databases to immediately restart and load any &#039;dat&#039; file changes into dictionaries and data files and also create any new or modified pgsql functions.&lt;br /&gt;
&lt;br /&gt;
If any ~/neosys/src/dat files were edited:&lt;br /&gt;
&lt;br /&gt;
 cd ~/neosys/src&lt;br /&gt;
 &lt;br /&gt;
 ./compall dat&lt;br /&gt;
&lt;br /&gt;
and/or, if exodus/service/dat files were edited&lt;br /&gt;
&lt;br /&gt;
 cd ~/exodus/service/src&lt;br /&gt;
 &lt;br /&gt;
 ./compall dat&lt;br /&gt;
&lt;br /&gt;
=====Copy all programs and &#039;dat&#039; files to ~/live/bin|lib|dat=====&lt;br /&gt;
&lt;br /&gt;
This should only be run after testing. It will cause all live databases to automatically restart and do the same as the test databases mentioned above.&lt;br /&gt;
&lt;br /&gt;
 cd ~/exodus/service&lt;br /&gt;
 &lt;br /&gt;
 ./copyall CONFIRM&lt;br /&gt;
&lt;br /&gt;
=====Delete dat record =====&lt;br /&gt;
&lt;br /&gt;
Simply open the corresponding dat file, remove all lines and save.&lt;br /&gt;
&lt;br /&gt;
===Psql unaccent extension===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The unaccent extension and the immutable_unaccent function are created in the db ‘template1’ during exodus installation while user is postgres which is a superuser.&lt;br /&gt;
&lt;br /&gt;
Thereafter all new databases are created as copies of template1 so they contain the extension and function&lt;br /&gt;
&lt;br /&gt;
====Error====&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
MVDBException:ERROR: function immutable_unaccent(text) does not exist&lt;br /&gt;
ERROR:  permission denied to create extension &amp;quot;unaccent&amp;quot;&lt;br /&gt;
HINT:  Must be superuser to create this extension. &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====Solution====&lt;br /&gt;
sudo -u postgres psql -c &#039;ALTER USER exodus WITH SUPERUSER;&#039;&lt;br /&gt;
&lt;br /&gt;
==Processes==&lt;br /&gt;
The TEST process for all database use the same object code stored in /root/lib, whereas all LIVE process use the object code in /root/neo/.&lt;br /&gt;
&lt;br /&gt;
==Postgres==&lt;br /&gt;
Connect into postgres shell:&lt;br /&gt;
 alias psql=&#039;sudo -u postgres psql&#039;&lt;br /&gt;
&lt;br /&gt;
Delete a database:&lt;br /&gt;
 dbdelete &amp;lt;dbcode&amp;gt;  #exodus cli program&lt;br /&gt;
OR&lt;br /&gt;
 sudo -u postgres dropdb &amp;lt;dbcode&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Debugging Exodus==&lt;br /&gt;
&lt;br /&gt;
===Debugging Live/Test services===&lt;br /&gt;
&lt;br /&gt;
./test &amp;lt;dbname&amp;gt; - execute test programs on _test database.&lt;br /&gt;
&lt;br /&gt;
./run &amp;lt;dbname&amp;gt;  - execute test programs on live database.&lt;br /&gt;
&lt;br /&gt;
===Debugging EXODUS var type variables===&lt;br /&gt;
&lt;br /&gt;
First quick intro of Exodus var type&lt;br /&gt;
&lt;br /&gt;
 var v1 = &amp;quot;hello&amp;quot;;&lt;br /&gt;
 var v2 = 999&lt;br /&gt;
 var v3 = 9.99;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
(gdb) print v1                                                        &lt;br /&gt;
$1 = {var_str = &amp;quot;hello&amp;quot;, var_int = 0,   var_dbl = 0,    var_typ = {flags_ = 1}}&lt;br /&gt;
&lt;br /&gt;
(gdb) print v2&lt;br /&gt;
$2 = {var_str = &amp;quot;&amp;quot;,      var_int = 999, var_dbl = 0,    var_typ = {flags_ = 2}}&lt;br /&gt;
&lt;br /&gt;
(gdb) print v3&lt;br /&gt;
$3 = {var_str = &amp;quot;&amp;quot;,      var_int = 0,   var_dbl = 9.99, var_typ = {flags_ = 3}}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The Exodus var mimics JS var in that you can assign it multiple types.&lt;br /&gt;
&lt;br /&gt;
var_str  is type std::string&lt;br /&gt;
var_int  is type int&lt;br /&gt;
var_dbl  is type long double&lt;br /&gt;
&lt;br /&gt;
var_type is type int (the var type flag)&lt;br /&gt;
&lt;br /&gt;
===== Type flag explained: =====&lt;br /&gt;
The first 3 bits of var_typ (flags_) are used to signify which of the other variables are assigned.&lt;br /&gt;
Examples: &lt;br /&gt;
&lt;br /&gt;
000 (binary) =  0 (flags_) = none are assigned.&lt;br /&gt;
&lt;br /&gt;
100 (binary) =  1 (flags_) = var_str is assigned. (others are not)&lt;br /&gt;
&lt;br /&gt;
010 (binary) =  2 (flags_) = var_int is assigned. (ditto)&lt;br /&gt;
&lt;br /&gt;
001 (binary) =  4 (flags_) = var_dbl is assigned. (ditto)&lt;br /&gt;
&lt;br /&gt;
Combinations:&lt;br /&gt;
&lt;br /&gt;
110 (binary) =  3 (flags_) = var_str &amp;amp; var_int are assigned. (var_dbl is not)&lt;br /&gt;
&lt;br /&gt;
 v1 = &amp;quot;10&amp;quot;;&lt;br /&gt;
 (gdb) p v1&lt;br /&gt;
 $1 = {var_str = &amp;quot;10&amp;quot;, var_int = &amp;quot;&amp;quot;, var_dbl = &amp;quot;&amp;quot;, var_typ = {flags_ = 1}}&lt;br /&gt;
&lt;br /&gt;
 v1 = v1 + 0;&lt;br /&gt;
 (gdb) n #execute that code&lt;br /&gt;
 (gdb) p v1&lt;br /&gt;
 $1 = {var_str = &amp;quot;10&amp;quot;, var_int = &amp;quot;10&amp;quot;, var_dbl = &amp;quot;&amp;quot;, var_typ = {flags_ = 2}}&lt;br /&gt;
&lt;br /&gt;
What happened during &#039;v1 = v1 + 0;&#039;:&lt;br /&gt;
   1. v1&#039;s flag was 1, i.e only var_str was assigned.&lt;br /&gt;
   2. Numeric operator (+) invoked&lt;br /&gt;
   3. Attempt string to numerical type conversion either int or double.&lt;br /&gt;
   4. Yes var_str = &amp;quot;10&amp;quot; -&amp;gt; var_int = 10.&lt;br /&gt;
   5. Update flag to 2 (both var_str/int now assigned)&lt;br /&gt;
   6. var_int = 10, + 0 = 10;&lt;br /&gt;
   &lt;br /&gt;
&lt;br /&gt;
====To inspect a &amp;quot;common&amp;quot; variable (i.e those found in e.g ba_common.h)====&lt;br /&gt;
&lt;br /&gt;
e.g. a variable called ba.ledgern&lt;br /&gt;
&lt;br /&gt;
 p ba.ledgern&lt;br /&gt;
&lt;br /&gt;
OLD METHOD:&lt;br /&gt;
 p ((subExodusProgram::&amp;lt;b&amp;gt;ba&amp;lt;/b&amp;gt;_common)&amp;lt;b&amp;gt;ba&amp;lt;/b&amp;gt;).&amp;lt;b&amp;gt;ledgern&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====To dump all variables in a common====&lt;br /&gt;
&lt;br /&gt;
e.g all variables in ba&lt;br /&gt;
&lt;br /&gt;
 p (subExodusProgram::ba_common)ba&lt;br /&gt;
&lt;br /&gt;
====What types are available in a program?====&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;info types common&lt;br /&gt;
info types subExodus&lt;br /&gt;
info types libexodus&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====Other commands====&lt;br /&gt;
&lt;br /&gt;
 explore subExodusProgram::ba_common&lt;br /&gt;
&lt;br /&gt;
===Process Hung or consuming +100% CPU===&lt;br /&gt;
If process is consuming +100% CPU then it is likely stuck in an infinite loop.&lt;br /&gt;
&lt;br /&gt;
 ./doall &amp;lt;CLIENT&amp;gt; stop&lt;br /&gt;
&lt;br /&gt;
 ./run &amp;lt;CLIENT&amp;gt; &lt;br /&gt;
&lt;br /&gt;
 ./test &amp;lt;CLIENT&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Search through recent logs for &amp;lt;CLIENT&amp;gt; looking for requests that didn&#039;t return OK at the time nagios alerted of Hung process.&lt;br /&gt;
&lt;br /&gt;
A user may also instigate the error again, so monitor the CLIENT&#039;s service CPU usage.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
If cause found recreate it in test and once test process hit +100% break in test debugger.&lt;br /&gt;
&lt;br /&gt;
If cause not found, you will have to continue checking logs for the request that caused it or hope a user recreates the issue in live debugged service.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Once you&#039;ve broken in the debugged with the error, enter &amp;quot;n&amp;quot; and hold the enter key until you just seeing line repeat.&lt;br /&gt;
&lt;br /&gt;
Pay attention to start of loops code. E.g WHILE or FOR. (there is likely an error is there)&lt;br /&gt;
&lt;br /&gt;
==./doall==&lt;br /&gt;
====General====&lt;br /&gt;
&lt;br /&gt;
~/neosys/doall [LIVE|TEST] &amp;lt;DBCODE|ALL&amp;gt; &amp;lt; ACTION [OPTIONS,..]  | bash -- COMMAND ]&lt;br /&gt;
&lt;br /&gt;
Example: &lt;br /&gt;
 ./doall TEST ALL create_site t-&lt;br /&gt;
Result:&lt;br /&gt;
Create site for ALL TEST databases, using domain name prefix option &amp;quot;t-&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Screen 6: ./doall script contains all the necessary information(codes) to setup an installation.&lt;br /&gt;
It includes scripts to backup, restore, create an Apache site, create/start/stop/status a service, import an AREV database into postgres and more.&lt;br /&gt;
&lt;br /&gt;
====backup_db====&lt;br /&gt;
&lt;br /&gt;
*Does a backup &amp;amp; restore of a LIVE database into the corresponding TEST database.&lt;br /&gt;
*Backup &amp;lt;dbcode&amp;gt;.sql file is written to /root/backups/sql; which is rsynced to nl19:/backups/current/exodus/&lt;br /&gt;
*Unlike AREV, postgres can perform a &amp;quot;backup&amp;quot; of a database whilst the system is in use.&lt;br /&gt;
&lt;br /&gt;
==Git==&lt;br /&gt;
&lt;br /&gt;
There are two repositories, one for EXODUS and the other for NEOSYS.&lt;br /&gt;
&lt;br /&gt;
===Using git to make changes===&lt;br /&gt;
&lt;br /&gt;
Before following steps you must have a tested updated to a program/file/script. Do not commit untested changes to avoid a messy git history of reverts.&lt;br /&gt;
&lt;br /&gt;
Update your local repo before committing to local repo using the g alias for &amp;quot;git pull --ff-only ; git push &amp;amp;&amp;amp; git status&#039;&amp;quot;:&lt;br /&gt;
&amp;lt;pre&amp;gt;g&amp;lt;/pre&amp;gt;&lt;br /&gt;
Check which updates/files have not yet been staged and/or committed:&lt;br /&gt;
Add your updates to the staged area:&lt;br /&gt;
&amp;lt;pre&amp;gt;git add &amp;lt;filename&amp;gt;&amp;lt;/pre&amp;gt;&lt;br /&gt;
or if all the changes made need to be staged:&lt;br /&gt;
&amp;lt;pre&amp;gt;git add -a&amp;lt;/pre&amp;gt;&lt;br /&gt;
Make a commit with a descriptive message on purpose of updates:&lt;br /&gt;
&amp;lt;pre&amp;gt;git commit -m &amp;lt;description n purpose of changes&amp;gt;&amp;lt;/pre&amp;gt;&lt;br /&gt;
Again use g alias:&lt;br /&gt;
&amp;lt;pre&amp;gt;g&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Other useful git cmds===&lt;br /&gt;
&lt;br /&gt;
Do not use this commands unless you know what WILL happen. &lt;br /&gt;
*git pull - Instead use the safe &amp;quot;git pull --ff-only&amp;quot;&lt;br /&gt;
Stick to the alias &amp;quot;g&amp;quot; which does &amp;quot;git pull --ff-only ; git push &amp;amp;&amp;amp; git status&#039;&amp;quot;&lt;br /&gt;
&lt;br /&gt;
*git log - display history of commits to master branch&lt;br /&gt;
*git diff - display the differences in files between working files and files in local repo.&lt;br /&gt;
*git status - display: which updated files are staged/not staged(tracked)&lt;br /&gt;
*git stash - &lt;br /&gt;
*git branch - switch to a new branch&lt;br /&gt;
*git branch &amp;lt;branchname&amp;gt; - will switch to this branch only if it exists&lt;br /&gt;
*git checkout - DESTROYS/Updates the state of local working directory with the state of the files in the local repo. (YOU WILL LOSE non staged updates)&lt;br /&gt;
*git restore &amp;lt;filename&amp;gt; - DESTROYS/Updates the file with the version in the local repo. (like with git checkout but for a specific file)&lt;br /&gt;
*git checkin - &lt;br /&gt;
*git revert &amp;lt;commitHash&amp;gt; - reverses a specific commit (use git log to get the chosen commit hash)&lt;br /&gt;
*git ..&lt;br /&gt;
&lt;br /&gt;
==Converting AREV programs to EXODUS==&lt;br /&gt;
===Decompile AREV to C++===&lt;br /&gt;
&lt;br /&gt;
Do in Master AREV Installation Maintenance mode: (win7)&lt;br /&gt;
&lt;br /&gt;
#ATTACH ADECOMC &lt;br /&gt;
#*ADECOM &amp;lt;programname&amp;gt;   *single program&lt;br /&gt;
#*ADECOM &amp;lt;prog1&amp;gt; &amp;lt;prog2&amp;gt; &lt;br /&gt;
#*ADECOMALL              *all programs   (CHECK FIRST)&lt;br /&gt;
&lt;br /&gt;
Include the option &amp;quot;(V)&amp;quot; in the command to print the C++ to a notepad, which can easily be copy and pasted.&lt;br /&gt;
&lt;br /&gt;
===Getting C++ program to Exodus Installation===&lt;br /&gt;
&lt;br /&gt;
Two methods: (use the first for one off programs)&lt;br /&gt;
&lt;br /&gt;
====Copy &amp;amp; Paste====&lt;br /&gt;
&lt;br /&gt;
Compile program and open source code in notepad&lt;br /&gt;
&lt;br /&gt;
 ADECOM &amp;lt;programname&amp;gt; (V)&lt;br /&gt;
&lt;br /&gt;
Find which directory the program belongs. e.g fin/med/job/sys e.t&lt;br /&gt;
&lt;br /&gt;
 find /cygdrive/d/exodus/pickos | grep &amp;lt;program name&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If cpp in SYS, the program belongs in ~/exodus/service/src OR if in MED JOB FIN GEN AGY the program belongs in ~/neosys/src&lt;br /&gt;
&lt;br /&gt;
Copy the source code in the text file from the first command.&lt;br /&gt;
&lt;br /&gt;
In Exodus, create a new .cpp (in correct directory) and paste the source code.&lt;br /&gt;
&lt;br /&gt;
Compile &amp;amp; Test&lt;br /&gt;
&lt;br /&gt;
====Rsync====&lt;br /&gt;
&lt;br /&gt;
 /d/exodus/arev/syncup.sh&lt;br /&gt;
&lt;br /&gt;
If cpp in SYS then: ~/exodus/service/src ./getpickos&lt;br /&gt;
&lt;br /&gt;
If cpp in MED JOB FIN GEN AGY then: *~/neosys/src&lt;br /&gt;
&lt;br /&gt;
===Compile C++ files to TEST system===&lt;br /&gt;
&lt;br /&gt;
#*./test &amp;lt;DBNAME&amp;gt;&lt;br /&gt;
#*~/neosys ./doall TEST &amp;lt;DBNAME&amp;gt; restart    #to get one service to start start using the new lib files&lt;br /&gt;
#*~/neosys ./doall TEST all restart         #to get all the services to start start using the new lib files&lt;br /&gt;
&lt;br /&gt;
===Install C++ files to LIVE System===&lt;br /&gt;
&lt;br /&gt;
#~/exodus/service/ ./copyall            #to copy all the ~/lib and bin files to ~/live/lib and bin ... which is used by all exodus/live services&lt;br /&gt;
&lt;br /&gt;
==Writing Standard Exodus Core Function/Method Testing==&lt;br /&gt;
Screen 9: ~/exodus/test/src/&lt;br /&gt;
There are a series of test programs that check whether methods/functions behave as intended.&lt;br /&gt;
They do this using the function, assert.. a 1 or more argument values produce one and only one output)&lt;br /&gt;
&lt;br /&gt;
e.g test_multilang.cpp or test_sort.cpp&lt;br /&gt;
&lt;br /&gt;
Two methods of running test programs:&lt;br /&gt;
*Screen 9: make test&lt;br /&gt;
*after compiling using edic/compile/c, enter test_prog_name. (Since compile has moved it to ~/bin)&lt;br /&gt;
&lt;br /&gt;
Difference between the two methods is make calls gdb directly;&lt;br /&gt;
whereas ~/bin/test_prog_name uses exodus compile program&lt;br /&gt;
#~/neosys ./doall LIVE all restart&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Upgrading Exodus==&lt;br /&gt;
&lt;br /&gt;
#Develop patch in Dev system &lt;br /&gt;
&lt;br /&gt;
===Patching neosys/src or exodus/service/src===&lt;br /&gt;
&lt;br /&gt;
#Manually insert patches and compile into test programs.&lt;br /&gt;
#If patch dat files then run neosys/compall to get dat files into ~/dat&lt;br /&gt;
*If Patsalides:&lt;br /&gt;
*#SITE_DIR=ptcy ./test basic &lt;br /&gt;
*#login to BASIC_TEST and test&lt;br /&gt;
*Other clients:&lt;br /&gt;
*#./test DBCODE&lt;br /&gt;
*#login to DBCODE and test patches works&lt;br /&gt;
#run exodus/service/copyall and check only the patched programs are listed. (if not, see Troubleshoot below)&lt;br /&gt;
#Inform users to log off for 10mins. As a rule of thumb, live services must be stopped before copying test programs to live.&lt;br /&gt;
#exodus/service/copyall CONFIRM&lt;br /&gt;
&lt;br /&gt;
====Troubleshoot====&lt;br /&gt;
&lt;br /&gt;
=====./copyall lists programs you have not patched=====&lt;br /&gt;
Use exodus/service/copyone to copy only your patched programs one by one. (./copyone will not copy dat files)&lt;br /&gt;
&lt;br /&gt;
===Upgrading to new version===&lt;br /&gt;
&lt;br /&gt;
READ: remember there is no test version of libexodus programs. This means that if libexodus programs are compiled and installed, neosys/src and exodus/services LIVE programs MUST BE UPGRADED.&lt;br /&gt;
&lt;br /&gt;
#Upgrade test system to test&lt;br /&gt;
##If a dev system like de2, git stash any uncommitted changes other staff may be working on.&lt;br /&gt;
##Run &amp;quot;g&amp;quot; in ~/exodus (to do git pull --ff-only)&lt;br /&gt;
##Run &amp;quot;m&amp;quot; in ~/exodus (to compile and install libexodus)&lt;br /&gt;
##Run &amp;quot;~/neosys/upgrade.all.sh live&amp;quot; in ~/neosys (to upgrade exodus/service and neosys/src live programs)&lt;br /&gt;
##Begin testing&lt;br /&gt;
#Upgrade clients&lt;br /&gt;
##*Client hosted - Schedule a planned upgrade with client.&lt;br /&gt;
##*NEOSYS hosted - Inform all clients/users of planned morning upgrade, 24hours in advanced.      (TODO: &#039;What&#039;s New in NEOSYS&#039;) AND (emailallusers.cpp)&lt;br /&gt;
##Day of upgrade, check USB backup was successful &amp;amp; make a container snapshot, otherwise do not proceed.&lt;br /&gt;
##Stop services&lt;br /&gt;
##Run &amp;quot;g&amp;quot; in ~/exodus (to do git pull --ff-only)&lt;br /&gt;
##Run &amp;quot;m&amp;quot; in ~/exodus (to compile and install libexodus)&lt;br /&gt;
##Run &amp;quot;~/neosys/upgrade.all.sh live&amp;quot;. &lt;br /&gt;
##Check services started automatically without issues.&lt;br /&gt;
#Inform users their system has been upgraded and they can login.&lt;br /&gt;
&lt;br /&gt;
===Roll Back Upgrade===&lt;br /&gt;
&lt;br /&gt;
If for any reason the entire upgrade needs to be reverted (excludes clients database), follow steps below:&lt;br /&gt;
&lt;br /&gt;
#Inform users that there is a problem and services need to be stopped.&lt;br /&gt;
#Stop all exodus processes.&lt;br /&gt;
#Restore the morning&#039;s USB backup by: (Note this backup contains:  source/obj code, /etc, neosys scripts but not client data)&lt;br /&gt;
##Login into container&#039;s host and rsync the morning&#039;s usb backup to the container&#039;s /:&lt;br /&gt;
#*&amp;lt;pre&amp;gt;rsync --dry-run -avz -e &#039;ssh -p &amp;lt;C_SSHPORT&amp;gt;&#039; /backups/usb/&amp;lt;C_CODE&amp;gt; &amp;lt;C_CODE&amp;gt;:/      (Example: rsync --dry-run -avz -e &#039;ssh -p 19582&#039; /backups/usb/ad1 ad1:/&amp;lt;/pre&amp;gt;)&lt;br /&gt;
#Quick sane check, the latest git commit is not the latest git commit in the remote repo.&lt;br /&gt;
#Inform users they can login.&lt;br /&gt;
&lt;br /&gt;
==Configuring services to autostart during login==&lt;br /&gt;
For PTCY,&lt;br /&gt;
&lt;br /&gt;
#Create a file &#039;autostart.cfg&#039; in the data folder &lt;br /&gt;
&lt;br /&gt;
 touch /root/hosts/&amp;lt;dbname&amp;gt;/data/autostart.cfg&lt;br /&gt;
&lt;br /&gt;
This will autostart a database service as long as at least one database service in that directory is running.&lt;br /&gt;
&lt;br /&gt;
For example, demo service will autostart during login if,&lt;br /&gt;
#/root/hosts/demo/data/autostart.cfg exists and&lt;br /&gt;
#demo_test service is running&lt;br /&gt;
&lt;br /&gt;
==Speedup postgresql importing databases==&lt;br /&gt;
&lt;br /&gt;
Can be sped up by a factor of 10 BUT may result in corrupt files in case of hard OS crash where the dirty memory is not flushed to storage.&lt;br /&gt;
&lt;br /&gt;
Therefore it is advisable to use this feature only briefly and REMEMBER TO REMOVE IT! &lt;br /&gt;
&lt;br /&gt;
Email to support@neosys.com whenever using it or use personal notes not memory.&lt;br /&gt;
&lt;br /&gt;
nano /etc/postgresql/12/main/postgresql.conf&lt;br /&gt;
&lt;br /&gt;
Uncomment or add a line&lt;br /&gt;
 fsync = off&lt;br /&gt;
Restart postgres … will break any neosys/exodus running processes.&lt;br /&gt;
 r postgresql&lt;br /&gt;
or reload postgres may also work&lt;br /&gt;
&lt;br /&gt;
==Database Attach==&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
root@exodus:~/exodus/cli/src# dbattach&lt;br /&gt;
dbattach - Attach foreign database files to the current default database&lt;br /&gt;
&lt;br /&gt;
Syntax is dbattach TARGETDB [FILENAME,...] {OPTION...}&lt;br /&gt;
&lt;br /&gt;
Options:&lt;br /&gt;
&lt;br /&gt;
  F   Forcibly delete any normal files in the current default database.&lt;br /&gt;
&lt;br /&gt;
  R   Detach foreign files&lt;br /&gt;
  RR  Remove foreign database connection.&lt;br /&gt;
  RRR Remove all foreign database connections and attachments.&lt;br /&gt;
&lt;br /&gt;
  L   List attached foreign files in the current default database&lt;br /&gt;
&lt;br /&gt;
If no filenames are provided then a database connection is created.&lt;br /&gt;
This is *required* before filenames can be provided and attached.&lt;br /&gt;
&lt;br /&gt;
Notes:&lt;br /&gt;
&lt;br /&gt;
Attachments are permanent until re-attached or removed.&lt;br /&gt;
&lt;br /&gt;
Indexes on attached files behave strangely.&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Issues:&lt;br /&gt;
&lt;br /&gt;
TARGETDB must be on the same connection as the current default database.&lt;br /&gt;
&lt;br /&gt;
Current user must have access to the foreign database.&lt;br /&gt;
&lt;br /&gt;
If EXO_USER and EXO_PASS are not set then exodus defaults are used.&lt;br /&gt;
&lt;br /&gt;
exodus .config file is not used currently.&lt;/div&gt;</summary>
		<author><name>Gregory</name></author>
	</entry>
	<entry>
		<id>https://techwiki.neosys.com/index.php?title=EXODUS_Knowledge&amp;diff=4082</id>
		<title>EXODUS Knowledge</title>
		<link rel="alternate" type="text/html" href="https://techwiki.neosys.com/index.php?title=EXODUS_Knowledge&amp;diff=4082"/>
		<updated>2025-12-12T08:14:02Z</updated>

		<summary type="html">&lt;p&gt;Gregory: /* Debugging var values */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==TMUX Screens==&lt;br /&gt;
&lt;br /&gt;
To create the EXODUS maintenance/programming environment&lt;br /&gt;
 exodus#: ./tmux.exodus&lt;br /&gt;
&lt;br /&gt;
===Screens===&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
0: /&lt;br /&gt;
    General work for server services/configs. i.e /etc/nagios, /etc/apache2, /var/log/mail.log or general networking.&lt;br /&gt;
&lt;br /&gt;
1: /root/exodus/&lt;br /&gt;
    Exodus core is installed. Contains build and make libraries here ./libexodus&lt;br /&gt;
&lt;br /&gt;
2: /root/exodus/libexodus/exodus&lt;br /&gt;
    Core exodus library source code which emulate the AREV system e.g var.cpp&lt;br /&gt;
    &lt;br /&gt;
3: /root/exodus/cli/src&lt;br /&gt;
    Exodus Command Line Interface E.g edir, edic, list, listfiles, delete, createdb, deletedb.&lt;br /&gt;
    &lt;br /&gt;
4: root/exodus/service&lt;br /&gt;
    EXODUS core default host directory but also contains scripts that create/manage requirements of a service (create_service, create_db, create_site, backup_db, restore_db, start, stop, status)&lt;br /&gt;
    The www/3/exodus has generic .htm, php and .js which provide basic website functionality i.e Login page, Support Menu, User details, Authorization.&lt;br /&gt;
    NEOSYS www files linked into ./www, from /root/neosys/web, which pulled from NEOSYS www git.&lt;br /&gt;
&lt;br /&gt;
5: /root/exodus/service/src&lt;br /&gt;
    Exodus core service programs (programs that are not related to NEOSYS agency operations and can be used to support other non-NEOSYS services) eg listen, usersubs, sendmail, openfile, select, sort, list,.&lt;br /&gt;
&lt;br /&gt;
    Extra info:    &lt;br /&gt;
    The dat/ has generic dictionary files. (See Section Dictionaries &amp;amp; Psql Functions)&lt;br /&gt;
    TODO: compall currently throws few warnings. Read them and familiarise. In case new warnings appear, notify Steve.    &lt;br /&gt;
        &lt;br /&gt;
6: /root/neosys&lt;br /&gt;
    NEOSYS specific client installation &amp;amp; management scripts e.g .doall, import_db and import_files (from AREV), ./run ./test (see below for these two commands)&lt;br /&gt;
    &lt;br /&gt;
7: /root/neosys/src&lt;br /&gt;
    NEOSYS Agency programs (see section How AREV programs are distributed in EXODUS src/*.cpp&lt;br /&gt;
    /root/neosys has the neosys .git&lt;br /&gt;
&lt;br /&gt;
8: /root/hosts&lt;br /&gt;
    client specific files  e.g logs, images, (shared ./www -&amp;gt; root/exodus/service/www&lt;br /&gt;
&lt;br /&gt;
9: /root/exodus/test/src&lt;br /&gt;
    series of programs that test whether subroutines (specifically Exodus core libraries) work as they should eg for the var lib - &amp;quot;assert( var(&amp;quot;11111&amp;quot;).isnum());&amp;quot;&lt;br /&gt;
&lt;br /&gt;
10: bash /bin/top&lt;br /&gt;
    Monitor for NEOSYS client processes&lt;br /&gt;
    Displays customised format: sorted by total time spend and by processor time.&lt;br /&gt;
     Press &amp;quot;=&amp;quot; : to change to standard top format&lt;br /&gt;
     Press shift + w : to save format settings, replacing the old customised top format&lt;br /&gt;
     To go back to the customised format do:&lt;br /&gt;
        Press &amp;quot;o&amp;quot;&lt;br /&gt;
        Type &amp;quot;COMMAND=serve_agy&amp;quot;&lt;br /&gt;
        shift + t : this sorts by total time spent&lt;br /&gt;
        shift + p : this sorts by processor time&lt;br /&gt;
        shift + w : to save this setting and enter  &#039;y&#039; to confirm&lt;br /&gt;
&lt;br /&gt;
11: /var/log/syslog&lt;br /&gt;
     Log of NEOSYS client requests&lt;br /&gt;
&lt;br /&gt;
12: /root/exodus/service/quick&lt;br /&gt;
     Displays the last time the svr file (in /root/hosts/&amp;lt;client&amp;gt;/data/&amp;lt;dbname&amp;gt;) was updated.&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Object Code/Libraries==&lt;br /&gt;
LIVE and TEST processes use different sets of object code.&lt;br /&gt;
TEST processes use libraries in ~/lib/, whereas LIVE processes use object code in ~/neo/lib&lt;br /&gt;
&lt;br /&gt;
This means development &amp;amp; testing can be done stress free on TEST database, as opposed to testing on production databases.&lt;br /&gt;
&lt;br /&gt;
When compiling using edic, the TEST object code is updated if the compilation is successful. (~/lib)&lt;br /&gt;
&lt;br /&gt;
==Dictionaries &amp;amp; Psql Functions==&lt;br /&gt;
&lt;br /&gt;
Dictionaries - data used to describe other data; specifically the fields of other files. &lt;br /&gt;
&lt;br /&gt;
There are three types of fields: &amp;lt;pre&amp;gt;&lt;br /&gt;
(F) Field for raw data E.g &amp;quot;Office 44 Building Rush&amp;quot;&lt;br /&gt;
(S) Symbolic or calculated E.g for total ans=field1+field2&lt;br /&gt;
(G) General or Group E.g &amp;quot;@CRT&amp;quot; which contains always contains the default columns to show on the output of the list program; if no columns provided in list command.&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Show dictionary using &amp;quot;EXO_DATA=test list dict.clients&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
===Development and deployment using &#039;dat&#039; files===&lt;br /&gt;
&lt;br /&gt;
====Rationale====&lt;br /&gt;
&lt;br /&gt;
Part of system development is the creation of various data that is neither programs nor layout i.e. not cpp, h, html, js, php files etc.&lt;br /&gt;
&lt;br /&gt;
For example:&lt;br /&gt;
&lt;br /&gt;
*Dictionaries are data about data.&lt;br /&gt;
*Language files are data about text to use for various languages.&lt;br /&gt;
*“Change logs” are data about changes in the system.&lt;br /&gt;
&lt;br /&gt;
Historically, in EXODUS and NEOSYS, the above data has been deployed in exodus database files using SQL text files. However SQL files are not convenient for development.&lt;br /&gt;
&lt;br /&gt;
Therefore, &#039;dat&#039; text files will be used now so that standard development tools including editors and git can be fully exploited.&lt;br /&gt;
&lt;br /&gt;
====&#039;dat&#039; files====&lt;br /&gt;
&lt;br /&gt;
Each database file is represented by an os directory of the same name.&lt;br /&gt;
&lt;br /&gt;
Each record in the database file is represented by an os text file where filename is the primary key.&lt;br /&gt;
&lt;br /&gt;
For example a record with key &#039;&#039;&#039;DEADLINE&#039;&#039;&#039; in a dat file &#039;&#039;&#039;dict.materials&#039;&#039;&#039; would be represented as an os text file &#039;&#039;&#039;dat/dict.materials/DEADLINE&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Each line in the os text file represents one field in the db record. In other words, db record FM characters are represented by new line characters in &#039;dat&#039; files. Any actual new line characters required in the record, and any backslashes, are escaped and appear as &#039;\n&#039; and &#039;\\&#039; in &#039;dat&#039; files. Other database field separator characters such as VM, SM, TM and STM are stored without any conversion.&lt;br /&gt;
&lt;br /&gt;
====Location of dat files====&lt;br /&gt;
&lt;br /&gt;
The development versions are stored in exodus and neosys src/dat dirs. They form part of the standard git repositories in parallel with cpp files.&lt;br /&gt;
&lt;br /&gt;
The operational versions are stored in ~/dat and ~/live/dat alongside bin and lib dirs and are automatically installed into databases as database files on service startup. Any database functions embedded in the text files (pgsql) are also automatically installed at the same time.&lt;br /&gt;
&lt;br /&gt;
===Delete Database dictionary file===&lt;br /&gt;
&lt;br /&gt;
cli syncdat deletes database files if the dat dir is empty or contains a file &#039;SYNCDAT_DELETE&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
touch neosys/src/dat/dict.users/SYNC_DELETE&lt;br /&gt;
neosys/src~: syncdat&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====Editing and deploying a &#039;dat&#039; file====&lt;br /&gt;
&lt;br /&gt;
It is currently a three step process to edit and deploy such &#039;dat&#039; files. &lt;br /&gt;
&lt;br /&gt;
=====Edit the &#039;dat&#039; file (i.e dict.file record)=====&lt;br /&gt;
&lt;br /&gt;
Note that EXODUS service and NEOSYS service have different src/dat folders.&lt;br /&gt;
&lt;br /&gt;
Editing language items:&lt;br /&gt;
&lt;br /&gt;
 edir dat/alanguage/SCHEDULES*ARABIC&lt;br /&gt;
&lt;br /&gt;
Editing a dictionary item:&lt;br /&gt;
&lt;br /&gt;
 edir dat/dict.materials/DEADLINE&lt;br /&gt;
&lt;br /&gt;
Editing a pgsql function in a dictionary:&lt;br /&gt;
&lt;br /&gt;
 edir dat/dict.materials/DEADLINE 8&lt;br /&gt;
&lt;br /&gt;
=====Copy all &#039;dat&#039; files to ~/dat =====&lt;br /&gt;
&lt;br /&gt;
This step might be removed at a later date.&lt;br /&gt;
&lt;br /&gt;
This will cause all test databases to immediately restart and load any &#039;dat&#039; file changes into dictionaries and data files and also create any new or modified pgsql functions.&lt;br /&gt;
&lt;br /&gt;
If any ~/neosys/src/dat files were edited:&lt;br /&gt;
&lt;br /&gt;
 cd ~/neosys/src&lt;br /&gt;
 &lt;br /&gt;
 ./compall dat&lt;br /&gt;
&lt;br /&gt;
and/or, if exodus/service/dat files were edited&lt;br /&gt;
&lt;br /&gt;
 cd ~/exodus/service/src&lt;br /&gt;
 &lt;br /&gt;
 ./compall dat&lt;br /&gt;
&lt;br /&gt;
=====Copy all programs and &#039;dat&#039; files to ~/live/bin|lib|dat=====&lt;br /&gt;
&lt;br /&gt;
This should only be run after testing. It will cause all live databases to automatically restart and do the same as the test databases mentioned above.&lt;br /&gt;
&lt;br /&gt;
 cd ~/exodus/service&lt;br /&gt;
 &lt;br /&gt;
 ./copyall CONFIRM&lt;br /&gt;
&lt;br /&gt;
=====Delete dat record =====&lt;br /&gt;
&lt;br /&gt;
Simply open the corresponding dat file, remove all lines and save.&lt;br /&gt;
&lt;br /&gt;
===Psql unaccent extension===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The unaccent extension and the immutable_unaccent function are created in the db ‘template1’ during exodus installation while user is postgres which is a superuser.&lt;br /&gt;
&lt;br /&gt;
Thereafter all new databases are created as copies of template1 so they contain the extension and function&lt;br /&gt;
&lt;br /&gt;
====Error====&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
MVDBException:ERROR: function immutable_unaccent(text) does not exist&lt;br /&gt;
ERROR:  permission denied to create extension &amp;quot;unaccent&amp;quot;&lt;br /&gt;
HINT:  Must be superuser to create this extension. &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====Solution====&lt;br /&gt;
sudo -u postgres psql -c &#039;ALTER USER exodus WITH SUPERUSER;&#039;&lt;br /&gt;
&lt;br /&gt;
==Processes==&lt;br /&gt;
The TEST process for all database use the same object code stored in /root/lib, whereas all LIVE process use the object code in /root/neo/.&lt;br /&gt;
&lt;br /&gt;
==Postgres==&lt;br /&gt;
Connect into postgres shell:&lt;br /&gt;
 alias psql=&#039;sudo -u postgres psql&#039;&lt;br /&gt;
&lt;br /&gt;
Delete a database:&lt;br /&gt;
 sudo -u postgres dropdb &amp;lt;dbcode&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Debugging Exodus==&lt;br /&gt;
&lt;br /&gt;
===Debugging Live/Test services===&lt;br /&gt;
&lt;br /&gt;
./test &amp;lt;dbname&amp;gt; - execute test programs on _test database.&lt;br /&gt;
&lt;br /&gt;
./run &amp;lt;dbname&amp;gt;  - execute test programs on live database.&lt;br /&gt;
&lt;br /&gt;
===Debugging EXODUS var type variables===&lt;br /&gt;
&lt;br /&gt;
First quick intro of Exodus var type&lt;br /&gt;
&lt;br /&gt;
 var v1 = &amp;quot;hello&amp;quot;;&lt;br /&gt;
 var v2 = 999&lt;br /&gt;
 var v3 = 9.99;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
(gdb) print v1                                                        &lt;br /&gt;
$1 = {var_str = &amp;quot;hello&amp;quot;, var_int = 0,   var_dbl = 0,    var_typ = {flags_ = 1}}&lt;br /&gt;
&lt;br /&gt;
(gdb) print v2&lt;br /&gt;
$2 = {var_str = &amp;quot;&amp;quot;,      var_int = 999, var_dbl = 0,    var_typ = {flags_ = 2}}&lt;br /&gt;
&lt;br /&gt;
(gdb) print v3&lt;br /&gt;
$3 = {var_str = &amp;quot;&amp;quot;,      var_int = 0,   var_dbl = 9.99, var_typ = {flags_ = 3}}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The Exodus var mimics JS var in that you can assign it multiple types.&lt;br /&gt;
&lt;br /&gt;
var_str  is type std::string&lt;br /&gt;
var_int  is type int&lt;br /&gt;
var_dbl  is type long double&lt;br /&gt;
&lt;br /&gt;
var_type is type int (the var type flag)&lt;br /&gt;
&lt;br /&gt;
===== Type flag explained: =====&lt;br /&gt;
The first 3 bits of var_typ (flags_) are used to signify which of the other variables are assigned.&lt;br /&gt;
Examples: &lt;br /&gt;
&lt;br /&gt;
000 (binary) =  0 (flags_) = none are assigned.&lt;br /&gt;
&lt;br /&gt;
100 (binary) =  1 (flags_) = var_str is assigned. (others are not)&lt;br /&gt;
&lt;br /&gt;
010 (binary) =  2 (flags_) = var_int is assigned. (ditto)&lt;br /&gt;
&lt;br /&gt;
001 (binary) =  4 (flags_) = var_dbl is assigned. (ditto)&lt;br /&gt;
&lt;br /&gt;
Combinations:&lt;br /&gt;
&lt;br /&gt;
110 (binary) =  3 (flags_) = var_str &amp;amp; var_int are assigned. (var_dbl is not)&lt;br /&gt;
&lt;br /&gt;
 v1 = &amp;quot;10&amp;quot;;&lt;br /&gt;
 (gdb) p v1&lt;br /&gt;
 $1 = {var_str = &amp;quot;10&amp;quot;, var_int = &amp;quot;&amp;quot;, var_dbl = &amp;quot;&amp;quot;, var_typ = {flags_ = 1}}&lt;br /&gt;
&lt;br /&gt;
 v1 = v1 + 0;&lt;br /&gt;
 (gdb) n #execute that code&lt;br /&gt;
 (gdb) p v1&lt;br /&gt;
 $1 = {var_str = &amp;quot;10&amp;quot;, var_int = &amp;quot;10&amp;quot;, var_dbl = &amp;quot;&amp;quot;, var_typ = {flags_ = 2}}&lt;br /&gt;
&lt;br /&gt;
What happened during &#039;v1 = v1 + 0;&#039;:&lt;br /&gt;
   1. v1&#039;s flag was 1, i.e only var_str was assigned.&lt;br /&gt;
   2. Numeric operator (+) invoked&lt;br /&gt;
   3. Attempt string to numerical type conversion either int or double.&lt;br /&gt;
   4. Yes var_str = &amp;quot;10&amp;quot; -&amp;gt; var_int = 10.&lt;br /&gt;
   5. Update flag to 2 (both var_str/int now assigned)&lt;br /&gt;
   6. var_int = 10, + 0 = 10;&lt;br /&gt;
   &lt;br /&gt;
&lt;br /&gt;
====To inspect a &amp;quot;common&amp;quot; variable (i.e those found in e.g ba_common.h)====&lt;br /&gt;
&lt;br /&gt;
e.g. a variable called ba.ledgern&lt;br /&gt;
&lt;br /&gt;
 p ba.ledgern&lt;br /&gt;
&lt;br /&gt;
OLD METHOD:&lt;br /&gt;
 p ((subExodusProgram::&amp;lt;b&amp;gt;ba&amp;lt;/b&amp;gt;_common)&amp;lt;b&amp;gt;ba&amp;lt;/b&amp;gt;).&amp;lt;b&amp;gt;ledgern&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====To dump all variables in a common====&lt;br /&gt;
&lt;br /&gt;
e.g all variables in ba&lt;br /&gt;
&lt;br /&gt;
 p (subExodusProgram::ba_common)ba&lt;br /&gt;
&lt;br /&gt;
====What types are available in a program?====&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;info types common&lt;br /&gt;
info types subExodus&lt;br /&gt;
info types libexodus&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====Other commands====&lt;br /&gt;
&lt;br /&gt;
 explore subExodusProgram::ba_common&lt;br /&gt;
&lt;br /&gt;
===Process Hung or consuming +100% CPU===&lt;br /&gt;
If process is consuming +100% CPU then it is likely stuck in an infinite loop.&lt;br /&gt;
&lt;br /&gt;
 ./doall &amp;lt;CLIENT&amp;gt; stop&lt;br /&gt;
&lt;br /&gt;
 ./run &amp;lt;CLIENT&amp;gt; &lt;br /&gt;
&lt;br /&gt;
 ./test &amp;lt;CLIENT&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Search through recent logs for &amp;lt;CLIENT&amp;gt; looking for requests that didn&#039;t return OK at the time nagios alerted of Hung process.&lt;br /&gt;
&lt;br /&gt;
A user may also instigate the error again, so monitor the CLIENT&#039;s service CPU usage.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
If cause found recreate it in test and once test process hit +100% break in test debugger.&lt;br /&gt;
&lt;br /&gt;
If cause not found, you will have to continue checking logs for the request that caused it or hope a user recreates the issue in live debugged service.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Once you&#039;ve broken in the debugged with the error, enter &amp;quot;n&amp;quot; and hold the enter key until you just seeing line repeat.&lt;br /&gt;
&lt;br /&gt;
Pay attention to start of loops code. E.g WHILE or FOR. (there is likely an error is there)&lt;br /&gt;
&lt;br /&gt;
==./doall==&lt;br /&gt;
====General====&lt;br /&gt;
&lt;br /&gt;
~/neosys/doall [LIVE|TEST] &amp;lt;DBCODE|ALL&amp;gt; &amp;lt; ACTION [OPTIONS,..]  | bash -- COMMAND ]&lt;br /&gt;
&lt;br /&gt;
Example: &lt;br /&gt;
 ./doall TEST ALL create_site t-&lt;br /&gt;
Result:&lt;br /&gt;
Create site for ALL TEST databases, using domain name prefix option &amp;quot;t-&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Screen 6: ./doall script contains all the necessary information(codes) to setup an installation.&lt;br /&gt;
It includes scripts to backup, restore, create an Apache site, create/start/stop/status a service, import an AREV database into postgres and more.&lt;br /&gt;
&lt;br /&gt;
====backup_db====&lt;br /&gt;
&lt;br /&gt;
*Does a backup &amp;amp; restore of a LIVE database into the corresponding TEST database.&lt;br /&gt;
*Backup &amp;lt;dbcode&amp;gt;.sql file is written to /root/backups/sql; which is rsynced to nl19:/backups/current/exodus/&lt;br /&gt;
*Unlike AREV, postgres can perform a &amp;quot;backup&amp;quot; of a database whilst the system is in use.&lt;br /&gt;
&lt;br /&gt;
==Git==&lt;br /&gt;
&lt;br /&gt;
There are two repositories, one for EXODUS and the other for NEOSYS.&lt;br /&gt;
&lt;br /&gt;
===Using git to make changes===&lt;br /&gt;
&lt;br /&gt;
Before following steps you must have a tested updated to a program/file/script. Do not commit untested changes to avoid a messy git history of reverts.&lt;br /&gt;
&lt;br /&gt;
Update your local repo before committing to local repo using the g alias for &amp;quot;git pull --ff-only ; git push &amp;amp;&amp;amp; git status&#039;&amp;quot;:&lt;br /&gt;
&amp;lt;pre&amp;gt;g&amp;lt;/pre&amp;gt;&lt;br /&gt;
Check which updates/files have not yet been staged and/or committed:&lt;br /&gt;
Add your updates to the staged area:&lt;br /&gt;
&amp;lt;pre&amp;gt;git add &amp;lt;filename&amp;gt;&amp;lt;/pre&amp;gt;&lt;br /&gt;
or if all the changes made need to be staged:&lt;br /&gt;
&amp;lt;pre&amp;gt;git add -a&amp;lt;/pre&amp;gt;&lt;br /&gt;
Make a commit with a descriptive message on purpose of updates:&lt;br /&gt;
&amp;lt;pre&amp;gt;git commit -m &amp;lt;description n purpose of changes&amp;gt;&amp;lt;/pre&amp;gt;&lt;br /&gt;
Again use g alias:&lt;br /&gt;
&amp;lt;pre&amp;gt;g&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Other useful git cmds===&lt;br /&gt;
&lt;br /&gt;
Do not use this commands unless you know what WILL happen. &lt;br /&gt;
*git pull - Instead use the safe &amp;quot;git pull --ff-only&amp;quot;&lt;br /&gt;
Stick to the alias &amp;quot;g&amp;quot; which does &amp;quot;git pull --ff-only ; git push &amp;amp;&amp;amp; git status&#039;&amp;quot;&lt;br /&gt;
&lt;br /&gt;
*git log - display history of commits to master branch&lt;br /&gt;
*git diff - display the differences in files between working files and files in local repo.&lt;br /&gt;
*git status - display: which updated files are staged/not staged(tracked)&lt;br /&gt;
*git stash - &lt;br /&gt;
*git branch - switch to a new branch&lt;br /&gt;
*git branch &amp;lt;branchname&amp;gt; - will switch to this branch only if it exists&lt;br /&gt;
*git checkout - DESTROYS/Updates the state of local working directory with the state of the files in the local repo. (YOU WILL LOSE non staged updates)&lt;br /&gt;
*git restore &amp;lt;filename&amp;gt; - DESTROYS/Updates the file with the version in the local repo. (like with git checkout but for a specific file)&lt;br /&gt;
*git checkin - &lt;br /&gt;
*git revert &amp;lt;commitHash&amp;gt; - reverses a specific commit (use git log to get the chosen commit hash)&lt;br /&gt;
*git ..&lt;br /&gt;
&lt;br /&gt;
==Converting AREV programs to EXODUS==&lt;br /&gt;
===Decompile AREV to C++===&lt;br /&gt;
&lt;br /&gt;
Do in Master AREV Installation Maintenance mode: (win7)&lt;br /&gt;
&lt;br /&gt;
#ATTACH ADECOMC &lt;br /&gt;
#*ADECOM &amp;lt;programname&amp;gt;   *single program&lt;br /&gt;
#*ADECOM &amp;lt;prog1&amp;gt; &amp;lt;prog2&amp;gt; &lt;br /&gt;
#*ADECOMALL              *all programs   (CHECK FIRST)&lt;br /&gt;
&lt;br /&gt;
Include the option &amp;quot;(V)&amp;quot; in the command to print the C++ to a notepad, which can easily be copy and pasted.&lt;br /&gt;
&lt;br /&gt;
===Getting C++ program to Exodus Installation===&lt;br /&gt;
&lt;br /&gt;
Two methods: (use the first for one off programs)&lt;br /&gt;
&lt;br /&gt;
====Copy &amp;amp; Paste====&lt;br /&gt;
&lt;br /&gt;
Compile program and open source code in notepad&lt;br /&gt;
&lt;br /&gt;
 ADECOM &amp;lt;programname&amp;gt; (V)&lt;br /&gt;
&lt;br /&gt;
Find which directory the program belongs. e.g fin/med/job/sys e.t&lt;br /&gt;
&lt;br /&gt;
 find /cygdrive/d/exodus/pickos | grep &amp;lt;program name&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If cpp in SYS, the program belongs in ~/exodus/service/src OR if in MED JOB FIN GEN AGY the program belongs in ~/neosys/src&lt;br /&gt;
&lt;br /&gt;
Copy the source code in the text file from the first command.&lt;br /&gt;
&lt;br /&gt;
In Exodus, create a new .cpp (in correct directory) and paste the source code.&lt;br /&gt;
&lt;br /&gt;
Compile &amp;amp; Test&lt;br /&gt;
&lt;br /&gt;
====Rsync====&lt;br /&gt;
&lt;br /&gt;
 /d/exodus/arev/syncup.sh&lt;br /&gt;
&lt;br /&gt;
If cpp in SYS then: ~/exodus/service/src ./getpickos&lt;br /&gt;
&lt;br /&gt;
If cpp in MED JOB FIN GEN AGY then: *~/neosys/src&lt;br /&gt;
&lt;br /&gt;
===Compile C++ files to TEST system===&lt;br /&gt;
&lt;br /&gt;
#*./test &amp;lt;DBNAME&amp;gt;&lt;br /&gt;
#*~/neosys ./doall TEST &amp;lt;DBNAME&amp;gt; restart    #to get one service to start start using the new lib files&lt;br /&gt;
#*~/neosys ./doall TEST all restart         #to get all the services to start start using the new lib files&lt;br /&gt;
&lt;br /&gt;
===Install C++ files to LIVE System===&lt;br /&gt;
&lt;br /&gt;
#~/exodus/service/ ./copyall            #to copy all the ~/lib and bin files to ~/live/lib and bin ... which is used by all exodus/live services&lt;br /&gt;
&lt;br /&gt;
==Writing Standard Exodus Core Function/Method Testing==&lt;br /&gt;
Screen 9: ~/exodus/test/src/&lt;br /&gt;
There are a series of test programs that check whether methods/functions behave as intended.&lt;br /&gt;
They do this using the function, assert.. a 1 or more argument values produce one and only one output)&lt;br /&gt;
&lt;br /&gt;
e.g test_multilang.cpp or test_sort.cpp&lt;br /&gt;
&lt;br /&gt;
Two methods of running test programs:&lt;br /&gt;
*Screen 9: make test&lt;br /&gt;
*after compiling using edic/compile/c, enter test_prog_name. (Since compile has moved it to ~/bin)&lt;br /&gt;
&lt;br /&gt;
Difference between the two methods is make calls gdb directly;&lt;br /&gt;
whereas ~/bin/test_prog_name uses exodus compile program&lt;br /&gt;
#~/neosys ./doall LIVE all restart&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Upgrading Exodus==&lt;br /&gt;
&lt;br /&gt;
#Develop patch in Dev system &lt;br /&gt;
&lt;br /&gt;
===Patching neosys/src or exodus/service/src===&lt;br /&gt;
&lt;br /&gt;
#Manually insert patches and compile into test programs.&lt;br /&gt;
#If patch dat files then run neosys/compall to get dat files into ~/dat&lt;br /&gt;
*If Patsalides:&lt;br /&gt;
*#SITE_DIR=ptcy ./test basic &lt;br /&gt;
*#login to BASIC_TEST and test&lt;br /&gt;
*Other clients:&lt;br /&gt;
*#./test DBCODE&lt;br /&gt;
*#login to DBCODE and test patches works&lt;br /&gt;
#run exodus/service/copyall and check only the patched programs are listed. (if not, see Troubleshoot below)&lt;br /&gt;
#Inform users to log off for 10mins. As a rule of thumb, live services must be stopped before copying test programs to live.&lt;br /&gt;
#exodus/service/copyall CONFIRM&lt;br /&gt;
&lt;br /&gt;
====Troubleshoot====&lt;br /&gt;
&lt;br /&gt;
=====./copyall lists programs you have not patched=====&lt;br /&gt;
Use exodus/service/copyone to copy only your patched programs one by one. (./copyone will not copy dat files)&lt;br /&gt;
&lt;br /&gt;
===Upgrading to new version===&lt;br /&gt;
&lt;br /&gt;
READ: remember there is no test version of libexodus programs. This means that if libexodus programs are compiled and installed, neosys/src and exodus/services LIVE programs MUST BE UPGRADED.&lt;br /&gt;
&lt;br /&gt;
#Upgrade test system to test&lt;br /&gt;
##If a dev system like de2, git stash any uncommitted changes other staff may be working on.&lt;br /&gt;
##Run &amp;quot;g&amp;quot; in ~/exodus (to do git pull --ff-only)&lt;br /&gt;
##Run &amp;quot;m&amp;quot; in ~/exodus (to compile and install libexodus)&lt;br /&gt;
##Run &amp;quot;~/neosys/upgrade.all.sh live&amp;quot; in ~/neosys (to upgrade exodus/service and neosys/src live programs)&lt;br /&gt;
##Begin testing&lt;br /&gt;
#Upgrade clients&lt;br /&gt;
##*Client hosted - Schedule a planned upgrade with client.&lt;br /&gt;
##*NEOSYS hosted - Inform all clients/users of planned morning upgrade, 24hours in advanced.      (TODO: &#039;What&#039;s New in NEOSYS&#039;) AND (emailallusers.cpp)&lt;br /&gt;
##Day of upgrade, check USB backup was successful &amp;amp; make a container snapshot, otherwise do not proceed.&lt;br /&gt;
##Stop services&lt;br /&gt;
##Run &amp;quot;g&amp;quot; in ~/exodus (to do git pull --ff-only)&lt;br /&gt;
##Run &amp;quot;m&amp;quot; in ~/exodus (to compile and install libexodus)&lt;br /&gt;
##Run &amp;quot;~/neosys/upgrade.all.sh live&amp;quot;. &lt;br /&gt;
##Check services started automatically without issues.&lt;br /&gt;
#Inform users their system has been upgraded and they can login.&lt;br /&gt;
&lt;br /&gt;
===Roll Back Upgrade===&lt;br /&gt;
&lt;br /&gt;
If for any reason the entire upgrade needs to be reverted (excludes clients database), follow steps below:&lt;br /&gt;
&lt;br /&gt;
#Inform users that there is a problem and services need to be stopped.&lt;br /&gt;
#Stop all exodus processes.&lt;br /&gt;
#Restore the morning&#039;s USB backup by: (Note this backup contains:  source/obj code, /etc, neosys scripts but not client data)&lt;br /&gt;
##Login into container&#039;s host and rsync the morning&#039;s usb backup to the container&#039;s /:&lt;br /&gt;
#*&amp;lt;pre&amp;gt;rsync --dry-run -avz -e &#039;ssh -p &amp;lt;C_SSHPORT&amp;gt;&#039; /backups/usb/&amp;lt;C_CODE&amp;gt; &amp;lt;C_CODE&amp;gt;:/      (Example: rsync --dry-run -avz -e &#039;ssh -p 19582&#039; /backups/usb/ad1 ad1:/&amp;lt;/pre&amp;gt;)&lt;br /&gt;
#Quick sane check, the latest git commit is not the latest git commit in the remote repo.&lt;br /&gt;
#Inform users they can login.&lt;br /&gt;
&lt;br /&gt;
==Configuring services to autostart during login==&lt;br /&gt;
For PTCY,&lt;br /&gt;
&lt;br /&gt;
#Create a file &#039;autostart.cfg&#039; in the data folder &lt;br /&gt;
&lt;br /&gt;
 touch /root/hosts/&amp;lt;dbname&amp;gt;/data/autostart.cfg&lt;br /&gt;
&lt;br /&gt;
This will autostart a database service as long as at least one database service in that directory is running.&lt;br /&gt;
&lt;br /&gt;
For example, demo service will autostart during login if,&lt;br /&gt;
#/root/hosts/demo/data/autostart.cfg exists and&lt;br /&gt;
#demo_test service is running&lt;br /&gt;
&lt;br /&gt;
==Speedup postgresql importing databases==&lt;br /&gt;
&lt;br /&gt;
Can be sped up by a factor of 10 BUT may result in corrupt files in case of hard OS crash where the dirty memory is not flushed to storage.&lt;br /&gt;
&lt;br /&gt;
Therefore it is advisable to use this feature only briefly and REMEMBER TO REMOVE IT! &lt;br /&gt;
&lt;br /&gt;
Email to support@neosys.com whenever using it or use personal notes not memory.&lt;br /&gt;
&lt;br /&gt;
nano /etc/postgresql/12/main/postgresql.conf&lt;br /&gt;
&lt;br /&gt;
Uncomment or add a line&lt;br /&gt;
 fsync = off&lt;br /&gt;
Restart postgres … will break any neosys/exodus running processes.&lt;br /&gt;
 r postgresql&lt;br /&gt;
or reload postgres may also work&lt;br /&gt;
&lt;br /&gt;
==Database Attach==&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
root@exodus:~/exodus/cli/src# dbattach&lt;br /&gt;
dbattach - Attach foreign database files to the current default database&lt;br /&gt;
&lt;br /&gt;
Syntax is dbattach TARGETDB [FILENAME,...] {OPTION...}&lt;br /&gt;
&lt;br /&gt;
Options:&lt;br /&gt;
&lt;br /&gt;
  F   Forcibly delete any normal files in the current default database.&lt;br /&gt;
&lt;br /&gt;
  R   Detach foreign files&lt;br /&gt;
  RR  Remove foreign database connection.&lt;br /&gt;
  RRR Remove all foreign database connections and attachments.&lt;br /&gt;
&lt;br /&gt;
  L   List attached foreign files in the current default database&lt;br /&gt;
&lt;br /&gt;
If no filenames are provided then a database connection is created.&lt;br /&gt;
This is *required* before filenames can be provided and attached.&lt;br /&gt;
&lt;br /&gt;
Notes:&lt;br /&gt;
&lt;br /&gt;
Attachments are permanent until re-attached or removed.&lt;br /&gt;
&lt;br /&gt;
Indexes on attached files behave strangely.&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Issues:&lt;br /&gt;
&lt;br /&gt;
TARGETDB must be on the same connection as the current default database.&lt;br /&gt;
&lt;br /&gt;
Current user must have access to the foreign database.&lt;br /&gt;
&lt;br /&gt;
If EXO_USER and EXO_PASS are not set then exodus defaults are used.&lt;br /&gt;
&lt;br /&gt;
exodus .config file is not used currently.&lt;/div&gt;</summary>
		<author><name>Gregory</name></author>
	</entry>
	<entry>
		<id>https://techwiki.neosys.com/index.php?title=EXODUS_Knowledge&amp;diff=4081</id>
		<title>EXODUS Knowledge</title>
		<link rel="alternate" type="text/html" href="https://techwiki.neosys.com/index.php?title=EXODUS_Knowledge&amp;diff=4081"/>
		<updated>2025-12-12T07:45:01Z</updated>

		<summary type="html">&lt;p&gt;Gregory: /* To inspect a “common” variable */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==TMUX Screens==&lt;br /&gt;
&lt;br /&gt;
To create the EXODUS maintenance/programming environment&lt;br /&gt;
 exodus#: ./tmux.exodus&lt;br /&gt;
&lt;br /&gt;
===Screens===&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
0: /&lt;br /&gt;
    General work for server services/configs. i.e /etc/nagios, /etc/apache2, /var/log/mail.log or general networking.&lt;br /&gt;
&lt;br /&gt;
1: /root/exodus/&lt;br /&gt;
    Exodus core is installed. Contains build and make libraries here ./libexodus&lt;br /&gt;
&lt;br /&gt;
2: /root/exodus/libexodus/exodus&lt;br /&gt;
    Core exodus library source code which emulate the AREV system e.g var.cpp&lt;br /&gt;
    &lt;br /&gt;
3: /root/exodus/cli/src&lt;br /&gt;
    Exodus Command Line Interface E.g edir, edic, list, listfiles, delete, createdb, deletedb.&lt;br /&gt;
    &lt;br /&gt;
4: root/exodus/service&lt;br /&gt;
    EXODUS core default host directory but also contains scripts that create/manage requirements of a service (create_service, create_db, create_site, backup_db, restore_db, start, stop, status)&lt;br /&gt;
    The www/3/exodus has generic .htm, php and .js which provide basic website functionality i.e Login page, Support Menu, User details, Authorization.&lt;br /&gt;
    NEOSYS www files linked into ./www, from /root/neosys/web, which pulled from NEOSYS www git.&lt;br /&gt;
&lt;br /&gt;
5: /root/exodus/service/src&lt;br /&gt;
    Exodus core service programs (programs that are not related to NEOSYS agency operations and can be used to support other non-NEOSYS services) eg listen, usersubs, sendmail, openfile, select, sort, list,.&lt;br /&gt;
&lt;br /&gt;
    Extra info:    &lt;br /&gt;
    The dat/ has generic dictionary files. (See Section Dictionaries &amp;amp; Psql Functions)&lt;br /&gt;
    TODO: compall currently throws few warnings. Read them and familiarise. In case new warnings appear, notify Steve.    &lt;br /&gt;
        &lt;br /&gt;
6: /root/neosys&lt;br /&gt;
    NEOSYS specific client installation &amp;amp; management scripts e.g .doall, import_db and import_files (from AREV), ./run ./test (see below for these two commands)&lt;br /&gt;
    &lt;br /&gt;
7: /root/neosys/src&lt;br /&gt;
    NEOSYS Agency programs (see section How AREV programs are distributed in EXODUS src/*.cpp&lt;br /&gt;
    /root/neosys has the neosys .git&lt;br /&gt;
&lt;br /&gt;
8: /root/hosts&lt;br /&gt;
    client specific files  e.g logs, images, (shared ./www -&amp;gt; root/exodus/service/www&lt;br /&gt;
&lt;br /&gt;
9: /root/exodus/test/src&lt;br /&gt;
    series of programs that test whether subroutines (specifically Exodus core libraries) work as they should eg for the var lib - &amp;quot;assert( var(&amp;quot;11111&amp;quot;).isnum());&amp;quot;&lt;br /&gt;
&lt;br /&gt;
10: bash /bin/top&lt;br /&gt;
    Monitor for NEOSYS client processes&lt;br /&gt;
    Displays customised format: sorted by total time spend and by processor time.&lt;br /&gt;
     Press &amp;quot;=&amp;quot; : to change to standard top format&lt;br /&gt;
     Press shift + w : to save format settings, replacing the old customised top format&lt;br /&gt;
     To go back to the customised format do:&lt;br /&gt;
        Press &amp;quot;o&amp;quot;&lt;br /&gt;
        Type &amp;quot;COMMAND=serve_agy&amp;quot;&lt;br /&gt;
        shift + t : this sorts by total time spent&lt;br /&gt;
        shift + p : this sorts by processor time&lt;br /&gt;
        shift + w : to save this setting and enter  &#039;y&#039; to confirm&lt;br /&gt;
&lt;br /&gt;
11: /var/log/syslog&lt;br /&gt;
     Log of NEOSYS client requests&lt;br /&gt;
&lt;br /&gt;
12: /root/exodus/service/quick&lt;br /&gt;
     Displays the last time the svr file (in /root/hosts/&amp;lt;client&amp;gt;/data/&amp;lt;dbname&amp;gt;) was updated.&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Object Code/Libraries==&lt;br /&gt;
LIVE and TEST processes use different sets of object code.&lt;br /&gt;
TEST processes use libraries in ~/lib/, whereas LIVE processes use object code in ~/neo/lib&lt;br /&gt;
&lt;br /&gt;
This means development &amp;amp; testing can be done stress free on TEST database, as opposed to testing on production databases.&lt;br /&gt;
&lt;br /&gt;
When compiling using edic, the TEST object code is updated if the compilation is successful. (~/lib)&lt;br /&gt;
&lt;br /&gt;
==Dictionaries &amp;amp; Psql Functions==&lt;br /&gt;
&lt;br /&gt;
Dictionaries - data used to describe other data; specifically the fields of other files. &lt;br /&gt;
&lt;br /&gt;
There are three types of fields: &amp;lt;pre&amp;gt;&lt;br /&gt;
(F) Field for raw data E.g &amp;quot;Office 44 Building Rush&amp;quot;&lt;br /&gt;
(S) Symbolic or calculated E.g for total ans=field1+field2&lt;br /&gt;
(G) General or Group E.g &amp;quot;@CRT&amp;quot; which contains always contains the default columns to show on the output of the list program; if no columns provided in list command.&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Show dictionary using &amp;quot;EXO_DATA=test list dict.clients&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
===Development and deployment using &#039;dat&#039; files===&lt;br /&gt;
&lt;br /&gt;
====Rationale====&lt;br /&gt;
&lt;br /&gt;
Part of system development is the creation of various data that is neither programs nor layout i.e. not cpp, h, html, js, php files etc.&lt;br /&gt;
&lt;br /&gt;
For example:&lt;br /&gt;
&lt;br /&gt;
*Dictionaries are data about data.&lt;br /&gt;
*Language files are data about text to use for various languages.&lt;br /&gt;
*“Change logs” are data about changes in the system.&lt;br /&gt;
&lt;br /&gt;
Historically, in EXODUS and NEOSYS, the above data has been deployed in exodus database files using SQL text files. However SQL files are not convenient for development.&lt;br /&gt;
&lt;br /&gt;
Therefore, &#039;dat&#039; text files will be used now so that standard development tools including editors and git can be fully exploited.&lt;br /&gt;
&lt;br /&gt;
====&#039;dat&#039; files====&lt;br /&gt;
&lt;br /&gt;
Each database file is represented by an os directory of the same name.&lt;br /&gt;
&lt;br /&gt;
Each record in the database file is represented by an os text file where filename is the primary key.&lt;br /&gt;
&lt;br /&gt;
For example a record with key &#039;&#039;&#039;DEADLINE&#039;&#039;&#039; in a dat file &#039;&#039;&#039;dict.materials&#039;&#039;&#039; would be represented as an os text file &#039;&#039;&#039;dat/dict.materials/DEADLINE&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Each line in the os text file represents one field in the db record. In other words, db record FM characters are represented by new line characters in &#039;dat&#039; files. Any actual new line characters required in the record, and any backslashes, are escaped and appear as &#039;\n&#039; and &#039;\\&#039; in &#039;dat&#039; files. Other database field separator characters such as VM, SM, TM and STM are stored without any conversion.&lt;br /&gt;
&lt;br /&gt;
====Location of dat files====&lt;br /&gt;
&lt;br /&gt;
The development versions are stored in exodus and neosys src/dat dirs. They form part of the standard git repositories in parallel with cpp files.&lt;br /&gt;
&lt;br /&gt;
The operational versions are stored in ~/dat and ~/live/dat alongside bin and lib dirs and are automatically installed into databases as database files on service startup. Any database functions embedded in the text files (pgsql) are also automatically installed at the same time.&lt;br /&gt;
&lt;br /&gt;
===Delete Database dictionary file===&lt;br /&gt;
&lt;br /&gt;
cli syncdat deletes database files if the dat dir is empty or contains a file &#039;SYNCDAT_DELETE&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
touch neosys/src/dat/dict.users/SYNC_DELETE&lt;br /&gt;
neosys/src~: syncdat&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====Editing and deploying a &#039;dat&#039; file====&lt;br /&gt;
&lt;br /&gt;
It is currently a three step process to edit and deploy such &#039;dat&#039; files. &lt;br /&gt;
&lt;br /&gt;
=====Edit the &#039;dat&#039; file (i.e dict.file record)=====&lt;br /&gt;
&lt;br /&gt;
Note that EXODUS service and NEOSYS service have different src/dat folders.&lt;br /&gt;
&lt;br /&gt;
Editing language items:&lt;br /&gt;
&lt;br /&gt;
 edir dat/alanguage/SCHEDULES*ARABIC&lt;br /&gt;
&lt;br /&gt;
Editing a dictionary item:&lt;br /&gt;
&lt;br /&gt;
 edir dat/dict.materials/DEADLINE&lt;br /&gt;
&lt;br /&gt;
Editing a pgsql function in a dictionary:&lt;br /&gt;
&lt;br /&gt;
 edir dat/dict.materials/DEADLINE 8&lt;br /&gt;
&lt;br /&gt;
=====Copy all &#039;dat&#039; files to ~/dat =====&lt;br /&gt;
&lt;br /&gt;
This step might be removed at a later date.&lt;br /&gt;
&lt;br /&gt;
This will cause all test databases to immediately restart and load any &#039;dat&#039; file changes into dictionaries and data files and also create any new or modified pgsql functions.&lt;br /&gt;
&lt;br /&gt;
If any ~/neosys/src/dat files were edited:&lt;br /&gt;
&lt;br /&gt;
 cd ~/neosys/src&lt;br /&gt;
 &lt;br /&gt;
 ./compall dat&lt;br /&gt;
&lt;br /&gt;
and/or, if exodus/service/dat files were edited&lt;br /&gt;
&lt;br /&gt;
 cd ~/exodus/service/src&lt;br /&gt;
 &lt;br /&gt;
 ./compall dat&lt;br /&gt;
&lt;br /&gt;
=====Copy all programs and &#039;dat&#039; files to ~/live/bin|lib|dat=====&lt;br /&gt;
&lt;br /&gt;
This should only be run after testing. It will cause all live databases to automatically restart and do the same as the test databases mentioned above.&lt;br /&gt;
&lt;br /&gt;
 cd ~/exodus/service&lt;br /&gt;
 &lt;br /&gt;
 ./copyall CONFIRM&lt;br /&gt;
&lt;br /&gt;
=====Delete dat record =====&lt;br /&gt;
&lt;br /&gt;
Simply open the corresponding dat file, remove all lines and save.&lt;br /&gt;
&lt;br /&gt;
===Psql unaccent extension===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The unaccent extension and the immutable_unaccent function are created in the db ‘template1’ during exodus installation while user is postgres which is a superuser.&lt;br /&gt;
&lt;br /&gt;
Thereafter all new databases are created as copies of template1 so they contain the extension and function&lt;br /&gt;
&lt;br /&gt;
====Error====&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
MVDBException:ERROR: function immutable_unaccent(text) does not exist&lt;br /&gt;
ERROR:  permission denied to create extension &amp;quot;unaccent&amp;quot;&lt;br /&gt;
HINT:  Must be superuser to create this extension. &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====Solution====&lt;br /&gt;
sudo -u postgres psql -c &#039;ALTER USER exodus WITH SUPERUSER;&#039;&lt;br /&gt;
&lt;br /&gt;
==Processes==&lt;br /&gt;
The TEST process for all database use the same object code stored in /root/lib, whereas all LIVE process use the object code in /root/neo/.&lt;br /&gt;
&lt;br /&gt;
==Postgres==&lt;br /&gt;
Connect into postgres shell:&lt;br /&gt;
 alias psql=&#039;sudo -u postgres psql&#039;&lt;br /&gt;
&lt;br /&gt;
Delete a database:&lt;br /&gt;
 sudo -u postgres dropdb &amp;lt;dbcode&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Debugging Exodus==&lt;br /&gt;
&lt;br /&gt;
===Debugging Live/Test services===&lt;br /&gt;
&lt;br /&gt;
./test &amp;lt;dbname&amp;gt; - execute test programs on _test database.&lt;br /&gt;
&lt;br /&gt;
./run &amp;lt;dbname&amp;gt;  - execute test programs on live database.&lt;br /&gt;
&lt;br /&gt;
===Debugging var values===&lt;br /&gt;
&lt;br /&gt;
Explanation of var flag value in gdb debug mode.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
(gdb) p varx                                                           &lt;br /&gt;
$2 = {var_str = &amp;quot;&amp;quot;, var_int = 0, var_dbl = 0, var_typ = {flags_ = 2}}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Each exodus var object contains 4 variables of type std::string (var_str), int (var_int), long double (var_dbl) and another int (var_typ i.e flags).&lt;br /&gt;
&lt;br /&gt;
The first 3 bits of var_typ (flags_) are used to signify which of the other variables are assigned.&lt;br /&gt;
&lt;br /&gt;
First bit = string is un/assigned. Second bit = int is un/assigned. Third bit = double un/assigned (a combination of these bits describes whether var_str/ var_int/ var_dbl are assigned.&lt;br /&gt;
&lt;br /&gt;
Examples: &lt;br /&gt;
&lt;br /&gt;
000 (binary) =  0 (decimal) = non are assigned.&lt;br /&gt;
&lt;br /&gt;
100 (binary) =  1 (decimal) = var_str is assigned. (var_int &amp;amp; var_dbl are not)&lt;br /&gt;
&lt;br /&gt;
010 (binary) =  2 (decimal) = var_int is assigned. (var_str &amp;amp; var_dbl are not)&lt;br /&gt;
&lt;br /&gt;
001 (binary) =  4 (decimal) = var_dbl is assigned. (var_str var_int are not)&lt;br /&gt;
&lt;br /&gt;
Combinations:&lt;br /&gt;
&lt;br /&gt;
110 (binary) =  3 (decimal) = var_str &amp;amp; var_int are assigned. (var_dbl is not)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
====To inspect a “common” variable====&lt;br /&gt;
&lt;br /&gt;
e.g. a variable called ba.ledgern&lt;br /&gt;
&lt;br /&gt;
 p ba.ledgern&lt;br /&gt;
&lt;br /&gt;
OLD METHOD:&lt;br /&gt;
&lt;br /&gt;
 p ((subExodusProgram::&amp;lt;b&amp;gt;ba&amp;lt;/b&amp;gt;_common)&amp;lt;b&amp;gt;ba&amp;lt;/b&amp;gt;).&amp;lt;b&amp;gt;ledgern&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====To inspect a common block====&lt;br /&gt;
&lt;br /&gt;
e.g. a common block ba&lt;br /&gt;
&lt;br /&gt;
 ptype (subExodusProgram::ba_common)ba&lt;br /&gt;
&lt;br /&gt;
====To dump all variables in a common====&lt;br /&gt;
&lt;br /&gt;
e.g all variables in ba&lt;br /&gt;
&lt;br /&gt;
 p (subExodusProgram::ba_common)ba&lt;br /&gt;
&lt;br /&gt;
====What types are available in a program?====&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;info types common&lt;br /&gt;
info types subExodus&lt;br /&gt;
info types libexodus&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====Other commands====&lt;br /&gt;
&lt;br /&gt;
 explore subExodusProgram::ba_common&lt;br /&gt;
&lt;br /&gt;
===Process Hung or consuming +100% CPU===&lt;br /&gt;
If process is consuming +100% CPU then it is likely stuck in an infinite loop.&lt;br /&gt;
&lt;br /&gt;
 ./doall &amp;lt;CLIENT&amp;gt; stop&lt;br /&gt;
&lt;br /&gt;
 ./run &amp;lt;CLIENT&amp;gt; &lt;br /&gt;
&lt;br /&gt;
 ./test &amp;lt;CLIENT&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Search through recent logs for &amp;lt;CLIENT&amp;gt; looking for requests that didn&#039;t return OK at the time nagios alerted of Hung process.&lt;br /&gt;
&lt;br /&gt;
A user may also instigate the error again, so monitor the CLIENT&#039;s service CPU usage.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
If cause found recreate it in test and once test process hit +100% break in test debugger.&lt;br /&gt;
&lt;br /&gt;
If cause not found, you will have to continue checking logs for the request that caused it or hope a user recreates the issue in live debugged service.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Once you&#039;ve broken in the debugged with the error, enter &amp;quot;n&amp;quot; and hold the enter key until you just seeing line repeat.&lt;br /&gt;
&lt;br /&gt;
Pay attention to start of loops code. E.g WHILE or FOR. (there is likely an error is there)&lt;br /&gt;
&lt;br /&gt;
==./doall==&lt;br /&gt;
====General====&lt;br /&gt;
&lt;br /&gt;
~/neosys/doall [LIVE|TEST] &amp;lt;DBCODE|ALL&amp;gt; &amp;lt; ACTION [OPTIONS,..]  | bash -- COMMAND ]&lt;br /&gt;
&lt;br /&gt;
Example: &lt;br /&gt;
 ./doall TEST ALL create_site t-&lt;br /&gt;
Result:&lt;br /&gt;
Create site for ALL TEST databases, using domain name prefix option &amp;quot;t-&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Screen 6: ./doall script contains all the necessary information(codes) to setup an installation.&lt;br /&gt;
It includes scripts to backup, restore, create an Apache site, create/start/stop/status a service, import an AREV database into postgres and more.&lt;br /&gt;
&lt;br /&gt;
====backup_db====&lt;br /&gt;
&lt;br /&gt;
*Does a backup &amp;amp; restore of a LIVE database into the corresponding TEST database.&lt;br /&gt;
*Backup &amp;lt;dbcode&amp;gt;.sql file is written to /root/backups/sql; which is rsynced to nl19:/backups/current/exodus/&lt;br /&gt;
*Unlike AREV, postgres can perform a &amp;quot;backup&amp;quot; of a database whilst the system is in use.&lt;br /&gt;
&lt;br /&gt;
==Git==&lt;br /&gt;
&lt;br /&gt;
There are two repositories, one for EXODUS and the other for NEOSYS.&lt;br /&gt;
&lt;br /&gt;
===Using git to make changes===&lt;br /&gt;
&lt;br /&gt;
Before following steps you must have a tested updated to a program/file/script. Do not commit untested changes to avoid a messy git history of reverts.&lt;br /&gt;
&lt;br /&gt;
Update your local repo before committing to local repo using the g alias for &amp;quot;git pull --ff-only ; git push &amp;amp;&amp;amp; git status&#039;&amp;quot;:&lt;br /&gt;
&amp;lt;pre&amp;gt;g&amp;lt;/pre&amp;gt;&lt;br /&gt;
Check which updates/files have not yet been staged and/or committed:&lt;br /&gt;
Add your updates to the staged area:&lt;br /&gt;
&amp;lt;pre&amp;gt;git add &amp;lt;filename&amp;gt;&amp;lt;/pre&amp;gt;&lt;br /&gt;
or if all the changes made need to be staged:&lt;br /&gt;
&amp;lt;pre&amp;gt;git add -a&amp;lt;/pre&amp;gt;&lt;br /&gt;
Make a commit with a descriptive message on purpose of updates:&lt;br /&gt;
&amp;lt;pre&amp;gt;git commit -m &amp;lt;description n purpose of changes&amp;gt;&amp;lt;/pre&amp;gt;&lt;br /&gt;
Again use g alias:&lt;br /&gt;
&amp;lt;pre&amp;gt;g&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Other useful git cmds===&lt;br /&gt;
&lt;br /&gt;
Do not use this commands unless you know what WILL happen. &lt;br /&gt;
*git pull - Instead use the safe &amp;quot;git pull --ff-only&amp;quot;&lt;br /&gt;
Stick to the alias &amp;quot;g&amp;quot; which does &amp;quot;git pull --ff-only ; git push &amp;amp;&amp;amp; git status&#039;&amp;quot;&lt;br /&gt;
&lt;br /&gt;
*git log - display history of commits to master branch&lt;br /&gt;
*git diff - display the differences in files between working files and files in local repo.&lt;br /&gt;
*git status - display: which updated files are staged/not staged(tracked)&lt;br /&gt;
*git stash - &lt;br /&gt;
*git branch - switch to a new branch&lt;br /&gt;
*git branch &amp;lt;branchname&amp;gt; - will switch to this branch only if it exists&lt;br /&gt;
*git checkout - DESTROYS/Updates the state of local working directory with the state of the files in the local repo. (YOU WILL LOSE non staged updates)&lt;br /&gt;
*git restore &amp;lt;filename&amp;gt; - DESTROYS/Updates the file with the version in the local repo. (like with git checkout but for a specific file)&lt;br /&gt;
*git checkin - &lt;br /&gt;
*git revert &amp;lt;commitHash&amp;gt; - reverses a specific commit (use git log to get the chosen commit hash)&lt;br /&gt;
*git ..&lt;br /&gt;
&lt;br /&gt;
==Converting AREV programs to EXODUS==&lt;br /&gt;
===Decompile AREV to C++===&lt;br /&gt;
&lt;br /&gt;
Do in Master AREV Installation Maintenance mode: (win7)&lt;br /&gt;
&lt;br /&gt;
#ATTACH ADECOMC &lt;br /&gt;
#*ADECOM &amp;lt;programname&amp;gt;   *single program&lt;br /&gt;
#*ADECOM &amp;lt;prog1&amp;gt; &amp;lt;prog2&amp;gt; &lt;br /&gt;
#*ADECOMALL              *all programs   (CHECK FIRST)&lt;br /&gt;
&lt;br /&gt;
Include the option &amp;quot;(V)&amp;quot; in the command to print the C++ to a notepad, which can easily be copy and pasted.&lt;br /&gt;
&lt;br /&gt;
===Getting C++ program to Exodus Installation===&lt;br /&gt;
&lt;br /&gt;
Two methods: (use the first for one off programs)&lt;br /&gt;
&lt;br /&gt;
====Copy &amp;amp; Paste====&lt;br /&gt;
&lt;br /&gt;
Compile program and open source code in notepad&lt;br /&gt;
&lt;br /&gt;
 ADECOM &amp;lt;programname&amp;gt; (V)&lt;br /&gt;
&lt;br /&gt;
Find which directory the program belongs. e.g fin/med/job/sys e.t&lt;br /&gt;
&lt;br /&gt;
 find /cygdrive/d/exodus/pickos | grep &amp;lt;program name&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If cpp in SYS, the program belongs in ~/exodus/service/src OR if in MED JOB FIN GEN AGY the program belongs in ~/neosys/src&lt;br /&gt;
&lt;br /&gt;
Copy the source code in the text file from the first command.&lt;br /&gt;
&lt;br /&gt;
In Exodus, create a new .cpp (in correct directory) and paste the source code.&lt;br /&gt;
&lt;br /&gt;
Compile &amp;amp; Test&lt;br /&gt;
&lt;br /&gt;
====Rsync====&lt;br /&gt;
&lt;br /&gt;
 /d/exodus/arev/syncup.sh&lt;br /&gt;
&lt;br /&gt;
If cpp in SYS then: ~/exodus/service/src ./getpickos&lt;br /&gt;
&lt;br /&gt;
If cpp in MED JOB FIN GEN AGY then: *~/neosys/src&lt;br /&gt;
&lt;br /&gt;
===Compile C++ files to TEST system===&lt;br /&gt;
&lt;br /&gt;
#*./test &amp;lt;DBNAME&amp;gt;&lt;br /&gt;
#*~/neosys ./doall TEST &amp;lt;DBNAME&amp;gt; restart    #to get one service to start start using the new lib files&lt;br /&gt;
#*~/neosys ./doall TEST all restart         #to get all the services to start start using the new lib files&lt;br /&gt;
&lt;br /&gt;
===Install C++ files to LIVE System===&lt;br /&gt;
&lt;br /&gt;
#~/exodus/service/ ./copyall            #to copy all the ~/lib and bin files to ~/live/lib and bin ... which is used by all exodus/live services&lt;br /&gt;
&lt;br /&gt;
==Writing Standard Exodus Core Function/Method Testing==&lt;br /&gt;
Screen 9: ~/exodus/test/src/&lt;br /&gt;
There are a series of test programs that check whether methods/functions behave as intended.&lt;br /&gt;
They do this using the function, assert.. a 1 or more argument values produce one and only one output)&lt;br /&gt;
&lt;br /&gt;
e.g test_multilang.cpp or test_sort.cpp&lt;br /&gt;
&lt;br /&gt;
Two methods of running test programs:&lt;br /&gt;
*Screen 9: make test&lt;br /&gt;
*after compiling using edic/compile/c, enter test_prog_name. (Since compile has moved it to ~/bin)&lt;br /&gt;
&lt;br /&gt;
Difference between the two methods is make calls gdb directly;&lt;br /&gt;
whereas ~/bin/test_prog_name uses exodus compile program&lt;br /&gt;
#~/neosys ./doall LIVE all restart&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Upgrading Exodus==&lt;br /&gt;
&lt;br /&gt;
#Develop patch in Dev system &lt;br /&gt;
&lt;br /&gt;
===Patching neosys/src or exodus/service/src===&lt;br /&gt;
&lt;br /&gt;
#Manually insert patches and compile into test programs.&lt;br /&gt;
#If patch dat files then run neosys/compall to get dat files into ~/dat&lt;br /&gt;
*If Patsalides:&lt;br /&gt;
*#SITE_DIR=ptcy ./test basic &lt;br /&gt;
*#login to BASIC_TEST and test&lt;br /&gt;
*Other clients:&lt;br /&gt;
*#./test DBCODE&lt;br /&gt;
*#login to DBCODE and test patches works&lt;br /&gt;
#run exodus/service/copyall and check only the patched programs are listed. (if not, see Troubleshoot below)&lt;br /&gt;
#Inform users to log off for 10mins. As a rule of thumb, live services must be stopped before copying test programs to live.&lt;br /&gt;
#exodus/service/copyall CONFIRM&lt;br /&gt;
&lt;br /&gt;
====Troubleshoot====&lt;br /&gt;
&lt;br /&gt;
=====./copyall lists programs you have not patched=====&lt;br /&gt;
Use exodus/service/copyone to copy only your patched programs one by one. (./copyone will not copy dat files)&lt;br /&gt;
&lt;br /&gt;
===Upgrading to new version===&lt;br /&gt;
&lt;br /&gt;
READ: remember there is no test version of libexodus programs. This means that if libexodus programs are compiled and installed, neosys/src and exodus/services LIVE programs MUST BE UPGRADED.&lt;br /&gt;
&lt;br /&gt;
#Upgrade test system to test&lt;br /&gt;
##If a dev system like de2, git stash any uncommitted changes other staff may be working on.&lt;br /&gt;
##Run &amp;quot;g&amp;quot; in ~/exodus (to do git pull --ff-only)&lt;br /&gt;
##Run &amp;quot;m&amp;quot; in ~/exodus (to compile and install libexodus)&lt;br /&gt;
##Run &amp;quot;~/neosys/upgrade.all.sh live&amp;quot; in ~/neosys (to upgrade exodus/service and neosys/src live programs)&lt;br /&gt;
##Begin testing&lt;br /&gt;
#Upgrade clients&lt;br /&gt;
##*Client hosted - Schedule a planned upgrade with client.&lt;br /&gt;
##*NEOSYS hosted - Inform all clients/users of planned morning upgrade, 24hours in advanced.      (TODO: &#039;What&#039;s New in NEOSYS&#039;) AND (emailallusers.cpp)&lt;br /&gt;
##Day of upgrade, check USB backup was successful &amp;amp; make a container snapshot, otherwise do not proceed.&lt;br /&gt;
##Stop services&lt;br /&gt;
##Run &amp;quot;g&amp;quot; in ~/exodus (to do git pull --ff-only)&lt;br /&gt;
##Run &amp;quot;m&amp;quot; in ~/exodus (to compile and install libexodus)&lt;br /&gt;
##Run &amp;quot;~/neosys/upgrade.all.sh live&amp;quot;. &lt;br /&gt;
##Check services started automatically without issues.&lt;br /&gt;
#Inform users their system has been upgraded and they can login.&lt;br /&gt;
&lt;br /&gt;
===Roll Back Upgrade===&lt;br /&gt;
&lt;br /&gt;
If for any reason the entire upgrade needs to be reverted (excludes clients database), follow steps below:&lt;br /&gt;
&lt;br /&gt;
#Inform users that there is a problem and services need to be stopped.&lt;br /&gt;
#Stop all exodus processes.&lt;br /&gt;
#Restore the morning&#039;s USB backup by: (Note this backup contains:  source/obj code, /etc, neosys scripts but not client data)&lt;br /&gt;
##Login into container&#039;s host and rsync the morning&#039;s usb backup to the container&#039;s /:&lt;br /&gt;
#*&amp;lt;pre&amp;gt;rsync --dry-run -avz -e &#039;ssh -p &amp;lt;C_SSHPORT&amp;gt;&#039; /backups/usb/&amp;lt;C_CODE&amp;gt; &amp;lt;C_CODE&amp;gt;:/      (Example: rsync --dry-run -avz -e &#039;ssh -p 19582&#039; /backups/usb/ad1 ad1:/&amp;lt;/pre&amp;gt;)&lt;br /&gt;
#Quick sane check, the latest git commit is not the latest git commit in the remote repo.&lt;br /&gt;
#Inform users they can login.&lt;br /&gt;
&lt;br /&gt;
==Configuring services to autostart during login==&lt;br /&gt;
For PTCY,&lt;br /&gt;
&lt;br /&gt;
#Create a file &#039;autostart.cfg&#039; in the data folder &lt;br /&gt;
&lt;br /&gt;
 touch /root/hosts/&amp;lt;dbname&amp;gt;/data/autostart.cfg&lt;br /&gt;
&lt;br /&gt;
This will autostart a database service as long as at least one database service in that directory is running.&lt;br /&gt;
&lt;br /&gt;
For example, demo service will autostart during login if,&lt;br /&gt;
#/root/hosts/demo/data/autostart.cfg exists and&lt;br /&gt;
#demo_test service is running&lt;br /&gt;
&lt;br /&gt;
==Speedup postgresql importing databases==&lt;br /&gt;
&lt;br /&gt;
Can be sped up by a factor of 10 BUT may result in corrupt files in case of hard OS crash where the dirty memory is not flushed to storage.&lt;br /&gt;
&lt;br /&gt;
Therefore it is advisable to use this feature only briefly and REMEMBER TO REMOVE IT! &lt;br /&gt;
&lt;br /&gt;
Email to support@neosys.com whenever using it or use personal notes not memory.&lt;br /&gt;
&lt;br /&gt;
nano /etc/postgresql/12/main/postgresql.conf&lt;br /&gt;
&lt;br /&gt;
Uncomment or add a line&lt;br /&gt;
 fsync = off&lt;br /&gt;
Restart postgres … will break any neosys/exodus running processes.&lt;br /&gt;
 r postgresql&lt;br /&gt;
or reload postgres may also work&lt;br /&gt;
&lt;br /&gt;
==Database Attach==&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
root@exodus:~/exodus/cli/src# dbattach&lt;br /&gt;
dbattach - Attach foreign database files to the current default database&lt;br /&gt;
&lt;br /&gt;
Syntax is dbattach TARGETDB [FILENAME,...] {OPTION...}&lt;br /&gt;
&lt;br /&gt;
Options:&lt;br /&gt;
&lt;br /&gt;
  F   Forcibly delete any normal files in the current default database.&lt;br /&gt;
&lt;br /&gt;
  R   Detach foreign files&lt;br /&gt;
  RR  Remove foreign database connection.&lt;br /&gt;
  RRR Remove all foreign database connections and attachments.&lt;br /&gt;
&lt;br /&gt;
  L   List attached foreign files in the current default database&lt;br /&gt;
&lt;br /&gt;
If no filenames are provided then a database connection is created.&lt;br /&gt;
This is *required* before filenames can be provided and attached.&lt;br /&gt;
&lt;br /&gt;
Notes:&lt;br /&gt;
&lt;br /&gt;
Attachments are permanent until re-attached or removed.&lt;br /&gt;
&lt;br /&gt;
Indexes on attached files behave strangely.&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Issues:&lt;br /&gt;
&lt;br /&gt;
TARGETDB must be on the same connection as the current default database.&lt;br /&gt;
&lt;br /&gt;
Current user must have access to the foreign database.&lt;br /&gt;
&lt;br /&gt;
If EXO_USER and EXO_PASS are not set then exodus defaults are used.&lt;br /&gt;
&lt;br /&gt;
exodus .config file is not used currently.&lt;/div&gt;</summary>
		<author><name>Gregory</name></author>
	</entry>
	<entry>
		<id>https://techwiki.neosys.com/index.php?title=New_Employee_Training_Checklist&amp;diff=4069</id>
		<title>New Employee Training Checklist</title>
		<link rel="alternate" type="text/html" href="https://techwiki.neosys.com/index.php?title=New_Employee_Training_Checklist&amp;diff=4069"/>
		<updated>2025-08-06T07:48:34Z</updated>

		<summary type="html">&lt;p&gt;Gregory: /* Day 9 */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Day 1==&lt;br /&gt;
#Go through [[General_Office_Procedures|General Office Procedures]]&lt;br /&gt;
#Create a gmail account for your NEOSYS interactions e.g request for leave. Example firstname.neosys@gmail.com. Support Manager will share relevant google drive folders.&lt;br /&gt;
#To install and configure various software on Linux platform, see [http://itwiki.neosys.com/index.php/Setting_up_Ubuntu_on_NEOSYS_Support_Computers Setting up Ubuntu on NEOSYS Computers]&lt;br /&gt;
#[http://userwiki.neosys.com/index.php/Reset_Browser Reset browsers] and [http://userwiki.neosys.com/index.php/Disabling_Popup_Blocker disable pop-up blockers]&lt;br /&gt;
# Create an excel password file. The file name should be generic. Save with a password and share the password with your manager. Please refer link to create an appropriate password for the file ([[Procedures#Creating_and_Handling_passwords| Refer Handling passwords]]). The file should be placed under Support Staff folder in Nextcloud.&lt;br /&gt;
#Create signature in Thunderbird for all necessary accounts&lt;br /&gt;
#Mails are sent out in Calibri font with font size 11&lt;br /&gt;
#Create a file to store client info ( clients details) column names:- host name, company name, location of company, time zone, which server is the client&#039;s NEOSYS hosted on&lt;br /&gt;
#Configure your browsers according to [[Procedures#Configuring_Browsers_to_show_Javascript_errors_in_NEOSYS| Configuring Browsers to show Javascript errors]] and set it.neosys.com as Firefox home page&lt;br /&gt;
#Introduce nagios IT monitor&lt;br /&gt;
#Get NEOSYS IT to update Nagios monitoring workstations.cfg file and configure port-forwarding so that nagios can connect to the new employee&#039;s workstation&lt;br /&gt;
#Get a run down of client backup emails and updating backup spreadsheets.&lt;br /&gt;
#Create wiki ID and get NEOSYS IT to allow new users to receive wiki update emails.&lt;br /&gt;
&lt;br /&gt;
==Day 2 ==&lt;br /&gt;
#Check the clients file&lt;br /&gt;
#Explain backup procedure&lt;br /&gt;
#Show backup emails&lt;br /&gt;
#Share backup files &lt;br /&gt;
#Make the candidate do the morning backup-check routine.&lt;br /&gt;
#Explain different backup failures&lt;br /&gt;
#Train how to investigate a backup failure. Using backup email/nagios.&lt;br /&gt;
#Show template emails  in Thunderbird and Wiki. Focus on backup email templates.&lt;br /&gt;
#Go through wiki [[Procedures]]&lt;br /&gt;
#Introduction to NEOSYS frontend e.g login page&lt;br /&gt;
&lt;br /&gt;
==Day 3==&lt;br /&gt;
#Do backups for the day and update the backup spreadsheet&lt;br /&gt;
#Train on how to schedule downtime on nagios.&lt;br /&gt;
#Go through the various errors in Troubleshooting nagios http://techwiki.neosys.com/index.php/Handling_Nagios_Client_Monitoring_System&lt;br /&gt;
#Read IT wiki &amp;quot;Documenting NEOSYS systems&amp;quot;&lt;br /&gt;
&lt;br /&gt;
==Day 4==&lt;br /&gt;
#Handle possible backup and nagios issues of the morning/day and email clients if they need to be informed about those issues.&lt;br /&gt;
#Read [https://userwiki.neosys.com/index.php/Using_NEOSYS_Generally#Getting_started_with_NEOSYS| Getting started with NEOSYS]&lt;br /&gt;
#Explain Media Schedule (Client &amp;amp; Brand file, Supplier file, Vehicle file, Specification, material, dates, free ads, booking, certifying, invoicing)&lt;br /&gt;
&lt;br /&gt;
==Day 5==&lt;br /&gt;
#Practice Media module&lt;br /&gt;
#Creating various Client &amp;amp; Brand, Vehicle and Supplier files&lt;br /&gt;
#Test knowledge so far on using Schedules. Manager to create two assignments of booking, cancellation, rebooking, certify &amp;amp; invoicing.&lt;br /&gt;
&lt;br /&gt;
==Day 6==&lt;br /&gt;
#Quiz on Procedures, Nagios and Handling damaged files&lt;br /&gt;
&lt;br /&gt;
==Day 7==&lt;br /&gt;
#Explain Jobs Module (Job file, Estimate file, Purchase Order file, Job Type file)&lt;br /&gt;
#Practice Jobs Module&lt;br /&gt;
#Explain Authorisation file (locks and keys, user ID, various levels etc)&lt;br /&gt;
&lt;br /&gt;
==Day 8==&lt;br /&gt;
#Create simulated client server to learn about common scripts e.t&lt;br /&gt;
#Upgrade a client (how to handle patches before upgrade e.t)&lt;br /&gt;
#Explain DNS Zoneedit&lt;br /&gt;
&lt;br /&gt;
==Day 9==&lt;br /&gt;
#Replicating client issues&lt;br /&gt;
#Backup and Restoring NEOSYS&lt;br /&gt;
#Introduce nextcloud/IT procedures e.g migration principles &lt;br /&gt;
#System configuration file features and testing each field&lt;br /&gt;
&lt;br /&gt;
==Day 10==&lt;br /&gt;
#Request for a quick demo from the new staff&lt;/div&gt;</summary>
		<author><name>Gregory</name></author>
	</entry>
	<entry>
		<id>https://techwiki.neosys.com/index.php?title=New_Employee_Training_Checklist&amp;diff=4068</id>
		<title>New Employee Training Checklist</title>
		<link rel="alternate" type="text/html" href="https://techwiki.neosys.com/index.php?title=New_Employee_Training_Checklist&amp;diff=4068"/>
		<updated>2025-08-06T07:45:49Z</updated>

		<summary type="html">&lt;p&gt;Gregory: /* Day 8 */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Day 1==&lt;br /&gt;
#Go through [[General_Office_Procedures|General Office Procedures]]&lt;br /&gt;
#Create a gmail account for your NEOSYS interactions e.g request for leave. Example firstname.neosys@gmail.com. Support Manager will share relevant google drive folders.&lt;br /&gt;
#To install and configure various software on Linux platform, see [http://itwiki.neosys.com/index.php/Setting_up_Ubuntu_on_NEOSYS_Support_Computers Setting up Ubuntu on NEOSYS Computers]&lt;br /&gt;
#[http://userwiki.neosys.com/index.php/Reset_Browser Reset browsers] and [http://userwiki.neosys.com/index.php/Disabling_Popup_Blocker disable pop-up blockers]&lt;br /&gt;
# Create an excel password file. The file name should be generic. Save with a password and share the password with your manager. Please refer link to create an appropriate password for the file ([[Procedures#Creating_and_Handling_passwords| Refer Handling passwords]]). The file should be placed under Support Staff folder in Nextcloud.&lt;br /&gt;
#Create signature in Thunderbird for all necessary accounts&lt;br /&gt;
#Mails are sent out in Calibri font with font size 11&lt;br /&gt;
#Create a file to store client info ( clients details) column names:- host name, company name, location of company, time zone, which server is the client&#039;s NEOSYS hosted on&lt;br /&gt;
#Configure your browsers according to [[Procedures#Configuring_Browsers_to_show_Javascript_errors_in_NEOSYS| Configuring Browsers to show Javascript errors]] and set it.neosys.com as Firefox home page&lt;br /&gt;
#Introduce nagios IT monitor&lt;br /&gt;
#Get NEOSYS IT to update Nagios monitoring workstations.cfg file and configure port-forwarding so that nagios can connect to the new employee&#039;s workstation&lt;br /&gt;
#Get a run down of client backup emails and updating backup spreadsheets.&lt;br /&gt;
#Create wiki ID and get NEOSYS IT to allow new users to receive wiki update emails.&lt;br /&gt;
&lt;br /&gt;
==Day 2 ==&lt;br /&gt;
#Check the clients file&lt;br /&gt;
#Explain backup procedure&lt;br /&gt;
#Show backup emails&lt;br /&gt;
#Share backup files &lt;br /&gt;
#Make the candidate do the morning backup-check routine.&lt;br /&gt;
#Explain different backup failures&lt;br /&gt;
#Train how to investigate a backup failure. Using backup email/nagios.&lt;br /&gt;
#Show template emails  in Thunderbird and Wiki. Focus on backup email templates.&lt;br /&gt;
#Go through wiki [[Procedures]]&lt;br /&gt;
#Introduction to NEOSYS frontend e.g login page&lt;br /&gt;
&lt;br /&gt;
==Day 3==&lt;br /&gt;
#Do backups for the day and update the backup spreadsheet&lt;br /&gt;
#Train on how to schedule downtime on nagios.&lt;br /&gt;
#Go through the various errors in Troubleshooting nagios http://techwiki.neosys.com/index.php/Handling_Nagios_Client_Monitoring_System&lt;br /&gt;
#Read IT wiki &amp;quot;Documenting NEOSYS systems&amp;quot;&lt;br /&gt;
&lt;br /&gt;
==Day 4==&lt;br /&gt;
#Handle possible backup and nagios issues of the morning/day and email clients if they need to be informed about those issues.&lt;br /&gt;
#Read [https://userwiki.neosys.com/index.php/Using_NEOSYS_Generally#Getting_started_with_NEOSYS| Getting started with NEOSYS]&lt;br /&gt;
#Explain Media Schedule (Client &amp;amp; Brand file, Supplier file, Vehicle file, Specification, material, dates, free ads, booking, certifying, invoicing)&lt;br /&gt;
&lt;br /&gt;
==Day 5==&lt;br /&gt;
#Practice Media module&lt;br /&gt;
#Creating various Client &amp;amp; Brand, Vehicle and Supplier files&lt;br /&gt;
#Test knowledge so far on using Schedules. Manager to create two assignments of booking, cancellation, rebooking, certify &amp;amp; invoicing.&lt;br /&gt;
&lt;br /&gt;
==Day 6==&lt;br /&gt;
#Quiz on Procedures, Nagios and Handling damaged files&lt;br /&gt;
&lt;br /&gt;
==Day 7==&lt;br /&gt;
#Explain Jobs Module (Job file, Estimate file, Purchase Order file, Job Type file)&lt;br /&gt;
#Practice Jobs Module&lt;br /&gt;
#Explain Authorisation file (locks and keys, user ID, various levels etc)&lt;br /&gt;
&lt;br /&gt;
==Day 8==&lt;br /&gt;
#Create simulated client server to learn about common scripts e.t&lt;br /&gt;
#Upgrade a client (how to handle patches before upgrade e.t)&lt;br /&gt;
#Explain DNS Zoneedit&lt;br /&gt;
&lt;br /&gt;
==Day 9==&lt;br /&gt;
#Replicating client issues&lt;br /&gt;
#Backup and Restoring NEOSYS&lt;br /&gt;
#Moving NEOSYS to new server/location etc&lt;br /&gt;
#Consolidated Backup (Autologin.sh)&lt;br /&gt;
#System configuration file features and testing each field&lt;br /&gt;
&lt;br /&gt;
==Day 10==&lt;br /&gt;
#Request for a quick demo from the new staff&lt;/div&gt;</summary>
		<author><name>Gregory</name></author>
	</entry>
	<entry>
		<id>https://techwiki.neosys.com/index.php?title=New_Employee_Training_Checklist&amp;diff=4066</id>
		<title>New Employee Training Checklist</title>
		<link rel="alternate" type="text/html" href="https://techwiki.neosys.com/index.php?title=New_Employee_Training_Checklist&amp;diff=4066"/>
		<updated>2025-08-06T07:31:07Z</updated>

		<summary type="html">&lt;p&gt;Gregory: /* Day 6 */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Day 1==&lt;br /&gt;
#Go through [[General_Office_Procedures|General Office Procedures]]&lt;br /&gt;
#Create a gmail account for your NEOSYS interactions e.g request for leave. Example firstname.neosys@gmail.com. Support Manager will share relevant google drive folders.&lt;br /&gt;
#To install and configure various software on Linux platform, see [http://itwiki.neosys.com/index.php/Setting_up_Ubuntu_on_NEOSYS_Support_Computers Setting up Ubuntu on NEOSYS Computers]&lt;br /&gt;
#[http://userwiki.neosys.com/index.php/Reset_Browser Reset browsers] and [http://userwiki.neosys.com/index.php/Disabling_Popup_Blocker disable pop-up blockers]&lt;br /&gt;
# Create an excel password file. The file name should be generic. Save with a password and share the password with your manager. Please refer link to create an appropriate password for the file ([[Procedures#Creating_and_Handling_passwords| Refer Handling passwords]]). The file should be placed under Support Staff folder in Nextcloud.&lt;br /&gt;
#Create signature in Thunderbird for all necessary accounts&lt;br /&gt;
#Mails are sent out in Calibri font with font size 11&lt;br /&gt;
#Create a file to store client info ( clients details) column names:- host name, company name, location of company, time zone, which server is the client&#039;s NEOSYS hosted on&lt;br /&gt;
#Configure your browsers according to [[Procedures#Configuring_Browsers_to_show_Javascript_errors_in_NEOSYS| Configuring Browsers to show Javascript errors]] and set it.neosys.com as Firefox home page&lt;br /&gt;
#Introduce nagios IT monitor&lt;br /&gt;
#Get NEOSYS IT to update Nagios monitoring workstations.cfg file and configure port-forwarding so that nagios can connect to the new employee&#039;s workstation&lt;br /&gt;
#Get a run down of client backup emails and updating backup spreadsheets.&lt;br /&gt;
#Create wiki ID and get NEOSYS IT to allow new users to receive wiki update emails.&lt;br /&gt;
&lt;br /&gt;
==Day 2 ==&lt;br /&gt;
#Check the clients file&lt;br /&gt;
#Explain backup procedure&lt;br /&gt;
#Show backup emails&lt;br /&gt;
#Share backup files &lt;br /&gt;
#Make the candidate do the morning backup-check routine.&lt;br /&gt;
#Explain different backup failures&lt;br /&gt;
#Train how to investigate a backup failure. Using backup email/nagios.&lt;br /&gt;
#Show template emails  in Thunderbird and Wiki. Focus on backup email templates.&lt;br /&gt;
#Go through wiki [[Procedures]]&lt;br /&gt;
#Introduction to NEOSYS frontend e.g login page&lt;br /&gt;
&lt;br /&gt;
==Day 3==&lt;br /&gt;
#Do backups for the day and update the backup spreadsheet&lt;br /&gt;
#Train on how to schedule downtime on nagios.&lt;br /&gt;
#Go through the various errors in Troubleshooting nagios http://techwiki.neosys.com/index.php/Handling_Nagios_Client_Monitoring_System&lt;br /&gt;
#Read IT wiki &amp;quot;Documenting NEOSYS systems&amp;quot;&lt;br /&gt;
&lt;br /&gt;
==Day 4==&lt;br /&gt;
#Handle possible backup and nagios issues of the morning/day and email clients if they need to be informed about those issues.&lt;br /&gt;
#Read [https://userwiki.neosys.com/index.php/Using_NEOSYS_Generally#Getting_started_with_NEOSYS| Getting started with NEOSYS]&lt;br /&gt;
#Explain Media Schedule (Client &amp;amp; Brand file, Supplier file, Vehicle file, Specification, material, dates, free ads, booking, certifying, invoicing)&lt;br /&gt;
&lt;br /&gt;
==Day 5==&lt;br /&gt;
#Practice Media module&lt;br /&gt;
#Creating various Client &amp;amp; Brand, Vehicle and Supplier files&lt;br /&gt;
#Test knowledge so far on using Schedules. Manager to create two assignments of booking, cancellation, rebooking, certify &amp;amp; invoicing.&lt;br /&gt;
&lt;br /&gt;
==Day 6==&lt;br /&gt;
#Quiz on Procedures, Nagios and Handling damaged files&lt;br /&gt;
&lt;br /&gt;
==Day 7==&lt;br /&gt;
#Jobs Module completely and practice&lt;br /&gt;
#Explain Authorisation file (locks and keys, user ID, various levels etc)&lt;br /&gt;
&lt;br /&gt;
==Day 8==&lt;br /&gt;
#How to Upgrade NEOSYS &lt;br /&gt;
#Upgrade a client (use TEST installation)&lt;br /&gt;
#Explain Zone edit, DNS&lt;br /&gt;
&lt;br /&gt;
==Day 9==&lt;br /&gt;
#Replicating client issues&lt;br /&gt;
#Backup and Restoring NEOSYS&lt;br /&gt;
#Moving NEOSYS to new server/location etc&lt;br /&gt;
#Consolidated Backup (Autologin.sh)&lt;br /&gt;
#System configuration file features and testing each field&lt;br /&gt;
&lt;br /&gt;
==Day 10==&lt;br /&gt;
#Request for a quick demo from the new staff&lt;/div&gt;</summary>
		<author><name>Gregory</name></author>
	</entry>
	<entry>
		<id>https://techwiki.neosys.com/index.php?title=New_Employee_Training_Checklist&amp;diff=4065</id>
		<title>New Employee Training Checklist</title>
		<link rel="alternate" type="text/html" href="https://techwiki.neosys.com/index.php?title=New_Employee_Training_Checklist&amp;diff=4065"/>
		<updated>2025-08-06T07:30:31Z</updated>

		<summary type="html">&lt;p&gt;Gregory: /* Day 5 */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Day 1==&lt;br /&gt;
#Go through [[General_Office_Procedures|General Office Procedures]]&lt;br /&gt;
#Create a gmail account for your NEOSYS interactions e.g request for leave. Example firstname.neosys@gmail.com. Support Manager will share relevant google drive folders.&lt;br /&gt;
#To install and configure various software on Linux platform, see [http://itwiki.neosys.com/index.php/Setting_up_Ubuntu_on_NEOSYS_Support_Computers Setting up Ubuntu on NEOSYS Computers]&lt;br /&gt;
#[http://userwiki.neosys.com/index.php/Reset_Browser Reset browsers] and [http://userwiki.neosys.com/index.php/Disabling_Popup_Blocker disable pop-up blockers]&lt;br /&gt;
# Create an excel password file. The file name should be generic. Save with a password and share the password with your manager. Please refer link to create an appropriate password for the file ([[Procedures#Creating_and_Handling_passwords| Refer Handling passwords]]). The file should be placed under Support Staff folder in Nextcloud.&lt;br /&gt;
#Create signature in Thunderbird for all necessary accounts&lt;br /&gt;
#Mails are sent out in Calibri font with font size 11&lt;br /&gt;
#Create a file to store client info ( clients details) column names:- host name, company name, location of company, time zone, which server is the client&#039;s NEOSYS hosted on&lt;br /&gt;
#Configure your browsers according to [[Procedures#Configuring_Browsers_to_show_Javascript_errors_in_NEOSYS| Configuring Browsers to show Javascript errors]] and set it.neosys.com as Firefox home page&lt;br /&gt;
#Introduce nagios IT monitor&lt;br /&gt;
#Get NEOSYS IT to update Nagios monitoring workstations.cfg file and configure port-forwarding so that nagios can connect to the new employee&#039;s workstation&lt;br /&gt;
#Get a run down of client backup emails and updating backup spreadsheets.&lt;br /&gt;
#Create wiki ID and get NEOSYS IT to allow new users to receive wiki update emails.&lt;br /&gt;
&lt;br /&gt;
==Day 2 ==&lt;br /&gt;
#Check the clients file&lt;br /&gt;
#Explain backup procedure&lt;br /&gt;
#Show backup emails&lt;br /&gt;
#Share backup files &lt;br /&gt;
#Make the candidate do the morning backup-check routine.&lt;br /&gt;
#Explain different backup failures&lt;br /&gt;
#Train how to investigate a backup failure. Using backup email/nagios.&lt;br /&gt;
#Show template emails  in Thunderbird and Wiki. Focus on backup email templates.&lt;br /&gt;
#Go through wiki [[Procedures]]&lt;br /&gt;
#Introduction to NEOSYS frontend e.g login page&lt;br /&gt;
&lt;br /&gt;
==Day 3==&lt;br /&gt;
#Do backups for the day and update the backup spreadsheet&lt;br /&gt;
#Train on how to schedule downtime on nagios.&lt;br /&gt;
#Go through the various errors in Troubleshooting nagios http://techwiki.neosys.com/index.php/Handling_Nagios_Client_Monitoring_System&lt;br /&gt;
#Read IT wiki &amp;quot;Documenting NEOSYS systems&amp;quot;&lt;br /&gt;
&lt;br /&gt;
==Day 4==&lt;br /&gt;
#Handle possible backup and nagios issues of the morning/day and email clients if they need to be informed about those issues.&lt;br /&gt;
#Read [https://userwiki.neosys.com/index.php/Using_NEOSYS_Generally#Getting_started_with_NEOSYS| Getting started with NEOSYS]&lt;br /&gt;
#Explain Media Schedule (Client &amp;amp; Brand file, Supplier file, Vehicle file, Specification, material, dates, free ads, booking, certifying, invoicing)&lt;br /&gt;
&lt;br /&gt;
==Day 5==&lt;br /&gt;
#Practice Media module&lt;br /&gt;
#Creating various Client &amp;amp; Brand, Vehicle and Supplier files&lt;br /&gt;
#Test knowledge so far on using Schedules. Manager to create two assignments of booking, cancellation, rebooking, certify &amp;amp; invoicing.&lt;br /&gt;
&lt;br /&gt;
==Day 6==&lt;br /&gt;
#Handling damaged file with examples&lt;br /&gt;
#Quiz on Procedures, Nagios and Handling damaged files&lt;br /&gt;
&lt;br /&gt;
==Day 7==&lt;br /&gt;
#Jobs Module completely and practice&lt;br /&gt;
#Explain Authorisation file (locks and keys, user ID, various levels etc)&lt;br /&gt;
&lt;br /&gt;
==Day 8==&lt;br /&gt;
#How to Upgrade NEOSYS &lt;br /&gt;
#Upgrade a client (use TEST installation)&lt;br /&gt;
#Explain Zone edit, DNS&lt;br /&gt;
&lt;br /&gt;
==Day 9==&lt;br /&gt;
#Replicating client issues&lt;br /&gt;
#Backup and Restoring NEOSYS&lt;br /&gt;
#Moving NEOSYS to new server/location etc&lt;br /&gt;
#Consolidated Backup (Autologin.sh)&lt;br /&gt;
#System configuration file features and testing each field&lt;br /&gt;
&lt;br /&gt;
==Day 10==&lt;br /&gt;
#Request for a quick demo from the new staff&lt;/div&gt;</summary>
		<author><name>Gregory</name></author>
	</entry>
	<entry>
		<id>https://techwiki.neosys.com/index.php?title=New_Employee_Training_Checklist&amp;diff=4064</id>
		<title>New Employee Training Checklist</title>
		<link rel="alternate" type="text/html" href="https://techwiki.neosys.com/index.php?title=New_Employee_Training_Checklist&amp;diff=4064"/>
		<updated>2025-08-06T07:28:25Z</updated>

		<summary type="html">&lt;p&gt;Gregory: /* Day 4 */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Day 1==&lt;br /&gt;
#Go through [[General_Office_Procedures|General Office Procedures]]&lt;br /&gt;
#Create a gmail account for your NEOSYS interactions e.g request for leave. Example firstname.neosys@gmail.com. Support Manager will share relevant google drive folders.&lt;br /&gt;
#To install and configure various software on Linux platform, see [http://itwiki.neosys.com/index.php/Setting_up_Ubuntu_on_NEOSYS_Support_Computers Setting up Ubuntu on NEOSYS Computers]&lt;br /&gt;
#[http://userwiki.neosys.com/index.php/Reset_Browser Reset browsers] and [http://userwiki.neosys.com/index.php/Disabling_Popup_Blocker disable pop-up blockers]&lt;br /&gt;
# Create an excel password file. The file name should be generic. Save with a password and share the password with your manager. Please refer link to create an appropriate password for the file ([[Procedures#Creating_and_Handling_passwords| Refer Handling passwords]]). The file should be placed under Support Staff folder in Nextcloud.&lt;br /&gt;
#Create signature in Thunderbird for all necessary accounts&lt;br /&gt;
#Mails are sent out in Calibri font with font size 11&lt;br /&gt;
#Create a file to store client info ( clients details) column names:- host name, company name, location of company, time zone, which server is the client&#039;s NEOSYS hosted on&lt;br /&gt;
#Configure your browsers according to [[Procedures#Configuring_Browsers_to_show_Javascript_errors_in_NEOSYS| Configuring Browsers to show Javascript errors]] and set it.neosys.com as Firefox home page&lt;br /&gt;
#Introduce nagios IT monitor&lt;br /&gt;
#Get NEOSYS IT to update Nagios monitoring workstations.cfg file and configure port-forwarding so that nagios can connect to the new employee&#039;s workstation&lt;br /&gt;
#Get a run down of client backup emails and updating backup spreadsheets.&lt;br /&gt;
#Create wiki ID and get NEOSYS IT to allow new users to receive wiki update emails.&lt;br /&gt;
&lt;br /&gt;
==Day 2 ==&lt;br /&gt;
#Check the clients file&lt;br /&gt;
#Explain backup procedure&lt;br /&gt;
#Show backup emails&lt;br /&gt;
#Share backup files &lt;br /&gt;
#Make the candidate do the morning backup-check routine.&lt;br /&gt;
#Explain different backup failures&lt;br /&gt;
#Train how to investigate a backup failure. Using backup email/nagios.&lt;br /&gt;
#Show template emails  in Thunderbird and Wiki. Focus on backup email templates.&lt;br /&gt;
#Go through wiki [[Procedures]]&lt;br /&gt;
#Introduction to NEOSYS frontend e.g login page&lt;br /&gt;
&lt;br /&gt;
==Day 3==&lt;br /&gt;
#Do backups for the day and update the backup spreadsheet&lt;br /&gt;
#Train on how to schedule downtime on nagios.&lt;br /&gt;
#Go through the various errors in Troubleshooting nagios http://techwiki.neosys.com/index.php/Handling_Nagios_Client_Monitoring_System&lt;br /&gt;
#Read IT wiki &amp;quot;Documenting NEOSYS systems&amp;quot;&lt;br /&gt;
&lt;br /&gt;
==Day 4==&lt;br /&gt;
#Handle possible backup and nagios issues of the morning/day and email clients if they need to be informed about those issues.&lt;br /&gt;
#Read [https://userwiki.neosys.com/index.php/Using_NEOSYS_Generally#Getting_started_with_NEOSYS| Getting started with NEOSYS]&lt;br /&gt;
#Explain Media Schedule (Client &amp;amp; Brand file, Supplier file, Vehicle file, Specification, material, dates, free ads, booking, certifying, invoicing)&lt;br /&gt;
&lt;br /&gt;
==Day 5==&lt;br /&gt;
#2 Assignments on Schedules ( booking, cancelation, rebooking, certify &amp;amp; invoicing )&lt;br /&gt;
#Creating on various client and brand, vehicle and supplier files&lt;br /&gt;
#Practice Media module&lt;br /&gt;
&lt;br /&gt;
==Day 6==&lt;br /&gt;
#Handling damaged file with examples&lt;br /&gt;
#Quiz on Procedures, Nagios and Handling damaged files&lt;br /&gt;
&lt;br /&gt;
==Day 7==&lt;br /&gt;
#Jobs Module completely and practice&lt;br /&gt;
#Explain Authorisation file (locks and keys, user ID, various levels etc)&lt;br /&gt;
&lt;br /&gt;
==Day 8==&lt;br /&gt;
#How to Upgrade NEOSYS &lt;br /&gt;
#Upgrade a client (use TEST installation)&lt;br /&gt;
#Explain Zone edit, DNS&lt;br /&gt;
&lt;br /&gt;
==Day 9==&lt;br /&gt;
#Replicating client issues&lt;br /&gt;
#Backup and Restoring NEOSYS&lt;br /&gt;
#Moving NEOSYS to new server/location etc&lt;br /&gt;
#Consolidated Backup (Autologin.sh)&lt;br /&gt;
#System configuration file features and testing each field&lt;br /&gt;
&lt;br /&gt;
==Day 10==&lt;br /&gt;
#Request for a quick demo from the new staff&lt;/div&gt;</summary>
		<author><name>Gregory</name></author>
	</entry>
	<entry>
		<id>https://techwiki.neosys.com/index.php?title=New_Employee_Training_Checklist&amp;diff=4063</id>
		<title>New Employee Training Checklist</title>
		<link rel="alternate" type="text/html" href="https://techwiki.neosys.com/index.php?title=New_Employee_Training_Checklist&amp;diff=4063"/>
		<updated>2025-08-06T07:23:49Z</updated>

		<summary type="html">&lt;p&gt;Gregory: /* Day 3 */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Day 1==&lt;br /&gt;
#Go through [[General_Office_Procedures|General Office Procedures]]&lt;br /&gt;
#Create a gmail account for your NEOSYS interactions e.g request for leave. Example firstname.neosys@gmail.com. Support Manager will share relevant google drive folders.&lt;br /&gt;
#To install and configure various software on Linux platform, see [http://itwiki.neosys.com/index.php/Setting_up_Ubuntu_on_NEOSYS_Support_Computers Setting up Ubuntu on NEOSYS Computers]&lt;br /&gt;
#[http://userwiki.neosys.com/index.php/Reset_Browser Reset browsers] and [http://userwiki.neosys.com/index.php/Disabling_Popup_Blocker disable pop-up blockers]&lt;br /&gt;
# Create an excel password file. The file name should be generic. Save with a password and share the password with your manager. Please refer link to create an appropriate password for the file ([[Procedures#Creating_and_Handling_passwords| Refer Handling passwords]]). The file should be placed under Support Staff folder in Nextcloud.&lt;br /&gt;
#Create signature in Thunderbird for all necessary accounts&lt;br /&gt;
#Mails are sent out in Calibri font with font size 11&lt;br /&gt;
#Create a file to store client info ( clients details) column names:- host name, company name, location of company, time zone, which server is the client&#039;s NEOSYS hosted on&lt;br /&gt;
#Configure your browsers according to [[Procedures#Configuring_Browsers_to_show_Javascript_errors_in_NEOSYS| Configuring Browsers to show Javascript errors]] and set it.neosys.com as Firefox home page&lt;br /&gt;
#Introduce nagios IT monitor&lt;br /&gt;
#Get NEOSYS IT to update Nagios monitoring workstations.cfg file and configure port-forwarding so that nagios can connect to the new employee&#039;s workstation&lt;br /&gt;
#Get a run down of client backup emails and updating backup spreadsheets.&lt;br /&gt;
#Create wiki ID and get NEOSYS IT to allow new users to receive wiki update emails.&lt;br /&gt;
&lt;br /&gt;
==Day 2 ==&lt;br /&gt;
#Check the clients file&lt;br /&gt;
#Explain backup procedure&lt;br /&gt;
#Show backup emails&lt;br /&gt;
#Share backup files &lt;br /&gt;
#Make the candidate do the morning backup-check routine.&lt;br /&gt;
#Explain different backup failures&lt;br /&gt;
#Train how to investigate a backup failure. Using backup email/nagios.&lt;br /&gt;
#Show template emails  in Thunderbird and Wiki. Focus on backup email templates.&lt;br /&gt;
#Go through wiki [[Procedures]]&lt;br /&gt;
#Introduction to NEOSYS frontend e.g login page&lt;br /&gt;
&lt;br /&gt;
==Day 3==&lt;br /&gt;
#Do backups for the day and update the backup spreadsheet&lt;br /&gt;
#Train on how to schedule downtime on nagios.&lt;br /&gt;
#Go through the various errors in Troubleshooting nagios http://techwiki.neosys.com/index.php/Handling_Nagios_Client_Monitoring_System&lt;br /&gt;
#Read IT wiki &amp;quot;Documenting NEOSYS systems&amp;quot;&lt;br /&gt;
&lt;br /&gt;
==Day 4==&lt;br /&gt;
#Handle backup issues, critical issues on nagios&lt;br /&gt;
#Email clients if they need to be informed about issues.&lt;br /&gt;
#Explain Getting Started and NEOSYS login process&lt;br /&gt;
#Explain Media Schedule (per brand, Client Brand file, Vehicle file, specification, material, dates, free ads,  Supplier file, booking, certifying, invoicing) &lt;br /&gt;
&lt;br /&gt;
==Day 5==&lt;br /&gt;
#2 Assignments on Schedules ( booking, cancelation, rebooking, certify &amp;amp; invoicing )&lt;br /&gt;
#Creating on various client and brand, vehicle and supplier files&lt;br /&gt;
#Practice Media module&lt;br /&gt;
&lt;br /&gt;
==Day 6==&lt;br /&gt;
#Handling damaged file with examples&lt;br /&gt;
#Quiz on Procedures, Nagios and Handling damaged files&lt;br /&gt;
&lt;br /&gt;
==Day 7==&lt;br /&gt;
#Jobs Module completely and practice&lt;br /&gt;
#Explain Authorisation file (locks and keys, user ID, various levels etc)&lt;br /&gt;
&lt;br /&gt;
==Day 8==&lt;br /&gt;
#How to Upgrade NEOSYS &lt;br /&gt;
#Upgrade a client (use TEST installation)&lt;br /&gt;
#Explain Zone edit, DNS&lt;br /&gt;
&lt;br /&gt;
==Day 9==&lt;br /&gt;
#Replicating client issues&lt;br /&gt;
#Backup and Restoring NEOSYS&lt;br /&gt;
#Moving NEOSYS to new server/location etc&lt;br /&gt;
#Consolidated Backup (Autologin.sh)&lt;br /&gt;
#System configuration file features and testing each field&lt;br /&gt;
&lt;br /&gt;
==Day 10==&lt;br /&gt;
#Request for a quick demo from the new staff&lt;/div&gt;</summary>
		<author><name>Gregory</name></author>
	</entry>
	<entry>
		<id>https://techwiki.neosys.com/index.php?title=New_Employee_Training_Checklist&amp;diff=4062</id>
		<title>New Employee Training Checklist</title>
		<link rel="alternate" type="text/html" href="https://techwiki.neosys.com/index.php?title=New_Employee_Training_Checklist&amp;diff=4062"/>
		<updated>2025-08-06T07:22:48Z</updated>

		<summary type="html">&lt;p&gt;Gregory: /* Day 2 */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Day 1==&lt;br /&gt;
#Go through [[General_Office_Procedures|General Office Procedures]]&lt;br /&gt;
#Create a gmail account for your NEOSYS interactions e.g request for leave. Example firstname.neosys@gmail.com. Support Manager will share relevant google drive folders.&lt;br /&gt;
#To install and configure various software on Linux platform, see [http://itwiki.neosys.com/index.php/Setting_up_Ubuntu_on_NEOSYS_Support_Computers Setting up Ubuntu on NEOSYS Computers]&lt;br /&gt;
#[http://userwiki.neosys.com/index.php/Reset_Browser Reset browsers] and [http://userwiki.neosys.com/index.php/Disabling_Popup_Blocker disable pop-up blockers]&lt;br /&gt;
# Create an excel password file. The file name should be generic. Save with a password and share the password with your manager. Please refer link to create an appropriate password for the file ([[Procedures#Creating_and_Handling_passwords| Refer Handling passwords]]). The file should be placed under Support Staff folder in Nextcloud.&lt;br /&gt;
#Create signature in Thunderbird for all necessary accounts&lt;br /&gt;
#Mails are sent out in Calibri font with font size 11&lt;br /&gt;
#Create a file to store client info ( clients details) column names:- host name, company name, location of company, time zone, which server is the client&#039;s NEOSYS hosted on&lt;br /&gt;
#Configure your browsers according to [[Procedures#Configuring_Browsers_to_show_Javascript_errors_in_NEOSYS| Configuring Browsers to show Javascript errors]] and set it.neosys.com as Firefox home page&lt;br /&gt;
#Introduce nagios IT monitor&lt;br /&gt;
#Get NEOSYS IT to update Nagios monitoring workstations.cfg file and configure port-forwarding so that nagios can connect to the new employee&#039;s workstation&lt;br /&gt;
#Get a run down of client backup emails and updating backup spreadsheets.&lt;br /&gt;
#Create wiki ID and get NEOSYS IT to allow new users to receive wiki update emails.&lt;br /&gt;
&lt;br /&gt;
==Day 2 ==&lt;br /&gt;
#Check the clients file&lt;br /&gt;
#Explain backup procedure&lt;br /&gt;
#Show backup emails&lt;br /&gt;
#Share backup files &lt;br /&gt;
#Make the candidate do the morning backup-check routine.&lt;br /&gt;
#Explain different backup failures&lt;br /&gt;
#Train how to investigate a backup failure. Using backup email/nagios.&lt;br /&gt;
#Show template emails  in Thunderbird and Wiki. Focus on backup email templates.&lt;br /&gt;
#Go through wiki [[Procedures]]&lt;br /&gt;
#Introduction to NEOSYS frontend e.g login page&lt;br /&gt;
&lt;br /&gt;
==Day 3==&lt;br /&gt;
#Go through templates folder in support and backups email accounts.&lt;br /&gt;
#Show examples on when each backup template can be sent&lt;br /&gt;
#Do backups for the day and update the backup spreadsheet&lt;br /&gt;
#Schedule downtime on nagios&lt;br /&gt;
#Go through the various errors in Troubleshooting nagios http://techwiki.neosys.com/index.php/Handling_Nagios_Client_Monitoring_System&lt;br /&gt;
#Read IT wiki &amp;quot;Documenting NEOSYS systems&amp;quot;&lt;br /&gt;
&lt;br /&gt;
==Day 4==&lt;br /&gt;
#Handle backup issues, critical issues on nagios&lt;br /&gt;
#Email clients if they need to be informed about issues.&lt;br /&gt;
#Explain Getting Started and NEOSYS login process&lt;br /&gt;
#Explain Media Schedule (per brand, Client Brand file, Vehicle file, specification, material, dates, free ads,  Supplier file, booking, certifying, invoicing) &lt;br /&gt;
&lt;br /&gt;
==Day 5==&lt;br /&gt;
#2 Assignments on Schedules ( booking, cancelation, rebooking, certify &amp;amp; invoicing )&lt;br /&gt;
#Creating on various client and brand, vehicle and supplier files&lt;br /&gt;
#Practice Media module&lt;br /&gt;
&lt;br /&gt;
==Day 6==&lt;br /&gt;
#Handling damaged file with examples&lt;br /&gt;
#Quiz on Procedures, Nagios and Handling damaged files&lt;br /&gt;
&lt;br /&gt;
==Day 7==&lt;br /&gt;
#Jobs Module completely and practice&lt;br /&gt;
#Explain Authorisation file (locks and keys, user ID, various levels etc)&lt;br /&gt;
&lt;br /&gt;
==Day 8==&lt;br /&gt;
#How to Upgrade NEOSYS &lt;br /&gt;
#Upgrade a client (use TEST installation)&lt;br /&gt;
#Explain Zone edit, DNS&lt;br /&gt;
&lt;br /&gt;
==Day 9==&lt;br /&gt;
#Replicating client issues&lt;br /&gt;
#Backup and Restoring NEOSYS&lt;br /&gt;
#Moving NEOSYS to new server/location etc&lt;br /&gt;
#Consolidated Backup (Autologin.sh)&lt;br /&gt;
#System configuration file features and testing each field&lt;br /&gt;
&lt;br /&gt;
==Day 10==&lt;br /&gt;
#Request for a quick demo from the new staff&lt;/div&gt;</summary>
		<author><name>Gregory</name></author>
	</entry>
	<entry>
		<id>https://techwiki.neosys.com/index.php?title=New_Employee_Training_Checklist&amp;diff=4061</id>
		<title>New Employee Training Checklist</title>
		<link rel="alternate" type="text/html" href="https://techwiki.neosys.com/index.php?title=New_Employee_Training_Checklist&amp;diff=4061"/>
		<updated>2025-08-06T07:22:22Z</updated>

		<summary type="html">&lt;p&gt;Gregory: /* Day 2 */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Day 1==&lt;br /&gt;
#Go through [[General_Office_Procedures|General Office Procedures]]&lt;br /&gt;
#Create a gmail account for your NEOSYS interactions e.g request for leave. Example firstname.neosys@gmail.com. Support Manager will share relevant google drive folders.&lt;br /&gt;
#To install and configure various software on Linux platform, see [http://itwiki.neosys.com/index.php/Setting_up_Ubuntu_on_NEOSYS_Support_Computers Setting up Ubuntu on NEOSYS Computers]&lt;br /&gt;
#[http://userwiki.neosys.com/index.php/Reset_Browser Reset browsers] and [http://userwiki.neosys.com/index.php/Disabling_Popup_Blocker disable pop-up blockers]&lt;br /&gt;
# Create an excel password file. The file name should be generic. Save with a password and share the password with your manager. Please refer link to create an appropriate password for the file ([[Procedures#Creating_and_Handling_passwords| Refer Handling passwords]]). The file should be placed under Support Staff folder in Nextcloud.&lt;br /&gt;
#Create signature in Thunderbird for all necessary accounts&lt;br /&gt;
#Mails are sent out in Calibri font with font size 11&lt;br /&gt;
#Create a file to store client info ( clients details) column names:- host name, company name, location of company, time zone, which server is the client&#039;s NEOSYS hosted on&lt;br /&gt;
#Configure your browsers according to [[Procedures#Configuring_Browsers_to_show_Javascript_errors_in_NEOSYS| Configuring Browsers to show Javascript errors]] and set it.neosys.com as Firefox home page&lt;br /&gt;
#Introduce nagios IT monitor&lt;br /&gt;
#Get NEOSYS IT to update Nagios monitoring workstations.cfg file and configure port-forwarding so that nagios can connect to the new employee&#039;s workstation&lt;br /&gt;
#Get a run down of client backup emails and updating backup spreadsheets.&lt;br /&gt;
#Create wiki ID and get NEOSYS IT to allow new users to receive wiki update emails.&lt;br /&gt;
&lt;br /&gt;
==Day 2 ==&lt;br /&gt;
#Check the clients file&lt;br /&gt;
#Explain backup procedure&lt;br /&gt;
#Show backup emails&lt;br /&gt;
#Share backup files &lt;br /&gt;
#Make the candidate do the morning backup-check routine.&lt;br /&gt;
#Explain different backup failures&lt;br /&gt;
#Train how to investigate a backup failure. Using backup email/nagios.&lt;br /&gt;
#Show template emails  in Thunderbird and Wiki. Focus on backups templates.&lt;br /&gt;
#Go through wiki [[Procedures]]&lt;br /&gt;
#Introduction to NEOSYS frontend e.g login page&lt;br /&gt;
&lt;br /&gt;
==Day 3==&lt;br /&gt;
#Go through templates folder in support and backups email accounts.&lt;br /&gt;
#Show examples on when each backup template can be sent&lt;br /&gt;
#Do backups for the day and update the backup spreadsheet&lt;br /&gt;
#Schedule downtime on nagios&lt;br /&gt;
#Go through the various errors in Troubleshooting nagios http://techwiki.neosys.com/index.php/Handling_Nagios_Client_Monitoring_System&lt;br /&gt;
#Read IT wiki &amp;quot;Documenting NEOSYS systems&amp;quot;&lt;br /&gt;
&lt;br /&gt;
==Day 4==&lt;br /&gt;
#Handle backup issues, critical issues on nagios&lt;br /&gt;
#Email clients if they need to be informed about issues.&lt;br /&gt;
#Explain Getting Started and NEOSYS login process&lt;br /&gt;
#Explain Media Schedule (per brand, Client Brand file, Vehicle file, specification, material, dates, free ads,  Supplier file, booking, certifying, invoicing) &lt;br /&gt;
&lt;br /&gt;
==Day 5==&lt;br /&gt;
#2 Assignments on Schedules ( booking, cancelation, rebooking, certify &amp;amp; invoicing )&lt;br /&gt;
#Creating on various client and brand, vehicle and supplier files&lt;br /&gt;
#Practice Media module&lt;br /&gt;
&lt;br /&gt;
==Day 6==&lt;br /&gt;
#Handling damaged file with examples&lt;br /&gt;
#Quiz on Procedures, Nagios and Handling damaged files&lt;br /&gt;
&lt;br /&gt;
==Day 7==&lt;br /&gt;
#Jobs Module completely and practice&lt;br /&gt;
#Explain Authorisation file (locks and keys, user ID, various levels etc)&lt;br /&gt;
&lt;br /&gt;
==Day 8==&lt;br /&gt;
#How to Upgrade NEOSYS &lt;br /&gt;
#Upgrade a client (use TEST installation)&lt;br /&gt;
#Explain Zone edit, DNS&lt;br /&gt;
&lt;br /&gt;
==Day 9==&lt;br /&gt;
#Replicating client issues&lt;br /&gt;
#Backup and Restoring NEOSYS&lt;br /&gt;
#Moving NEOSYS to new server/location etc&lt;br /&gt;
#Consolidated Backup (Autologin.sh)&lt;br /&gt;
#System configuration file features and testing each field&lt;br /&gt;
&lt;br /&gt;
==Day 10==&lt;br /&gt;
#Request for a quick demo from the new staff&lt;/div&gt;</summary>
		<author><name>Gregory</name></author>
	</entry>
	<entry>
		<id>https://techwiki.neosys.com/index.php?title=New_Employee_Training_Checklist&amp;diff=4060</id>
		<title>New Employee Training Checklist</title>
		<link rel="alternate" type="text/html" href="https://techwiki.neosys.com/index.php?title=New_Employee_Training_Checklist&amp;diff=4060"/>
		<updated>2025-08-06T07:20:06Z</updated>

		<summary type="html">&lt;p&gt;Gregory: /* Day 2 */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Day 1==&lt;br /&gt;
#Go through [[General_Office_Procedures|General Office Procedures]]&lt;br /&gt;
#Create a gmail account for your NEOSYS interactions e.g request for leave. Example firstname.neosys@gmail.com. Support Manager will share relevant google drive folders.&lt;br /&gt;
#To install and configure various software on Linux platform, see [http://itwiki.neosys.com/index.php/Setting_up_Ubuntu_on_NEOSYS_Support_Computers Setting up Ubuntu on NEOSYS Computers]&lt;br /&gt;
#[http://userwiki.neosys.com/index.php/Reset_Browser Reset browsers] and [http://userwiki.neosys.com/index.php/Disabling_Popup_Blocker disable pop-up blockers]&lt;br /&gt;
# Create an excel password file. The file name should be generic. Save with a password and share the password with your manager. Please refer link to create an appropriate password for the file ([[Procedures#Creating_and_Handling_passwords| Refer Handling passwords]]). The file should be placed under Support Staff folder in Nextcloud.&lt;br /&gt;
#Create signature in Thunderbird for all necessary accounts&lt;br /&gt;
#Mails are sent out in Calibri font with font size 11&lt;br /&gt;
#Create a file to store client info ( clients details) column names:- host name, company name, location of company, time zone, which server is the client&#039;s NEOSYS hosted on&lt;br /&gt;
#Configure your browsers according to [[Procedures#Configuring_Browsers_to_show_Javascript_errors_in_NEOSYS| Configuring Browsers to show Javascript errors]] and set it.neosys.com as Firefox home page&lt;br /&gt;
#Introduce nagios IT monitor&lt;br /&gt;
#Get NEOSYS IT to update Nagios monitoring workstations.cfg file and configure port-forwarding so that nagios can connect to the new employee&#039;s workstation&lt;br /&gt;
#Get a run down of client backup emails and updating backup spreadsheets.&lt;br /&gt;
#Create wiki ID and get NEOSYS IT to allow new users to receive wiki update emails.&lt;br /&gt;
&lt;br /&gt;
==Day 2 ==&lt;br /&gt;
#Check the clients file&lt;br /&gt;
#Explain backup procedure&lt;br /&gt;
#Show backup emails&lt;br /&gt;
#Share backup files &lt;br /&gt;
#Make the candidate do the morning backup-check routine.&lt;br /&gt;
#Explain different backup failures&lt;br /&gt;
#Train how to investigate a backup failure. Using backup email/nagios.&lt;br /&gt;
#Show template emails in Thunderbird and Wiki&lt;br /&gt;
#Go through wiki [[Procedures]]&lt;br /&gt;
#Introduction to NEOSYS frontend e.g login page&lt;br /&gt;
&lt;br /&gt;
==Day 3==&lt;br /&gt;
#Go through templates folder in support and backups email accounts.&lt;br /&gt;
#Show examples on when each backup template can be sent&lt;br /&gt;
#Do backups for the day and update the backup spreadsheet&lt;br /&gt;
#Schedule downtime on nagios&lt;br /&gt;
#Go through the various errors in Troubleshooting nagios http://techwiki.neosys.com/index.php/Handling_Nagios_Client_Monitoring_System&lt;br /&gt;
#Read IT wiki &amp;quot;Documenting NEOSYS systems&amp;quot;&lt;br /&gt;
&lt;br /&gt;
==Day 4==&lt;br /&gt;
#Handle backup issues, critical issues on nagios&lt;br /&gt;
#Email clients if they need to be informed about issues.&lt;br /&gt;
#Explain Getting Started and NEOSYS login process&lt;br /&gt;
#Explain Media Schedule (per brand, Client Brand file, Vehicle file, specification, material, dates, free ads,  Supplier file, booking, certifying, invoicing) &lt;br /&gt;
&lt;br /&gt;
==Day 5==&lt;br /&gt;
#2 Assignments on Schedules ( booking, cancelation, rebooking, certify &amp;amp; invoicing )&lt;br /&gt;
#Creating on various client and brand, vehicle and supplier files&lt;br /&gt;
#Practice Media module&lt;br /&gt;
&lt;br /&gt;
==Day 6==&lt;br /&gt;
#Handling damaged file with examples&lt;br /&gt;
#Quiz on Procedures, Nagios and Handling damaged files&lt;br /&gt;
&lt;br /&gt;
==Day 7==&lt;br /&gt;
#Jobs Module completely and practice&lt;br /&gt;
#Explain Authorisation file (locks and keys, user ID, various levels etc)&lt;br /&gt;
&lt;br /&gt;
==Day 8==&lt;br /&gt;
#How to Upgrade NEOSYS &lt;br /&gt;
#Upgrade a client (use TEST installation)&lt;br /&gt;
#Explain Zone edit, DNS&lt;br /&gt;
&lt;br /&gt;
==Day 9==&lt;br /&gt;
#Replicating client issues&lt;br /&gt;
#Backup and Restoring NEOSYS&lt;br /&gt;
#Moving NEOSYS to new server/location etc&lt;br /&gt;
#Consolidated Backup (Autologin.sh)&lt;br /&gt;
#System configuration file features and testing each field&lt;br /&gt;
&lt;br /&gt;
==Day 10==&lt;br /&gt;
#Request for a quick demo from the new staff&lt;/div&gt;</summary>
		<author><name>Gregory</name></author>
	</entry>
	<entry>
		<id>https://techwiki.neosys.com/index.php?title=New_Employee_Training_Checklist&amp;diff=4059</id>
		<title>New Employee Training Checklist</title>
		<link rel="alternate" type="text/html" href="https://techwiki.neosys.com/index.php?title=New_Employee_Training_Checklist&amp;diff=4059"/>
		<updated>2025-08-06T07:13:15Z</updated>

		<summary type="html">&lt;p&gt;Gregory: /* Day 1 */ Revised for 2025&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Day 1==&lt;br /&gt;
#Go through [[General_Office_Procedures|General Office Procedures]]&lt;br /&gt;
#Create a gmail account for your NEOSYS interactions e.g request for leave. Example firstname.neosys@gmail.com. Support Manager will share relevant google drive folders.&lt;br /&gt;
#To install and configure various software on Linux platform, see [http://itwiki.neosys.com/index.php/Setting_up_Ubuntu_on_NEOSYS_Support_Computers Setting up Ubuntu on NEOSYS Computers]&lt;br /&gt;
#[http://userwiki.neosys.com/index.php/Reset_Browser Reset browsers] and [http://userwiki.neosys.com/index.php/Disabling_Popup_Blocker disable pop-up blockers]&lt;br /&gt;
# Create an excel password file. The file name should be generic. Save with a password and share the password with your manager. Please refer link to create an appropriate password for the file ([[Procedures#Creating_and_Handling_passwords| Refer Handling passwords]]). The file should be placed under Support Staff folder in Nextcloud.&lt;br /&gt;
#Create signature in Thunderbird for all necessary accounts&lt;br /&gt;
#Mails are sent out in Calibri font with font size 11&lt;br /&gt;
#Create a file to store client info ( clients details) column names:- host name, company name, location of company, time zone, which server is the client&#039;s NEOSYS hosted on&lt;br /&gt;
#Configure your browsers according to [[Procedures#Configuring_Browsers_to_show_Javascript_errors_in_NEOSYS| Configuring Browsers to show Javascript errors]] and set it.neosys.com as Firefox home page&lt;br /&gt;
#Introduce nagios IT monitor&lt;br /&gt;
#Get NEOSYS IT to update Nagios monitoring workstations.cfg file and configure port-forwarding so that nagios can connect to the new employee&#039;s workstation&lt;br /&gt;
#Get a run down of client backup emails and updating backup spreadsheets.&lt;br /&gt;
#Create wiki ID and get NEOSYS IT to allow new users to receive wiki update emails.&lt;br /&gt;
&lt;br /&gt;
==Day 2 ==&lt;br /&gt;
#Check the clients file&lt;br /&gt;
#Explain backup procedure&lt;br /&gt;
#Show backup emails&lt;br /&gt;
#Share backup files &lt;br /&gt;
#Make the candidate do the morning backup-check routine.&lt;br /&gt;
#Explain http://techwiki.neosys.com/index.php/Procedures#NEOSYS_Maintenance_Window&lt;br /&gt;
#Explain different backup failures&lt;br /&gt;
#Various checks on why and how a backup failed. (mail in inbox, nagios trends, neosys log, server event viewer)&lt;br /&gt;
#Show canned emails&lt;br /&gt;
#Go through wiki [[Procedures]]&lt;br /&gt;
#NEOSYS login page and configuring NEOSYS&lt;br /&gt;
&lt;br /&gt;
==Day 3==&lt;br /&gt;
#Go through templates folder in support and backups email accounts.&lt;br /&gt;
#Show examples on when each backup template can be sent&lt;br /&gt;
#Do backups for the day and update the backup spreadsheet&lt;br /&gt;
#Schedule downtime on nagios&lt;br /&gt;
#Go through the various errors in Troubleshooting nagios http://techwiki.neosys.com/index.php/Handling_Nagios_Client_Monitoring_System&lt;br /&gt;
#Read IT wiki &amp;quot;Documenting NEOSYS systems&amp;quot;&lt;br /&gt;
&lt;br /&gt;
==Day 4==&lt;br /&gt;
#Handle backup issues, critical issues on nagios&lt;br /&gt;
#Email clients if they need to be informed about issues.&lt;br /&gt;
#Explain Getting Started and NEOSYS login process&lt;br /&gt;
#Explain Media Schedule (per brand, Client Brand file, Vehicle file, specification, material, dates, free ads,  Supplier file, booking, certifying, invoicing) &lt;br /&gt;
&lt;br /&gt;
==Day 5==&lt;br /&gt;
#2 Assignments on Schedules ( booking, cancelation, rebooking, certify &amp;amp; invoicing )&lt;br /&gt;
#Creating on various client and brand, vehicle and supplier files&lt;br /&gt;
#Practice Media module&lt;br /&gt;
&lt;br /&gt;
==Day 6==&lt;br /&gt;
#Handling damaged file with examples&lt;br /&gt;
#Quiz on Procedures, Nagios and Handling damaged files&lt;br /&gt;
&lt;br /&gt;
==Day 7==&lt;br /&gt;
#Jobs Module completely and practice&lt;br /&gt;
#Explain Authorisation file (locks and keys, user ID, various levels etc)&lt;br /&gt;
&lt;br /&gt;
==Day 8==&lt;br /&gt;
#How to Upgrade NEOSYS &lt;br /&gt;
#Upgrade a client (use TEST installation)&lt;br /&gt;
#Explain Zone edit, DNS&lt;br /&gt;
&lt;br /&gt;
==Day 9==&lt;br /&gt;
#Replicating client issues&lt;br /&gt;
#Backup and Restoring NEOSYS&lt;br /&gt;
#Moving NEOSYS to new server/location etc&lt;br /&gt;
#Consolidated Backup (Autologin.sh)&lt;br /&gt;
#System configuration file features and testing each field&lt;br /&gt;
&lt;br /&gt;
==Day 10==&lt;br /&gt;
#Request for a quick demo from the new staff&lt;/div&gt;</summary>
		<author><name>Gregory</name></author>
	</entry>
	<entry>
		<id>https://techwiki.neosys.com/index.php?title=New_Employee_Training_Checklist&amp;diff=4058</id>
		<title>New Employee Training Checklist</title>
		<link rel="alternate" type="text/html" href="https://techwiki.neosys.com/index.php?title=New_Employee_Training_Checklist&amp;diff=4058"/>
		<updated>2025-08-06T07:02:44Z</updated>

		<summary type="html">&lt;p&gt;Gregory: /* Day 1 */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Day 1==&lt;br /&gt;
#Go through [[General_Office_Procedures|General Office Procedures]]&lt;br /&gt;
#Create email Id  eg :- firstname.neosys@gmail.com. Support Manager will share relevant google drive folders.&lt;br /&gt;
#To install and configure various software on Linux platform, see [http://itwiki.neosys.com/index.php/Setting_up_Ubuntu_on_NEOSYS_Support_Computers Setting up Ubuntu on NEOSYS Computers]&lt;br /&gt;
#[http://userwiki.neosys.com/index.php/Reset_Browser Reset browsers] and [http://userwiki.neosys.com/index.php/Disabling_Popup_Blocker disable pop-up blockers]&lt;br /&gt;
#Password file:- This file contains all usernames and passwords. The file name should be generic. The file is password protected, please refer link to create an appropriate password for the file ([[Procedures#Creating_and_Handling_passwords| Refer Handling passwords]]). The file should be placed under Support Staff folder in Nextcloud. The aim is to protect the file from being accessed or modified by another person.&lt;br /&gt;
#Create signature in Thunderbird for all necessary accounts&lt;br /&gt;
#Mails are sent out in Calibri font with font size 11&lt;br /&gt;
#Create a file to store client info ( clients details) column names:- host name, company name, location of company, time zone, which server is the client&#039;s NEOSYS hosted on&lt;br /&gt;
#Configure your browsers according to [[Procedures#Configuring_Browsers_to_show_Javascript_errors_in_NEOSYS| Configuring Browsers to show Javascript errors]] and set vm1.neosys.com as Firefox home page&lt;br /&gt;
#Introduce nagios&lt;br /&gt;
#Get NEOSYS IT to update Nagios monitoring workstations.cfg file and configure port-forwarding so that nagios can connect to the new employee&#039;s workstation&lt;br /&gt;
#Read wiki page “Backup and Restore” &lt;br /&gt;
#Create wiki ID and get NEOSYS IT to allow new users to receive wiki update emails &lt;br /&gt;
#http://network-tools.com&lt;br /&gt;
&lt;br /&gt;
==Day 2 ==&lt;br /&gt;
#Check the clients file&lt;br /&gt;
#Explain backup procedure&lt;br /&gt;
#Show backup emails&lt;br /&gt;
#Share backup files &lt;br /&gt;
#Make the candidate do the morning backup-check routine.&lt;br /&gt;
#Explain http://techwiki.neosys.com/index.php/Procedures#NEOSYS_Maintenance_Window&lt;br /&gt;
#Explain different backup failures&lt;br /&gt;
#Various checks on why and how a backup failed. (mail in inbox, nagios trends, neosys log, server event viewer)&lt;br /&gt;
#Show canned emails&lt;br /&gt;
#Go through wiki [[Procedures]]&lt;br /&gt;
#NEOSYS login page and configuring NEOSYS&lt;br /&gt;
&lt;br /&gt;
==Day 3==&lt;br /&gt;
#Go through templates folder in support and backups email accounts.&lt;br /&gt;
#Show examples on when each backup template can be sent&lt;br /&gt;
#Do backups for the day and update the backup spreadsheet&lt;br /&gt;
#Schedule downtime on nagios&lt;br /&gt;
#Go through the various errors in Troubleshooting nagios http://techwiki.neosys.com/index.php/Handling_Nagios_Client_Monitoring_System&lt;br /&gt;
#Read IT wiki &amp;quot;Documenting NEOSYS systems&amp;quot;&lt;br /&gt;
&lt;br /&gt;
==Day 4==&lt;br /&gt;
#Handle backup issues, critical issues on nagios&lt;br /&gt;
#Email clients if they need to be informed about issues.&lt;br /&gt;
#Explain Getting Started and NEOSYS login process&lt;br /&gt;
#Explain Media Schedule (per brand, Client Brand file, Vehicle file, specification, material, dates, free ads,  Supplier file, booking, certifying, invoicing) &lt;br /&gt;
&lt;br /&gt;
==Day 5==&lt;br /&gt;
#2 Assignments on Schedules ( booking, cancelation, rebooking, certify &amp;amp; invoicing )&lt;br /&gt;
#Creating on various client and brand, vehicle and supplier files&lt;br /&gt;
#Practice Media module&lt;br /&gt;
&lt;br /&gt;
==Day 6==&lt;br /&gt;
#Handling damaged file with examples&lt;br /&gt;
#Quiz on Procedures, Nagios and Handling damaged files&lt;br /&gt;
&lt;br /&gt;
==Day 7==&lt;br /&gt;
#Jobs Module completely and practice&lt;br /&gt;
#Explain Authorisation file (locks and keys, user ID, various levels etc)&lt;br /&gt;
&lt;br /&gt;
==Day 8==&lt;br /&gt;
#How to Upgrade NEOSYS &lt;br /&gt;
#Upgrade a client (use TEST installation)&lt;br /&gt;
#Explain Zone edit, DNS&lt;br /&gt;
&lt;br /&gt;
==Day 9==&lt;br /&gt;
#Replicating client issues&lt;br /&gt;
#Backup and Restoring NEOSYS&lt;br /&gt;
#Moving NEOSYS to new server/location etc&lt;br /&gt;
#Consolidated Backup (Autologin.sh)&lt;br /&gt;
#System configuration file features and testing each field&lt;br /&gt;
&lt;br /&gt;
==Day 10==&lt;br /&gt;
#Request for a quick demo from the new staff&lt;/div&gt;</summary>
		<author><name>Gregory</name></author>
	</entry>
	<entry>
		<id>https://techwiki.neosys.com/index.php?title=Benchmarking_NEOSYS&amp;diff=4051</id>
		<title>Benchmarking NEOSYS</title>
		<link rel="alternate" type="text/html" href="https://techwiki.neosys.com/index.php?title=Benchmarking_NEOSYS&amp;diff=4051"/>
		<updated>2024-12-12T05:34:56Z</updated>

		<summary type="html">&lt;p&gt;Gregory: /* Benchmarking the speed of NEOSYS over the network */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=== Measuring the speed of NEOSYS on the server ===&lt;br /&gt;
&lt;br /&gt;
In NEOSYS maintenance mode press F5:&lt;br /&gt;
&lt;br /&gt;
 FILESPEED&lt;br /&gt;
&lt;br /&gt;
Measures the speed at to create and delete a file with 1000x1Kb records - lower time is better&lt;br /&gt;
&lt;br /&gt;
Example speed is 1 second on a high quality notebook 7200rpm Hitachi deskstar&lt;br /&gt;
Speeds less than 8 seconds are acceptable for small installations&lt;br /&gt;
Speeds less than 4 seconds are acceptable for larger installations&lt;br /&gt;
Antivirus usually needs to be configured to exclude OV or OV? files. See section [[Configuring Antivirus for NEOSYS]]&lt;br /&gt;
&lt;br /&gt;
 PROCSPEED&lt;br /&gt;
&lt;br /&gt;
Measures the processor speed – higher speed is better&lt;br /&gt;
&lt;br /&gt;
Example speed is 540K tests per second on an Intel Core Duo 1.8Ghz&lt;br /&gt;
&lt;br /&gt;
 MEMSPEED&lt;br /&gt;
&lt;br /&gt;
Measures the memory speed – higher speed is better&lt;br /&gt;
&lt;br /&gt;
Example speed is 27K tests per second on an Intel Core Duo 1.8Ghz with &lt;br /&gt;
667MHz DDR 2 SDRAM&lt;br /&gt;
&lt;br /&gt;
=== Benchmarking the speed of NEOSYS over the network ===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Test speed using Menu &amp;gt; Help &amp;gt; System Speed Test: (use option 100 for the number of times to repeat)&lt;br /&gt;
&lt;br /&gt;
The three loopback tests checks the connection from:&lt;br /&gt;
#Web server loopback: User PC -&amp;gt; Apache2 and back.&lt;br /&gt;
#EXODUS Server loopback: User PC -&amp;gt; Apache2 -&amp;gt; NEOSYS service. (Sends request &amp;quot;TEST&amp;quot;, which prompts listen program to reply &#039;OK&#039;) &lt;br /&gt;
#EXODUS application loopback: User PC -&amp;gt; Apache2 -&amp;gt; NEOSYS service -&amp;gt; database. (Sends a SELECT currencies command by default)&lt;br /&gt;
&lt;br /&gt;
Results are to be noted in the installation check list.&lt;br /&gt;
&lt;br /&gt;
=== Getting CPU characteristics ===&lt;br /&gt;
&lt;br /&gt;
Intel Processor Identification Utility&lt;br /&gt;
&lt;br /&gt;
http://downloadfinder.intel.com/scripts-df-external/confirm.aspx?httpDown=http://downloadmirror.intel.com/df-support/7838/eng/pidenu12.msi&amp;amp;agr=N&amp;amp;ProductID=528&amp;amp;DwnldId=7838&amp;amp;strOSs=All&amp;amp;OSFullName=All%20Operating%20Systems&amp;amp;lang=eng&lt;/div&gt;</summary>
		<author><name>Gregory</name></author>
	</entry>
	<entry>
		<id>https://techwiki.neosys.com/index.php?title=Technical_/_Hardware_requirements&amp;diff=4047</id>
		<title>Technical / Hardware requirements</title>
		<link rel="alternate" type="text/html" href="https://techwiki.neosys.com/index.php?title=Technical_/_Hardware_requirements&amp;diff=4047"/>
		<updated>2024-07-22T05:25:40Z</updated>

		<summary type="html">&lt;p&gt;Gregory: /* Software requirements */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;===Hardware requirements===&lt;br /&gt;
&lt;br /&gt;
*Entry level physical or virtual server *dedicated to NEOSYS only* (in case of virtual machine, the host machine MUST be dedicated to NEOSYS and access given to support team, otherwise issues on the host machine will be untraceable by support team and NEOSYS will not be responsible for overall performance)&lt;br /&gt;
*1 x Quad core CPU (minimum)&lt;br /&gt;
*8 GB RAM (minimum)&lt;br /&gt;
*Minimum 100GB SSD Enterprise Write intensive (recommend 2x for mirroring)&lt;br /&gt;
&lt;br /&gt;
===Software requirements===&lt;br /&gt;
&lt;br /&gt;
*Ubuntu Server 24.04 LTS&lt;br /&gt;
*Configured with an internal static IP (ie dynamic IP delivered by DHCP is not allowed)&lt;br /&gt;
*Strictly no additional software installed&lt;br /&gt;
&lt;br /&gt;
===Web Browser on User Workstations===&lt;br /&gt;
&lt;br /&gt;
Firefox, Chrome or MS Edge.&lt;br /&gt;
&lt;br /&gt;
Browsers must have pop-up blockers turned off and must not have any 3rd party toolbars installed, that can potentially interfere with the NEOSYS user interface.&lt;br /&gt;
&lt;br /&gt;
===Backup requirements===&lt;br /&gt;
If entry level physical server or if virtual server that supports USB passthrough (e.g. VMWare vSphere version 4.1 and above):&lt;br /&gt;
&lt;br /&gt;
*3 x 16 GB USB drives for backup&lt;br /&gt;
*Someone to change the USB drives on a scheduled basis (weekly)&lt;br /&gt;
&lt;br /&gt;
If virtual server that does not support USB passthrough:&lt;br /&gt;
&lt;br /&gt;
*Client must *at their own responsibility* agree to arrange copy of the backup files to an external backup location every day.&lt;br /&gt;
&lt;br /&gt;
Also refer to [[Backup_and_Restore#Backup_in_virtual_server| Backup to virtual server]]&lt;br /&gt;
&lt;br /&gt;
===Router requirements===&lt;br /&gt;
&lt;br /&gt;
*Port forwarding:&lt;br /&gt;
**SSH: port 19581 (router) -&amp;gt; port 19581 (server) for Host.&lt;br /&gt;
**SSH: port 19582 (router) -&amp;gt; port 19582 (server) for lxc container.&lt;br /&gt;
**HTTPS: port 4431 (router) -&amp;gt; port 4431 (server) (Required only if NEOSYS needs to be accessed from outside office and prior management approval for this is obtained)&lt;br /&gt;
*Access to send email via an internal email server&lt;br /&gt;
&lt;br /&gt;
===Remote support requirement===&lt;br /&gt;
&lt;br /&gt;
[[Letter_to_obtain_agreement_of_client_IT_staff_to_provide_remote_access| Letter to obtain agreement of client IT staff to provide remote access]]&lt;/div&gt;</summary>
		<author><name>Gregory</name></author>
	</entry>
	<entry>
		<id>https://techwiki.neosys.com/index.php?title=Technical_/_Hardware_requirements&amp;diff=4043</id>
		<title>Technical / Hardware requirements</title>
		<link rel="alternate" type="text/html" href="https://techwiki.neosys.com/index.php?title=Technical_/_Hardware_requirements&amp;diff=4043"/>
		<updated>2024-05-15T07:09:18Z</updated>

		<summary type="html">&lt;p&gt;Gregory: /* Hardware requirements */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;===Hardware requirements===&lt;br /&gt;
&lt;br /&gt;
*Entry level physical or virtual server *dedicated to NEOSYS only* (in case of virtual machine, the host machine MUST be dedicated to NEOSYS and access given to support team, otherwise issues on the host machine will be untraceable by support team and NEOSYS will not be responsible for overall performance)&lt;br /&gt;
*1 x Quad core CPU (minimum)&lt;br /&gt;
*8 GB RAM (minimum)&lt;br /&gt;
*Minimum 100GB SSD Enterprise Write intensive (recommend 2x for mirroring)&lt;br /&gt;
&lt;br /&gt;
===Software requirements===&lt;br /&gt;
&lt;br /&gt;
*Ubuntu Server 22.04 LTS&lt;br /&gt;
*Configured with an internal static IP (ie dynamic IP delivered by DHCP is not allowed)&lt;br /&gt;
*Strictly no additional software installed&lt;br /&gt;
&lt;br /&gt;
===Web Browser on User Workstations===&lt;br /&gt;
&lt;br /&gt;
Firefox, Chrome or MS Edge.&lt;br /&gt;
&lt;br /&gt;
Browsers must have pop-up blockers turned off and must not have any 3rd party toolbars installed, that can potentially interfere with the NEOSYS user interface.&lt;br /&gt;
&lt;br /&gt;
===Backup requirements===&lt;br /&gt;
If entry level physical server or if virtual server that supports USB passthrough (e.g. VMWare vSphere version 4.1 and above):&lt;br /&gt;
&lt;br /&gt;
*3 x 16 GB USB drives for backup&lt;br /&gt;
*Someone to change the USB drives on a scheduled basis (weekly)&lt;br /&gt;
&lt;br /&gt;
If virtual server that does not support USB passthrough:&lt;br /&gt;
&lt;br /&gt;
*Client must *at their own responsibility* agree to arrange copy of the backup files to an external backup location every day.&lt;br /&gt;
&lt;br /&gt;
Also refer to [[Backup_and_Restore#Backup_in_virtual_server| Backup to virtual server]]&lt;br /&gt;
&lt;br /&gt;
===Router requirements===&lt;br /&gt;
&lt;br /&gt;
*Port forwarding:&lt;br /&gt;
**SSH: port 19581 (router) -&amp;gt; port 19581 (server) for Host.&lt;br /&gt;
**SSH: port 19582 (router) -&amp;gt; port 19582 (server) for lxc container.&lt;br /&gt;
**HTTPS: port 4431 (router) -&amp;gt; port 4431 (server) (Required only if NEOSYS needs to be accessed from outside office and prior management approval for this is obtained)&lt;br /&gt;
*Access to send email via an internal email server&lt;br /&gt;
&lt;br /&gt;
===Remote support requirement===&lt;br /&gt;
&lt;br /&gt;
[[Letter_to_obtain_agreement_of_client_IT_staff_to_provide_remote_access| Letter to obtain agreement of client IT staff to provide remote access]]&lt;/div&gt;</summary>
		<author><name>Gregory</name></author>
	</entry>
	<entry>
		<id>https://techwiki.neosys.com/index.php?title=Technical_/_Hardware_requirements&amp;diff=4031</id>
		<title>Technical / Hardware requirements</title>
		<link rel="alternate" type="text/html" href="https://techwiki.neosys.com/index.php?title=Technical_/_Hardware_requirements&amp;diff=4031"/>
		<updated>2023-10-12T11:25:05Z</updated>

		<summary type="html">&lt;p&gt;Gregory: /* Router requirements */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;===Hardware requirements===&lt;br /&gt;
&lt;br /&gt;
*Entry level physical or virtual server *dedicated to NEOSYS only* (in case of virtual machine, the host machine MUST be dedicated to NEOSYS and access given to support team, otherwise issues on the host machine will be untraceable by support team and NEOSYS will not be responsible for overall performance)&lt;br /&gt;
*1 x Quad core CPU (minimum)&lt;br /&gt;
*8 GB RAM (minimum)&lt;br /&gt;
*Minimum 100 GB HDD Enterprise Write intensive SSD (2 SSDs recommended, for mirroring)&lt;br /&gt;
&lt;br /&gt;
===Software requirements===&lt;br /&gt;
&lt;br /&gt;
*Ubuntu Server 22.04 LTS&lt;br /&gt;
*Configured with an internal static IP (ie dynamic IP delivered by DHCP is not allowed)&lt;br /&gt;
*Strictly no additional software installed&lt;br /&gt;
&lt;br /&gt;
===Web Browser on User Workstations===&lt;br /&gt;
&lt;br /&gt;
Firefox, Chrome or MS Edge.&lt;br /&gt;
&lt;br /&gt;
Browsers must have pop-up blockers turned off and must not have any 3rd party toolbars installed, that can potentially interfere with the NEOSYS user interface.&lt;br /&gt;
&lt;br /&gt;
===Backup requirements===&lt;br /&gt;
If entry level physical server or if virtual server that supports USB passthrough (e.g. VMWare vSphere version 4.1 and above):&lt;br /&gt;
&lt;br /&gt;
*3 x 16 GB USB drives for backup&lt;br /&gt;
*Someone to change the USB drives on a scheduled basis (weekly)&lt;br /&gt;
&lt;br /&gt;
If virtual server that does not support USB passthrough:&lt;br /&gt;
&lt;br /&gt;
*Client must *at their own responsibility* agree to arrange copy of the backup files to an external backup location every day.&lt;br /&gt;
&lt;br /&gt;
Also refer to [[Backup_and_Restore#Backup_in_virtual_server| Backup to virtual server]]&lt;br /&gt;
&lt;br /&gt;
===Router requirements===&lt;br /&gt;
&lt;br /&gt;
*Port forwarding:&lt;br /&gt;
**SSH: port 19581 (router) -&amp;gt; port 19581 (server) for Host.&lt;br /&gt;
**SSH: port 19582 (router) -&amp;gt; port 19582 (server) for lxc container.&lt;br /&gt;
**HTTPS: port 4431 (router) -&amp;gt; port 4431 (server) (Required only if NEOSYS needs to be accessed from outside office and prior management approval for this is obtained)&lt;br /&gt;
*Access to send email via an internal email server&lt;br /&gt;
&lt;br /&gt;
===Remote support requirement===&lt;br /&gt;
&lt;br /&gt;
[[Letter_to_obtain_agreement_of_client_IT_staff_to_provide_remote_access| Letter to obtain agreement of client IT staff to provide remote access]]&lt;/div&gt;</summary>
		<author><name>Gregory</name></author>
	</entry>
	<entry>
		<id>https://techwiki.neosys.com/index.php?title=Configuring_Thunderbird&amp;diff=4006</id>
		<title>Configuring Thunderbird</title>
		<link rel="alternate" type="text/html" href="https://techwiki.neosys.com/index.php?title=Configuring_Thunderbird&amp;diff=4006"/>
		<updated>2022-12-09T12:06:02Z</updated>

		<summary type="html">&lt;p&gt;Gregory: /* Getting access to NEOSYS support calendar */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
==Setting Up the Inbox Accounts==&lt;br /&gt;
&lt;br /&gt;
The instructions given below explain how to set up the &amp;quot;Support&amp;quot; account on Thunderbird.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
1. Open Mozilla Thunderbird. Choose the &amp;quot;Create a new account&amp;quot; option. Click on &amp;quot;Skip this and use my existing email&amp;quot; option on the &amp;quot;Welcome to Thunderbird&amp;quot; window.&lt;br /&gt;
&lt;br /&gt;
[[File:Thunderbird_1.jpg]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
2. In the Mail Account Setup window, enter &amp;quot;support@neosys.com&amp;quot; for Your Name, &amp;quot;support@neosys.com&amp;quot; for Email Address and the password provided by Neosys staff. Click on continue.&lt;br /&gt;
&lt;br /&gt;
[[File:Thunderbird_2.jpg]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
3. Click on &amp;quot;Manual Config&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
[[File:Thunderbird_3.jpg]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
4. Key in &amp;quot;imap.neosys.com&amp;quot; for incoming IMAP host name, server hostname &amp;quot;smtp.neosys.com&amp;quot; and port &amp;quot;587&amp;quot; for outgoing SMTP and &amp;quot;support.neosys&amp;quot; as username. For SMTP, change the SSL to &amp;quot;STARTTLS&amp;quot; and authentication to &amp;quot;No authentication&amp;quot;. Click on the &amp;quot;Re-test&amp;quot; button and then click &amp;quot;Done&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
[[File:Thunderbird_4.jpg]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
BEFORE clicking on inbox and BEFORE adding other inboxes, you MUST refer to [[Configuring_Thunderbird#Adding_email_accounts_with_large_numbers_of_emails | Adding email accounts with large numbers of emails]]. This is because if you add all the accounts together at once, they will all sync together and it will take 1-2 days for the sync to complete.&lt;br /&gt;
&lt;br /&gt;
For backups@neosys.com, support2@neosys.com (Nagios), name.neosys@gmail.com repeat the steps mentioned above, with the below-mentioned replacements.&lt;br /&gt;
&lt;br /&gt;
1. For backups@neosys.com, enter &amp;quot;backups@neosys.com&amp;quot; for Your Name, &amp;quot;backups@neosys.com&amp;quot; for Email address and enter the password provided by Neosys staff.&lt;br /&gt;
Enter the username as &amp;quot;backups.neosys&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
2. For support2@neosys.com, enter &amp;quot;support2@neosys.com&amp;quot; for Your Name, &amp;quot;support2@neosys.com&amp;quot; for Email address and enter the password provided by Neosys staff.&lt;br /&gt;
Enter the username as &amp;quot;support2.neosys&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
3. For name.neosys@gmail.com, enter your full name for Your Name, &amp;quot;name.neosys@gmail.com&amp;quot; for Email address and enter the password. You do not need to follow the steps for manual config as the settings will be automatically configured.&lt;br /&gt;
&lt;br /&gt;
[[File:thunderbird_6.jpg]]&lt;br /&gt;
&lt;br /&gt;
[[File:thunderbird_7.jpg]]&lt;br /&gt;
&lt;br /&gt;
==Account Settings==&lt;br /&gt;
&lt;br /&gt;
Verify that the account settings for all the accounts are entered as shown below.&lt;br /&gt;
&lt;br /&gt;
[[File:acsettings1.jpg]]&lt;br /&gt;
&lt;br /&gt;
[[File:acsettings2.jpg]]&lt;br /&gt;
&lt;br /&gt;
[[File:acsettings3.jpg]]&lt;br /&gt;
&lt;br /&gt;
[[File:acsettings4.jpg]]&lt;br /&gt;
&lt;br /&gt;
[[File:Account junk.jpg|500px]]&lt;br /&gt;
&lt;br /&gt;
For backups@neosys.com account, under &amp;quot;Synchronization and Storage&amp;quot;, change the setting to &amp;quot;Delete messages more than 365 days old&amp;quot;&lt;br /&gt;
&lt;br /&gt;
The Synchronisation &amp;amp; Storage settings should be changed to the settings shown below only at a convenient time, since downloading all the emails will take a lot of time for accounts with large number of emails. Also see [[Configuring_Thunderbird#Adding_email_accounts_with_large_numbers_of_emails |Adding email accounts with large number of emails]]&lt;br /&gt;
&lt;br /&gt;
[[File:acsettings6.jpg]]&lt;br /&gt;
&lt;br /&gt;
[[File:acsettings7.jpg]]&lt;br /&gt;
&lt;br /&gt;
[[File:acsettings8.jpg]]&lt;br /&gt;
&lt;br /&gt;
===Adding email accounts with large numbers of emails===&lt;br /&gt;
&lt;br /&gt;
After adding email accounts with large numbers of emails, in order to avoid long wait while downloading all the emails, it is best to change the account settings - BEFORE clicking on INBOX, which triggers the download/sync - to download the bodies of only the last 30 days of emails. The email headings are always synced but that does not take long.&lt;br /&gt;
&lt;br /&gt;
See Account Settings, Synchronisation and Storage.&lt;br /&gt;
&lt;br /&gt;
Since searching of emails only works when the bodies of emails have been downloaded, if you need to text search all emails, then, at a convenient time, you can remove or increase the number of days in the setting and somehow trigger the full sync.&lt;br /&gt;
&lt;br /&gt;
[[File:thla.jpg]]&lt;br /&gt;
&lt;br /&gt;
===Configuring Outgoing SMTP Mail Servers===&lt;br /&gt;
&lt;br /&gt;
By default Thunderbird adds a new smtp profile with each Inbox added.&lt;br /&gt;
&lt;br /&gt;
However you only need two, main and backup. &lt;br /&gt;
&lt;br /&gt;
1. Right click on any Inbox &amp;gt; Settings.&lt;br /&gt;
&lt;br /&gt;
2. Scroll down and click &amp;quot;Outgoing Server (SMTP)&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
3. Delete all smtp server profiles except the default and ensure your settings match below screenshot.&lt;br /&gt;
[[File:Smtpsettings.png]]&lt;br /&gt;
&lt;br /&gt;
4. Add a new profile with settings in below screenshot.&lt;br /&gt;
&lt;br /&gt;
TODO - setup backup imap2 container and add settings screenshot here. (old imap2 smtp port 2500)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Add-ons==&lt;br /&gt;
&lt;br /&gt;
#Install addons: General settings menu (Top right 3 bars) &amp;gt; Addons &lt;br /&gt;
#Search and install the addons in below screenshot.&lt;br /&gt;
#Configure Mailbox Alert by Right e.g support inbox &amp;gt; Mailbox Alert: &lt;br /&gt;
##Check default sound and message.&lt;br /&gt;
[[File:Addon2.png]]&lt;br /&gt;
&lt;br /&gt;
==Other General Configurations==&lt;br /&gt;
&lt;br /&gt;
===Configure inbox to display selected columns===&lt;br /&gt;
&lt;br /&gt;
The below options MUST be set in Support Inbox. To do so Right click on a column heading and select the below options:  &lt;br /&gt;
&lt;br /&gt;
#Thread&lt;br /&gt;
#Starred&lt;br /&gt;
#Attachment&lt;br /&gt;
#Subject&lt;br /&gt;
#Correspondents&lt;br /&gt;
#Received: You MUST add column RECEIVED which is the email date received to email inbox because the default Date seems to be the DATE SENT whereas we are primarily interested in the date we received the email. The difference is due to delays in email servers or spam tricks.&lt;br /&gt;
&lt;br /&gt;
The below options MUST NOT be set in Support Inbox&lt;br /&gt;
&lt;br /&gt;
#Junk status: Emails will automatically be moved to Junk folder if the junk icon in this column is clicked. Hence remove Junk Status column so that emails are not accidentally moved to junk. To remove, right-click on a column heading and untick &amp;quot;Junk Status&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
===Configure Mail Content===&lt;br /&gt;
&lt;br /&gt;
Preferences &amp;gt; Privacy &amp;gt; untick &amp;quot;Allow remote content in messages&amp;quot;&lt;br /&gt;
&lt;br /&gt;
Support MUST set the &amp;quot;Allow remote content in messages&amp;quot; as blocked in Thunderbird without adding any exceptions for any email id. The reason is remote content i.e embedded images, stylesheets etc is a privacy concern as it sends your private information to the mail sender. We do not know the source of these embedded content in emails so cannot trust them as they can be web bugs.&lt;br /&gt;
&lt;br /&gt;
===Configure Layout View===&lt;br /&gt;
&lt;br /&gt;
Layout view should be set as Vertical view.&lt;br /&gt;
&lt;br /&gt;
===Thunderbird Preferences===&lt;br /&gt;
&lt;br /&gt;
#Preferences &amp;gt; Display &amp;gt; Advanced &amp;gt; untick &amp;quot; Automatically mark messages as read&amp;quot;.&lt;br /&gt;
#Keep settings as below for Preferences &amp;gt; Security.&lt;br /&gt;
#Keep settings as below for Preferences &amp;gt; Composition &amp;gt; Spelling.&lt;br /&gt;
&lt;br /&gt;
[[File:Globaljunk.jpg|500px]]&lt;br /&gt;
&lt;br /&gt;
[[File:Composition.png|500px]]&lt;br /&gt;
&lt;br /&gt;
===Configure MailAlert===&lt;br /&gt;
&lt;br /&gt;
Right click Inbox &amp;gt; Mailbox Alert &amp;gt; Edit Mailbox Alert alerts &amp;gt; Select Default message. Set as below. Once set Right click Inbox &amp;gt; Mailbox Alert &amp;gt; check Default message&lt;br /&gt;
&lt;br /&gt;
[[file:thsh.jpg]]&lt;br /&gt;
&lt;br /&gt;
===Configure Auto Resize Image===&lt;br /&gt;
&lt;br /&gt;
Set the preferences for the Auto Resize Image add-on as shown in the screenshot at the end of this section.&lt;br /&gt;
&lt;br /&gt;
To handle different scenarios when resizing images in emails, follow the below steps:&lt;br /&gt;
&lt;br /&gt;
*Resize all images in the email: Click &amp;quot;Send&amp;quot; followed by &amp;quot;Confirm&amp;quot; on the Auto resize screen.&lt;br /&gt;
&lt;br /&gt;
*Skip resize all images in the email: Click &amp;quot;Send&amp;quot; followed by &amp;quot;Cancel Resizing&amp;quot; on the Auto resize screen.&lt;br /&gt;
&lt;br /&gt;
*Resize Images only in the email trail and skip resizing new images: Click &amp;quot;Resize&amp;quot; on top of your screen and proceed with writing the email/adding new images. When ready to send the email, follow above step for skipping resize all images in the email.&lt;br /&gt;
&lt;br /&gt;
[[File:Resize2.png]]&lt;br /&gt;
&lt;br /&gt;
===Configure Header Tools Lite===&lt;br /&gt;
&lt;br /&gt;
Set the preferences for the Header Tools Lite add-on as shown in the screenshot below.&lt;br /&gt;
&lt;br /&gt;
[[File:headertoolslite.jpg]]&lt;br /&gt;
&lt;br /&gt;
===Configure Dorando Keyconfig===&lt;br /&gt;
&lt;br /&gt;
Menu &amp;gt; Add-ons &amp;gt; Edit Keyconfig Preferences &amp;gt; Disable shortcuts for &#039;Archive&#039; and &#039;Junk&#039; as shown in the screenshots below.&lt;br /&gt;
&lt;br /&gt;
[[File:Keyconfig1.png]]&lt;br /&gt;
&lt;br /&gt;
[[File:Keyconfig2.png]]&lt;br /&gt;
&lt;br /&gt;
===Getting access to NEOSYS support calendar===&lt;br /&gt;
&lt;br /&gt;
After confirming that the steps below are successfully done, delete your local personal calendar and make the shared support calendar the default.&lt;br /&gt;
&lt;br /&gt;
In Thunderbird, add a new CalDAV network calendar by navigating to File (Alt+f) -&amp;gt; New -&amp;gt; Calendar.&lt;br /&gt;
&lt;br /&gt;
[[File:Cal1.png]]&lt;br /&gt;
&lt;br /&gt;
Location: https://nextcloud.hosts.neosys.com:44318/remote.php/dav/calendars/support/support_shared_by_steve/&lt;br /&gt;
&lt;br /&gt;
You will have to enter your nextcloud user and pass.&lt;br /&gt;
&lt;br /&gt;
[[File:Cal2.png]]&lt;br /&gt;
&lt;br /&gt;
[[File:Cal3.png]]&lt;br /&gt;
&lt;br /&gt;
It should show a tick if successful, otherwise you will have to Unsubscribe and try again.&lt;br /&gt;
&lt;br /&gt;
[[File:Cal4.png]]&lt;br /&gt;
&lt;br /&gt;
Change the new calendar properties to Refresh every 5 mins.&lt;br /&gt;
&lt;br /&gt;
[[File:Cal5.png]]&lt;br /&gt;
&lt;br /&gt;
===Applying filter for backup failure emails===&lt;br /&gt;
&lt;br /&gt;
In order to filter any backup failure emails as Important, go to Tools &amp;gt; Message Filters and create a new filter with settings as shown below:&lt;br /&gt;
&lt;br /&gt;
Refer to filters list of other staff members.&lt;br /&gt;
&lt;br /&gt;
===Tags===&lt;br /&gt;
&lt;br /&gt;
Find the prefs.js file in your profile directory:&lt;br /&gt;
 find ~/.thunderbird/ -name prefs.js &lt;br /&gt;
Edit the prefs.js file&lt;br /&gt;
 nano /home/gregory/.thunderbird/s3bqjf24.dsfaefawe/prefs.js&lt;br /&gt;
Replace the all the &amp;quot;user_pref(&amp;quot;mailnews.tags.&amp;quot; with the new set of tag configurations below and restart Thunderbird.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
user_pref(&amp;quot;mailnews.tags.$label1.color&amp;quot;, &amp;quot;#FF0000&amp;quot;);&lt;br /&gt;
user_pref(&amp;quot;mailnews.tags.$label1.tag&amp;quot;, &amp;quot;Important&amp;quot;);&lt;br /&gt;
user_pref(&amp;quot;mailnews.tags.$label2.color&amp;quot;, &amp;quot;#FF9900&amp;quot;);&lt;br /&gt;
user_pref(&amp;quot;mailnews.tags.$label2.tag&amp;quot;, &amp;quot;Work&amp;quot;);&lt;br /&gt;
user_pref(&amp;quot;mailnews.tags.$label3.color&amp;quot;, &amp;quot;#009900&amp;quot;);&lt;br /&gt;
user_pref(&amp;quot;mailnews.tags.$label3.tag&amp;quot;, &amp;quot;Joel&amp;quot;);&lt;br /&gt;
user_pref(&amp;quot;mailnews.tags.$label4.color&amp;quot;, &amp;quot;#3333ff&amp;quot;);&lt;br /&gt;
user_pref(&amp;quot;mailnews.tags.$label4.tag&amp;quot;, &amp;quot;Greg&amp;quot;);&lt;br /&gt;
user_pref(&amp;quot;mailnews.tags.$label5.color&amp;quot;, &amp;quot;#993399&amp;quot;);&lt;br /&gt;
user_pref(&amp;quot;mailnews.tags.$label5.tag&amp;quot;, &amp;quot;Arvind&amp;quot;);&lt;br /&gt;
user_pref(&amp;quot;mailnews.tags.$label6.color&amp;quot;, &amp;quot;#ff6e6e&amp;quot;);&lt;br /&gt;
user_pref(&amp;quot;mailnews.tags.$label6.tag&amp;quot;, &amp;quot;Follow up&amp;quot;);&lt;br /&gt;
user_pref(&amp;quot;mailnews.tags.$label7.color&amp;quot;, &amp;quot;#eb007b&amp;quot;);&lt;br /&gt;
user_pref(&amp;quot;mailnews.tags.$label7.tag&amp;quot;, &amp;quot;Client issue&amp;quot;);&lt;br /&gt;
user_pref(&amp;quot;mailnews.tags.$label8.color&amp;quot;, &amp;quot;#28e2d8&amp;quot;);&lt;br /&gt;
user_pref(&amp;quot;mailnews.tags.$label8.tag&amp;quot;, &amp;quot;Delay support&amp;quot;);&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==[[Procedures#Email_Retention_Policy| Email Retention Policy]]==&lt;br /&gt;
&lt;br /&gt;
==[[Procedures#Handling_junk.2Fspam_email| Handling junk/spam emails]]==&lt;br /&gt;
&lt;br /&gt;
==Viewing long running processes on Thunderbird==&lt;br /&gt;
When setting up and configuring Thunderbird, using its Activity Manager (Tools &amp;gt; Activity Manager) and possibly using the header bar &amp;quot;Always on top&amp;quot; option on the Activity Manager window may be helpful to know what long running processes are being performed.&lt;br /&gt;
&lt;br /&gt;
[[File:Activity manager.jpg]]&lt;br /&gt;
&lt;br /&gt;
==Deleting Thunderbird accounts==&lt;br /&gt;
Check the option &amp;quot;Remove Message Data&amp;quot; when removing accounts from Thunderbird. Otherwise, the old messages stay forever taking space on the disk.&lt;br /&gt;
&lt;br /&gt;
[[File:dt2.png]]&lt;br /&gt;
&lt;br /&gt;
Select Remove Message Data option as shown below.&lt;br /&gt;
&lt;br /&gt;
[[File:dt.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Clearing out old improperly deleted Thunderbird Accounts==&lt;br /&gt;
&lt;br /&gt;
If you delete Thunderbird accounts without checking the option &amp;quot;Remove Message Data&amp;quot; the old messages stay forever taking space on the disk.&lt;br /&gt;
&lt;br /&gt;
To locate any such unnecessary files&lt;br /&gt;
&lt;br /&gt;
 ls -l -h /home/*/.thunderbird/*.default/ImapMail/*/INBOX&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
-rw------- 1 arvind arvind  16M May 25 16:36 /home/arvind/.thunderbird/odi5mrka.default/ImapMail/imap.gmail.com/INBOX&lt;br /&gt;
-rw------- 1 arvind arvind 668M Mar 29 08:54 /home/arvind/.thunderbird/odi5mrka.default/ImapMail/imap.neosys-1.com/INBOX&lt;br /&gt;
-rw------- 1 arvind arvind 242M May 28 14:45 /home/arvind/.thunderbird/odi5mrka.default/ImapMail/imap.neosys-2.com/INBOX&lt;br /&gt;
-rw------- 1 arvind arvind 755M May 25 12:39 /home/arvind/.thunderbird/odi5mrka.default/ImapMail/imap.neosys-3.com/INBOX&lt;br /&gt;
-rw------- 1 arvind arvind 420M Apr 24 10:27 /home/arvind/.thunderbird/odi5mrka.default/ImapMail/imap.neosys-4.com/INBOX&lt;br /&gt;
-rw------- 1 arvind arvind  13G May 28 14:37 /home/arvind/.thunderbird/odi5mrka.default/ImapMail/imap.neosys.com/INBOX&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Check the dates, which indicate the date of the last message received, to get a rough idea of what accounts are in use and not in use&lt;br /&gt;
&lt;br /&gt;
Check which of the folders are currently in use by looking in Thunderbird settings for each account one by one, &amp;quot;Server Settings&amp;quot;, &amp;quot;Local Directory&amp;quot;&lt;br /&gt;
&lt;br /&gt;
Delete the folders and files which are not in use using whatever method you like.&lt;br /&gt;
&lt;br /&gt;
&amp;quot;.thunderbird&amp;quot;, like all files and folders which start with a dot, is a hidden folder which you can make visible in Nautilus File Manager by pressing Ctrl+h&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Troubleshooting high CPU usage when idling==&lt;br /&gt;
&lt;br /&gt;
If Thunderbird consumes 100+% CPU when there is no activity seen on Thunderbird activity manager (Tools -&amp;gt; Activity Manager), then try the below steps from https://kb.mozillazine.org/Performance_-_Thunderbird :&lt;br /&gt;
&lt;br /&gt;
#Go to Thunderbird preferences -&amp;gt; General &lt;br /&gt;
#Scroll to the bottom and click &amp;quot;Config Editor...&amp;quot;&lt;br /&gt;
#Search for mail.db.idle_limit&lt;br /&gt;
#Change its value to 30000000 (7 zeroes, not 5 zeroes) and save&lt;br /&gt;
#Restart Thunderbird&lt;/div&gt;</summary>
		<author><name>Gregory</name></author>
	</entry>
	<entry>
		<id>https://techwiki.neosys.com/index.php?title=EXODUS_Knowledge&amp;diff=4005</id>
		<title>EXODUS Knowledge</title>
		<link rel="alternate" type="text/html" href="https://techwiki.neosys.com/index.php?title=EXODUS_Knowledge&amp;diff=4005"/>
		<updated>2022-11-21T06:51:54Z</updated>

		<summary type="html">&lt;p&gt;Gregory: /* Debugging var values */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==TMUX Screens==&lt;br /&gt;
&lt;br /&gt;
To create the EXODUS maintenance/programming environment&lt;br /&gt;
 exodus#: ./tmux.exodus&lt;br /&gt;
&lt;br /&gt;
===Screens===&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
0: /&lt;br /&gt;
    General work for server services/configs. i.e /etc/nagios, /etc/apache2, /var/log/mail.log or general networking.&lt;br /&gt;
&lt;br /&gt;
1: /root/exodus/&lt;br /&gt;
    Exodus core is installed. Contains build and make libraries here ./libexodus&lt;br /&gt;
&lt;br /&gt;
2: /root/exodus/libexodus/exodus&lt;br /&gt;
    Core exodus library source code which emulate the AREV system e.g var.cpp&lt;br /&gt;
    &lt;br /&gt;
3: /root/exodus/cli/src&lt;br /&gt;
    Exodus Command Line Interface E.g edir, edic, list, listfiles, delete, createdb, deletedb.&lt;br /&gt;
    &lt;br /&gt;
4: root/exodus/service&lt;br /&gt;
    EXODUS core default host directory but also contains scripts that create/manage requirements of a service (create_service, create_db, create_site, backup_db, restore_db, start, stop, status)&lt;br /&gt;
    The www/3/exodus has generic .htm, php and .js which provide basic website functionality i.e Login page, Support Menu, User details, Authorization.&lt;br /&gt;
    NEOSYS www files linked into ./www, from /root/neosys/web, which pulled from NEOSYS www git.&lt;br /&gt;
&lt;br /&gt;
5: /root/exodus/service/src&lt;br /&gt;
    Exodus core service programs (programs that are not related to NEOSYS agency operations and can be used to support other non-NEOSYS services) eg listen, usersubs, sendmail, openfile, select, sort, list,.&lt;br /&gt;
&lt;br /&gt;
    Extra info:    &lt;br /&gt;
    The dat/ has generic dictionary files. (See Section Dictionaries &amp;amp; Psql Functions)&lt;br /&gt;
    TODO: compall currently throws few warnings. Read them and familiarise. In case new warnings appear, notify Steve.    &lt;br /&gt;
        &lt;br /&gt;
6: /root/neosys&lt;br /&gt;
    NEOSYS specific client installation &amp;amp; management scripts e.g .doall, import_db and import_files (from AREV), ./run ./test (see below for these two commands)&lt;br /&gt;
    &lt;br /&gt;
7: /root/neosys/src&lt;br /&gt;
    NEOSYS Agency programs (see section How AREV programs are distributed in EXODUS src/*.cpp&lt;br /&gt;
    /root/neosys has the neosys .git&lt;br /&gt;
&lt;br /&gt;
8: /root/hosts&lt;br /&gt;
    client specific files  e.g logs, images, (shared ./www -&amp;gt; root/exodus/service/www&lt;br /&gt;
&lt;br /&gt;
9: /root/exodus/test/src&lt;br /&gt;
    series of programs that test whether subroutines (specifically Exodus core libraries) work as they should eg for the var lib - &amp;quot;assert( var(&amp;quot;11111&amp;quot;).isnum());&amp;quot;&lt;br /&gt;
&lt;br /&gt;
10: bash /bin/top&lt;br /&gt;
    Monitor for NEOSYS client processes&lt;br /&gt;
    Displays customised format: sorted by total time spend and by processor time.&lt;br /&gt;
     Press &amp;quot;=&amp;quot; : to change to standard top format&lt;br /&gt;
     Press shift + w : to save format settings, replacing the old customised top format&lt;br /&gt;
     To go back to the customised format do:&lt;br /&gt;
        Press &amp;quot;o&amp;quot;&lt;br /&gt;
        Type &amp;quot;COMMAND=serve_agy&amp;quot;&lt;br /&gt;
        shift + t : this sorts by total time spent&lt;br /&gt;
        shift + p : this sorts by processor time&lt;br /&gt;
        shift + w : to save this setting and enter  &#039;y&#039; to confirm&lt;br /&gt;
&lt;br /&gt;
11: /var/log/syslog&lt;br /&gt;
     Log of NEOSYS client requests&lt;br /&gt;
&lt;br /&gt;
12: /root/exodus/service/quick&lt;br /&gt;
     Displays the last time the svr file (in /root/hosts/&amp;lt;client&amp;gt;/data/&amp;lt;dbname&amp;gt;) was updated.&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Object Code/Libraries==&lt;br /&gt;
LIVE and TEST processes use different sets of object code.&lt;br /&gt;
TEST processes use libraries in ~/lib/, whereas LIVE processes use object code in ~/neo/lib&lt;br /&gt;
&lt;br /&gt;
This means development &amp;amp; testing can be done stress free on TEST database, as opposed to testing on production databases.&lt;br /&gt;
&lt;br /&gt;
When compiling using edic, the TEST object code is updated if the compilation is successful. (~/lib)&lt;br /&gt;
&lt;br /&gt;
==Dictionaries &amp;amp; Psql Functions==&lt;br /&gt;
&lt;br /&gt;
Dictionaries - data used to describe other data; specifically the fields of other files. &lt;br /&gt;
&lt;br /&gt;
There are three types of fields: &amp;lt;pre&amp;gt;&lt;br /&gt;
(F) Field for raw data E.g &amp;quot;Office 44 Building Rush&amp;quot;&lt;br /&gt;
(S) Symbolic or calculated E.g for total ans=field1+field2&lt;br /&gt;
(G) General or Group E.g &amp;quot;@CRT&amp;quot; which contains always contains the default columns to show on the output of the list program; if no columns provided in list command.&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Show dictionary using &amp;quot;EXO_DATA=test list dict.clients&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
===Development and deployment using &#039;dat&#039; files===&lt;br /&gt;
&lt;br /&gt;
====Rationale====&lt;br /&gt;
&lt;br /&gt;
Part of system development is the creation of various data that is neither programs nor layout i.e. not cpp, h, html, js, php files etc.&lt;br /&gt;
&lt;br /&gt;
For example:&lt;br /&gt;
&lt;br /&gt;
*Dictionaries are data about data.&lt;br /&gt;
*Language files are data about text to use for various languages.&lt;br /&gt;
*“Change logs” are data about changes in the system.&lt;br /&gt;
&lt;br /&gt;
Historically, in EXODUS and NEOSYS, the above data has been deployed in exodus database files using SQL text files. However SQL files are not convenient for development.&lt;br /&gt;
&lt;br /&gt;
Therefore, &#039;dat&#039; text files will be used now so that standard development tools including editors and git can be fully exploited.&lt;br /&gt;
&lt;br /&gt;
====&#039;dat&#039; files====&lt;br /&gt;
&lt;br /&gt;
Each database file is represented by an os directory of the same name.&lt;br /&gt;
&lt;br /&gt;
Each record in the database file is represented by an os text file where filename is the primary key.&lt;br /&gt;
&lt;br /&gt;
For example a record with key &#039;&#039;&#039;DEADLINE&#039;&#039;&#039; in a dat file &#039;&#039;&#039;dict.materials&#039;&#039;&#039; would be represented as an os text file &#039;&#039;&#039;dat/dict.materials/DEADLINE&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Each line in the os text file represents one field in the db record. In other words, db record FM characters are represented by new line characters in &#039;dat&#039; files. Any actual new line characters required in the record, and any backslashes, are escaped and appear as &#039;\n&#039; and &#039;\\&#039; in &#039;dat&#039; files. Other database field separator characters such as VM, SM, TM and STM are stored without any conversion.&lt;br /&gt;
&lt;br /&gt;
====Location of dat files====&lt;br /&gt;
&lt;br /&gt;
The development versions are stored in exodus and neosys src/dat dirs. They form part of the standard git repositories in parallel with cpp files.&lt;br /&gt;
&lt;br /&gt;
The operational versions are stored in ~/dat and ~/live/dat alongside bin and lib dirs and are automatically installed into databases as database files on service startup. Any database functions embedded in the text files (pgsql) are also automatically installed at the same time.&lt;br /&gt;
&lt;br /&gt;
===Delete Database dictionary file===&lt;br /&gt;
&lt;br /&gt;
cli syncdat deletes database files if the dat dir is empty or contains a file &#039;SYNCDAT_DELETE&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
touch neosys/src/dat/dict.users/SYNC_DELETE&lt;br /&gt;
neosys/src~: syncdat&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====Editing and deploying a &#039;dat&#039; file====&lt;br /&gt;
&lt;br /&gt;
It is currently a three step process to edit and deploy such &#039;dat&#039; files. &lt;br /&gt;
&lt;br /&gt;
=====Edit the &#039;dat&#039; file (i.e dict.file record)=====&lt;br /&gt;
&lt;br /&gt;
Note that EXODUS service and NEOSYS service have different src/dat folders.&lt;br /&gt;
&lt;br /&gt;
Editing language items:&lt;br /&gt;
&lt;br /&gt;
 edir dat/alanguage/SCHEDULES*ARABIC&lt;br /&gt;
&lt;br /&gt;
Editing a dictionary item:&lt;br /&gt;
&lt;br /&gt;
 edir dat/dict.materials/DEADLINE&lt;br /&gt;
&lt;br /&gt;
Editing a pgsql function in a dictionary:&lt;br /&gt;
&lt;br /&gt;
 edir dat/dict.materials/DEADLINE 8&lt;br /&gt;
&lt;br /&gt;
=====Copy all &#039;dat&#039; files to ~/dat =====&lt;br /&gt;
&lt;br /&gt;
This step might be removed at a later date.&lt;br /&gt;
&lt;br /&gt;
This will cause all test databases to immediately restart and load any &#039;dat&#039; file changes into dictionaries and data files and also create any new or modified pgsql functions.&lt;br /&gt;
&lt;br /&gt;
If any ~/neosys/src/dat files were edited:&lt;br /&gt;
&lt;br /&gt;
 cd ~/neosys/src&lt;br /&gt;
 &lt;br /&gt;
 ./compall dat&lt;br /&gt;
&lt;br /&gt;
and/or, if exodus/service/dat files were edited&lt;br /&gt;
&lt;br /&gt;
 cd ~/exodus/service/src&lt;br /&gt;
 &lt;br /&gt;
 ./compall dat&lt;br /&gt;
&lt;br /&gt;
=====Copy all programs and &#039;dat&#039; files to ~/live/bin|lib|dat=====&lt;br /&gt;
&lt;br /&gt;
This should only be run after testing. It will cause all live databases to automatically restart and do the same as the test databases mentioned above.&lt;br /&gt;
&lt;br /&gt;
 cd ~/exodus/service&lt;br /&gt;
 &lt;br /&gt;
 ./copyall CONFIRM&lt;br /&gt;
&lt;br /&gt;
=====Delete dat record =====&lt;br /&gt;
&lt;br /&gt;
Simply open the corresponding dat file, remove all lines and save.&lt;br /&gt;
&lt;br /&gt;
===Psql unaccent extension===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The unaccent extension and the immutable_unaccent function are created in the db ‘template1’ during exodus installation while user is postgres which is a superuser.&lt;br /&gt;
&lt;br /&gt;
Thereafter all new databases are created as copies of template1 so they contain the extension and function&lt;br /&gt;
&lt;br /&gt;
====Error====&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
MVDBException:ERROR: function immutable_unaccent(text) does not exist&lt;br /&gt;
ERROR:  permission denied to create extension &amp;quot;unaccent&amp;quot;&lt;br /&gt;
HINT:  Must be superuser to create this extension. &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====Solution====&lt;br /&gt;
sudo -u postgres psql -c &#039;ALTER USER exodus WITH SUPERUSER;&#039;&lt;br /&gt;
&lt;br /&gt;
==Processes==&lt;br /&gt;
The TEST process for all database use the same object code stored in /root/lib, whereas all LIVE process use the object code in /root/neo/.&lt;br /&gt;
&lt;br /&gt;
==Postgres==&lt;br /&gt;
Connect into postgres shell:&lt;br /&gt;
 alias psql=&#039;sudo -u postgres psql&#039;&lt;br /&gt;
&lt;br /&gt;
Delete a database:&lt;br /&gt;
 sudo -u postgres dropdb &amp;lt;dbcode&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Debugging Exodus==&lt;br /&gt;
&lt;br /&gt;
===Debugging Live/Test services===&lt;br /&gt;
&lt;br /&gt;
./test &amp;lt;dbname&amp;gt; - execute test programs on _test database.&lt;br /&gt;
&lt;br /&gt;
./run &amp;lt;dbname&amp;gt;  - execute test programs on live database.&lt;br /&gt;
&lt;br /&gt;
===Debugging var values===&lt;br /&gt;
&lt;br /&gt;
Explanation of var flag value in gdb debug mode.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
(gdb) p varx                                                           &lt;br /&gt;
$2 = {var_str = &amp;quot;&amp;quot;, var_int = 0, var_dbl = 0, var_typ = {flags_ = 2}}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Each exodus var object contains 4 variables of type std::string (var_str), int (var_int), long double (var_dbl) and another int (var_typ i.e flags).&lt;br /&gt;
&lt;br /&gt;
The first 3 bits of var_typ (flags_) are used to signify which of the other variables are assigned.&lt;br /&gt;
&lt;br /&gt;
First bit = string is un/assigned. Second bit = int is un/assigned. Third bit = double un/assigned (a combination of these bits describes whether var_str/ var_int/ var_dbl are assigned.&lt;br /&gt;
&lt;br /&gt;
Examples: &lt;br /&gt;
&lt;br /&gt;
000 (binary) =  0 (decimal) = non are assigned.&lt;br /&gt;
&lt;br /&gt;
100 (binary) =  1 (decimal) = var_str is assigned. (var_int &amp;amp; var_dbl are not)&lt;br /&gt;
&lt;br /&gt;
010 (binary) =  2 (decimal) = var_int is assigned. (var_str &amp;amp; var_dbl are not)&lt;br /&gt;
&lt;br /&gt;
001 (binary) =  4 (decimal) = var_dbl is assigned. (var_str var_int are not)&lt;br /&gt;
&lt;br /&gt;
Combinations:&lt;br /&gt;
&lt;br /&gt;
110 (binary) =  3 (decimal) = var_str &amp;amp; var_int are assigned. (var_dbl is not)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
====To inspect a “common” variable====&lt;br /&gt;
&lt;br /&gt;
e,g, a variable called ba.ledgern&lt;br /&gt;
&lt;br /&gt;
 p ((subExodusProgram::&amp;lt;b&amp;gt;ba&amp;lt;/b&amp;gt;_common)&amp;lt;b&amp;gt;ba&amp;lt;/b&amp;gt;).&amp;lt;b&amp;gt;ledgern&amp;lt;/b&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====To inspect a common block====&lt;br /&gt;
&lt;br /&gt;
e.g. a common block ba&lt;br /&gt;
&lt;br /&gt;
 ptype (subExodusProgram::ba_common)ba&lt;br /&gt;
&lt;br /&gt;
====To dump all variables in a common====&lt;br /&gt;
&lt;br /&gt;
e.g all variables in ba&lt;br /&gt;
&lt;br /&gt;
 p (subExodusProgram::ba_common)ba&lt;br /&gt;
&lt;br /&gt;
====What types are available in a program?====&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;info types common&lt;br /&gt;
info types subExodus&lt;br /&gt;
info types libexodus&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====Other commands====&lt;br /&gt;
&lt;br /&gt;
 explore subExodusProgram::ba_common&lt;br /&gt;
&lt;br /&gt;
===Process Hung or consuming +100% CPU===&lt;br /&gt;
If process is consuming +100% CPU then it is likely stuck in an infinite loop.&lt;br /&gt;
&lt;br /&gt;
 ./doall &amp;lt;CLIENT&amp;gt; stop&lt;br /&gt;
&lt;br /&gt;
 ./run &amp;lt;CLIENT&amp;gt; &lt;br /&gt;
&lt;br /&gt;
 ./test &amp;lt;CLIENT&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Search through recent logs for &amp;lt;CLIENT&amp;gt; looking for requests that didn&#039;t return OK at the time nagios alerted of Hung process.&lt;br /&gt;
&lt;br /&gt;
A user may also instigate the error again, so monitor the CLIENT&#039;s service CPU usage.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
If cause found recreate it in test and once test process hit +100% break in test debugger.&lt;br /&gt;
&lt;br /&gt;
If cause not found, you will have to continue checking logs for the request that caused it or hope a user recreates the issue in live debugged service.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Once you&#039;ve broken in the debugged with the error, enter &amp;quot;n&amp;quot; and hold the enter key until you just seeing line repeat.&lt;br /&gt;
&lt;br /&gt;
Pay attention to start of loops code. E.g WHILE or FOR. (there is likely an error is there)&lt;br /&gt;
&lt;br /&gt;
==./doall==&lt;br /&gt;
====General====&lt;br /&gt;
&lt;br /&gt;
~/neosys/doall [LIVE|TEST] &amp;lt;DBCODE|ALL&amp;gt; &amp;lt; ACTION [OPTIONS,..]  | bash -- COMMAND ]&lt;br /&gt;
&lt;br /&gt;
Example: &lt;br /&gt;
 ./doall TEST ALL create_site t-&lt;br /&gt;
Result:&lt;br /&gt;
Create site for ALL TEST databases, using domain name prefix option &amp;quot;t-&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Screen 6: ./doall script contains all the necessary information(codes) to setup an installation.&lt;br /&gt;
It includes scripts to backup, restore, create an Apache site, create/start/stop/status a service, import an AREV database into postgres and more.&lt;br /&gt;
&lt;br /&gt;
====backup_db====&lt;br /&gt;
&lt;br /&gt;
*Does a backup &amp;amp; restore of a LIVE database into the corresponding TEST database.&lt;br /&gt;
*Backup &amp;lt;dbcode&amp;gt;.sql file is written to /root/backups/sql; which is rsynced to nl19:/backups/current/exodus/&lt;br /&gt;
*Unlike AREV, postgres can perform a &amp;quot;backup&amp;quot; of a database whilst the system is in use.&lt;br /&gt;
&lt;br /&gt;
==Git==&lt;br /&gt;
&lt;br /&gt;
There are two repositories, one for EXODUS and the other for NEOSYS.&lt;br /&gt;
&lt;br /&gt;
===Using git to make changes===&lt;br /&gt;
&lt;br /&gt;
Before following steps you must have a tested updated to a program/file/script. Do not commit untested changes to avoid a messy git history of reverts.&lt;br /&gt;
&lt;br /&gt;
Update your local repo before committing to local repo using the g alias for &amp;quot;git pull --ff-only ; git push &amp;amp;&amp;amp; git status&#039;&amp;quot;:&lt;br /&gt;
&amp;lt;pre&amp;gt;g&amp;lt;/pre&amp;gt;&lt;br /&gt;
Check which updates/files have not yet been staged and/or committed:&lt;br /&gt;
Add your updates to the staged area:&lt;br /&gt;
&amp;lt;pre&amp;gt;git add &amp;lt;filename&amp;gt;&amp;lt;/pre&amp;gt;&lt;br /&gt;
or if all the changes made need to be staged:&lt;br /&gt;
&amp;lt;pre&amp;gt;git add -a&amp;lt;/pre&amp;gt;&lt;br /&gt;
Make a commit with a descriptive message on purpose of updates:&lt;br /&gt;
&amp;lt;pre&amp;gt;git commit -m &amp;lt;description n purpose of changes&amp;gt;&amp;lt;/pre&amp;gt;&lt;br /&gt;
Again use g alias:&lt;br /&gt;
&amp;lt;pre&amp;gt;g&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Other useful git cmds===&lt;br /&gt;
&lt;br /&gt;
Do not use this commands unless you know what WILL happen. &lt;br /&gt;
*git pull - Instead use the safe &amp;quot;git pull --ff-only&amp;quot;&lt;br /&gt;
Stick to the alias &amp;quot;g&amp;quot; which does &amp;quot;git pull --ff-only ; git push &amp;amp;&amp;amp; git status&#039;&amp;quot;&lt;br /&gt;
&lt;br /&gt;
*git log - display history of commits to master branch&lt;br /&gt;
*git diff - display the differences in files between working files and files in local repo.&lt;br /&gt;
*git status - display: which updated files are staged/not staged(tracked)&lt;br /&gt;
*git stash - &lt;br /&gt;
*git branch - switch to a new branch&lt;br /&gt;
*git branch &amp;lt;branchname&amp;gt; - will switch to this branch only if it exists&lt;br /&gt;
*git checkout - DESTROYS/Updates the state of local working directory with the state of the files in the local repo. (YOU WILL LOSE non staged updates)&lt;br /&gt;
*git restore &amp;lt;filename&amp;gt; - DESTROYS/Updates the file with the version in the local repo. (like with git checkout but for a specific file)&lt;br /&gt;
*git checkin - &lt;br /&gt;
*git revert &amp;lt;commitHash&amp;gt; - reverses a specific commit (use git log to get the chosen commit hash)&lt;br /&gt;
*git ..&lt;br /&gt;
&lt;br /&gt;
==Converting AREV programs to EXODUS==&lt;br /&gt;
===Decompile AREV to C++===&lt;br /&gt;
&lt;br /&gt;
Do in Master AREV Installation Maintenance mode: (win7)&lt;br /&gt;
&lt;br /&gt;
#ATTACH ADECOMC &lt;br /&gt;
#*ADECOM &amp;lt;programname&amp;gt;   *single program&lt;br /&gt;
#*ADECOM &amp;lt;prog1&amp;gt; &amp;lt;prog2&amp;gt; &lt;br /&gt;
#*ADECOMALL              *all programs   (CHECK FIRST)&lt;br /&gt;
&lt;br /&gt;
Include the option &amp;quot;(V)&amp;quot; in the command to print the C++ to a notepad, which can easily be copy and pasted.&lt;br /&gt;
&lt;br /&gt;
===Getting C++ program to Exodus Installation===&lt;br /&gt;
&lt;br /&gt;
Two methods: (use the first for one off programs)&lt;br /&gt;
&lt;br /&gt;
====Copy &amp;amp; Paste====&lt;br /&gt;
&lt;br /&gt;
Compile program and open source code in notepad&lt;br /&gt;
&lt;br /&gt;
 ADECOM &amp;lt;programname&amp;gt; (V)&lt;br /&gt;
&lt;br /&gt;
Find which directory the program belongs. e.g fin/med/job/sys e.t&lt;br /&gt;
&lt;br /&gt;
 find /cygdrive/d/exodus/pickos | grep &amp;lt;program name&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If cpp in SYS, the program belongs in ~/exodus/service/src OR if in MED JOB FIN GEN AGY the program belongs in ~/neosys/src&lt;br /&gt;
&lt;br /&gt;
Copy the source code in the text file from the first command.&lt;br /&gt;
&lt;br /&gt;
In Exodus, create a new .cpp (in correct directory) and paste the source code.&lt;br /&gt;
&lt;br /&gt;
Compile &amp;amp; Test&lt;br /&gt;
&lt;br /&gt;
====Rsync====&lt;br /&gt;
&lt;br /&gt;
 /d/exodus/arev/syncup.sh&lt;br /&gt;
&lt;br /&gt;
If cpp in SYS then: ~/exodus/service/src ./getpickos&lt;br /&gt;
&lt;br /&gt;
If cpp in MED JOB FIN GEN AGY then: *~/neosys/src&lt;br /&gt;
&lt;br /&gt;
===Compile C++ files to TEST system===&lt;br /&gt;
&lt;br /&gt;
#*./test &amp;lt;DBNAME&amp;gt;&lt;br /&gt;
#*~/neosys ./doall TEST &amp;lt;DBNAME&amp;gt; restart    #to get one service to start start using the new lib files&lt;br /&gt;
#*~/neosys ./doall TEST all restart         #to get all the services to start start using the new lib files&lt;br /&gt;
&lt;br /&gt;
===Install C++ files to LIVE System===&lt;br /&gt;
&lt;br /&gt;
#~/exodus/service/ ./copyall            #to copy all the ~/lib and bin files to ~/live/lib and bin ... which is used by all exodus/live services&lt;br /&gt;
&lt;br /&gt;
==Writing Standard Exodus Core Function/Method Testing==&lt;br /&gt;
Screen 9: ~/exodus/test/src/&lt;br /&gt;
There are a series of test programs that check whether methods/functions behave as intended.&lt;br /&gt;
They do this using the function, assert.. a 1 or more argument values produce one and only one output)&lt;br /&gt;
&lt;br /&gt;
e.g test_multilang.cpp or test_sort.cpp&lt;br /&gt;
&lt;br /&gt;
Two methods of running test programs:&lt;br /&gt;
*Screen 9: make test&lt;br /&gt;
*after compiling using edic/compile/c, enter test_prog_name. (Since compile has moved it to ~/bin)&lt;br /&gt;
&lt;br /&gt;
Difference between the two methods is make calls gdb directly;&lt;br /&gt;
whereas ~/bin/test_prog_name uses exodus compile program&lt;br /&gt;
#~/neosys ./doall LIVE all restart&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Upgrading Exodus==&lt;br /&gt;
&lt;br /&gt;
#Develop patch in Dev system &lt;br /&gt;
&lt;br /&gt;
===Patching neosys/src or exodus/service/src===&lt;br /&gt;
&lt;br /&gt;
#Manually insert patches and compile into test programs.&lt;br /&gt;
#If patch dat files then run neosys/compall to get dat files into ~/dat&lt;br /&gt;
*If Patsalides:&lt;br /&gt;
*#SITE_DIR=ptcy ./test basic &lt;br /&gt;
*#login to BASIC_TEST and test&lt;br /&gt;
*Other clients:&lt;br /&gt;
*#./test DBCODE&lt;br /&gt;
*#login to DBCODE and test patches works&lt;br /&gt;
#run exodus/service/copyall and check only the patched programs are listed. (if not, see Troubleshoot below)&lt;br /&gt;
#Inform users to log off for 10mins. As a rule of thumb, live services must be stopped before copying test programs to live.&lt;br /&gt;
#exodus/service/copyall CONFIRM&lt;br /&gt;
&lt;br /&gt;
====Troubleshoot====&lt;br /&gt;
&lt;br /&gt;
=====./copyall lists programs you have not patched=====&lt;br /&gt;
Use exodus/service/copyone to copy only your patched programs one by one. (./copyone will not copy dat files)&lt;br /&gt;
&lt;br /&gt;
===Upgrading to new version===&lt;br /&gt;
&lt;br /&gt;
READ: remember there is no test version of libexodus programs. This means that if libexodus programs are compiled and installed, neosys/src and exodus/services LIVE programs MUST BE UPGRADED.&lt;br /&gt;
&lt;br /&gt;
#Upgrade test system to test&lt;br /&gt;
##If a dev system like de2, git stash any uncommitted changes other staff may be working on.&lt;br /&gt;
##Run &amp;quot;g&amp;quot; in ~/exodus (to do git pull --ff-only)&lt;br /&gt;
##Run &amp;quot;m&amp;quot; in ~/exodus (to compile and install libexodus)&lt;br /&gt;
##Run &amp;quot;~/neosys/upgrade.all.sh live&amp;quot; in ~/neosys (to upgrade exodus/service and neosys/src live programs)&lt;br /&gt;
##Begin testing&lt;br /&gt;
#Upgrade clients&lt;br /&gt;
##*Client hosted - Schedule a planned upgrade with client.&lt;br /&gt;
##*NEOSYS hosted - Inform all clients/users of planned morning upgrade, 24hours in advanced.      (TODO: &#039;What&#039;s New in NEOSYS&#039;) AND (emailallusers.cpp)&lt;br /&gt;
##Day of upgrade, check USB backup was successful &amp;amp; make a container snapshot, otherwise do not proceed.&lt;br /&gt;
##Stop services&lt;br /&gt;
##Run &amp;quot;g&amp;quot; in ~/exodus (to do git pull --ff-only)&lt;br /&gt;
##Run &amp;quot;m&amp;quot; in ~/exodus (to compile and install libexodus)&lt;br /&gt;
##Run &amp;quot;~/neosys/upgrade.all.sh live&amp;quot;. &lt;br /&gt;
##Check services started automatically without issues.&lt;br /&gt;
#Inform users their system has been upgraded and they can login.&lt;br /&gt;
&lt;br /&gt;
===Roll Back Upgrade===&lt;br /&gt;
&lt;br /&gt;
If for any reason the entire upgrade needs to be reverted (excludes clients database), follow steps below:&lt;br /&gt;
&lt;br /&gt;
#Inform users that there is a problem and services need to be stopped.&lt;br /&gt;
#Stop all exodus processes.&lt;br /&gt;
#Restore the morning&#039;s USB backup by: (Note this backup contains:  source/obj code, /etc, neosys scripts but not client data)&lt;br /&gt;
##Login into container&#039;s host and rsync the morning&#039;s usb backup to the container&#039;s /:&lt;br /&gt;
#*&amp;lt;pre&amp;gt;rsync --dry-run -avz -e &#039;ssh -p &amp;lt;C_SSHPORT&amp;gt;&#039; /backups/usb/&amp;lt;C_CODE&amp;gt; &amp;lt;C_CODE&amp;gt;:/      (Example: rsync --dry-run -avz -e &#039;ssh -p 19582&#039; /backups/usb/ad1 ad1:/&amp;lt;/pre&amp;gt;)&lt;br /&gt;
#Quick sane check, the latest git commit is not the latest git commit in the remote repo.&lt;br /&gt;
#Inform users they can login.&lt;br /&gt;
&lt;br /&gt;
==Configuring services to autostart during login==&lt;br /&gt;
For Ptcy.&lt;br /&gt;
&lt;br /&gt;
#Create a file &#039;autostart.cfg&#039; in the data folder &lt;br /&gt;
&lt;br /&gt;
 touch /root/hosts/&amp;lt;dbname&amp;gt;/data/autostart.cfg&lt;br /&gt;
&lt;br /&gt;
This will autostart a database service as long as at least one database service in that directory is running.&lt;br /&gt;
&lt;br /&gt;
For example, demo service will autostart during login if,&lt;br /&gt;
#/root/hosts/demo/data/autostart.cfg exists and&lt;br /&gt;
#demo_test service is running&lt;br /&gt;
&lt;br /&gt;
==Speedup postgresql importing databases==&lt;br /&gt;
&lt;br /&gt;
Can be sped up by a factor of 10 BUT may result in corrupt files in case of hard OS crash where the dirty memory is not flushed to storage.&lt;br /&gt;
&lt;br /&gt;
Therefore it is advisable to use this feature only briefly and REMEMBER TO REMOVE IT! &lt;br /&gt;
&lt;br /&gt;
Email to support@neosys.com whenever using it or use personal notes not memory.&lt;br /&gt;
&lt;br /&gt;
nano /etc/postgresql/12/main/postgresql.conf&lt;br /&gt;
&lt;br /&gt;
Uncomment or add a line&lt;br /&gt;
 fsync = off&lt;br /&gt;
Restart postgres … will break any neosys/exodus running processes.&lt;br /&gt;
 r postgresql&lt;br /&gt;
or reload postgres may also work&lt;br /&gt;
&lt;br /&gt;
==Database Attach==&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
root@exodus:~/exodus/cli/src# dbattach&lt;br /&gt;
dbattach - Attach foreign database files to the current default database&lt;br /&gt;
&lt;br /&gt;
Syntax is dbattach TARGETDB [FILENAME,...] {OPTION...}&lt;br /&gt;
&lt;br /&gt;
Options:&lt;br /&gt;
&lt;br /&gt;
  F   Forcibly delete any normal files in the current default database.&lt;br /&gt;
&lt;br /&gt;
  R   Detach foreign files&lt;br /&gt;
  RR  Remove foreign database connection.&lt;br /&gt;
  RRR Remove all foreign database connections and attachments.&lt;br /&gt;
&lt;br /&gt;
  L   List attached foreign files in the current default database&lt;br /&gt;
&lt;br /&gt;
If no filenames are provided then a database connection is created.&lt;br /&gt;
This is *required* before filenames can be provided and attached.&lt;br /&gt;
&lt;br /&gt;
Notes:&lt;br /&gt;
&lt;br /&gt;
Attachments are permanent until re-attached or removed.&lt;br /&gt;
&lt;br /&gt;
Indexes on attached files behave strangely.&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Issues:&lt;br /&gt;
&lt;br /&gt;
TARGETDB must be on the same connection as the current default database.&lt;br /&gt;
&lt;br /&gt;
Current user must have access to the foreign database.&lt;br /&gt;
&lt;br /&gt;
If EXO_USER and EXO_PASS are not set then exodus defaults are used.&lt;br /&gt;
&lt;br /&gt;
exodus .config file is not used currently.&lt;/div&gt;</summary>
		<author><name>Gregory</name></author>
	</entry>
	<entry>
		<id>https://techwiki.neosys.com/index.php?title=EXODUS_Knowledge&amp;diff=4004</id>
		<title>EXODUS Knowledge</title>
		<link rel="alternate" type="text/html" href="https://techwiki.neosys.com/index.php?title=EXODUS_Knowledge&amp;diff=4004"/>
		<updated>2022-11-21T06:35:35Z</updated>

		<summary type="html">&lt;p&gt;Gregory: Improvement to var description&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==TMUX Screens==&lt;br /&gt;
&lt;br /&gt;
To create the EXODUS maintenance/programming environment&lt;br /&gt;
 exodus#: ./tmux.exodus&lt;br /&gt;
&lt;br /&gt;
===Screens===&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
0: /&lt;br /&gt;
    General work for server services/configs. i.e /etc/nagios, /etc/apache2, /var/log/mail.log or general networking.&lt;br /&gt;
&lt;br /&gt;
1: /root/exodus/&lt;br /&gt;
    Exodus core is installed. Contains build and make libraries here ./libexodus&lt;br /&gt;
&lt;br /&gt;
2: /root/exodus/libexodus/exodus&lt;br /&gt;
    Core exodus library source code which emulate the AREV system e.g var.cpp&lt;br /&gt;
    &lt;br /&gt;
3: /root/exodus/cli/src&lt;br /&gt;
    Exodus Command Line Interface E.g edir, edic, list, listfiles, delete, createdb, deletedb.&lt;br /&gt;
    &lt;br /&gt;
4: root/exodus/service&lt;br /&gt;
    EXODUS core default host directory but also contains scripts that create/manage requirements of a service (create_service, create_db, create_site, backup_db, restore_db, start, stop, status)&lt;br /&gt;
    The www/3/exodus has generic .htm, php and .js which provide basic website functionality i.e Login page, Support Menu, User details, Authorization.&lt;br /&gt;
    NEOSYS www files linked into ./www, from /root/neosys/web, which pulled from NEOSYS www git.&lt;br /&gt;
&lt;br /&gt;
5: /root/exodus/service/src&lt;br /&gt;
    Exodus core service programs (programs that are not related to NEOSYS agency operations and can be used to support other non-NEOSYS services) eg listen, usersubs, sendmail, openfile, select, sort, list,.&lt;br /&gt;
&lt;br /&gt;
    Extra info:    &lt;br /&gt;
    The dat/ has generic dictionary files. (See Section Dictionaries &amp;amp; Psql Functions)&lt;br /&gt;
    TODO: compall currently throws few warnings. Read them and familiarise. In case new warnings appear, notify Steve.    &lt;br /&gt;
        &lt;br /&gt;
6: /root/neosys&lt;br /&gt;
    NEOSYS specific client installation &amp;amp; management scripts e.g .doall, import_db and import_files (from AREV), ./run ./test (see below for these two commands)&lt;br /&gt;
    &lt;br /&gt;
7: /root/neosys/src&lt;br /&gt;
    NEOSYS Agency programs (see section How AREV programs are distributed in EXODUS src/*.cpp&lt;br /&gt;
    /root/neosys has the neosys .git&lt;br /&gt;
&lt;br /&gt;
8: /root/hosts&lt;br /&gt;
    client specific files  e.g logs, images, (shared ./www -&amp;gt; root/exodus/service/www&lt;br /&gt;
&lt;br /&gt;
9: /root/exodus/test/src&lt;br /&gt;
    series of programs that test whether subroutines (specifically Exodus core libraries) work as they should eg for the var lib - &amp;quot;assert( var(&amp;quot;11111&amp;quot;).isnum());&amp;quot;&lt;br /&gt;
&lt;br /&gt;
10: bash /bin/top&lt;br /&gt;
    Monitor for NEOSYS client processes&lt;br /&gt;
    Displays customised format: sorted by total time spend and by processor time.&lt;br /&gt;
     Press &amp;quot;=&amp;quot; : to change to standard top format&lt;br /&gt;
     Press shift + w : to save format settings, replacing the old customised top format&lt;br /&gt;
     To go back to the customised format do:&lt;br /&gt;
        Press &amp;quot;o&amp;quot;&lt;br /&gt;
        Type &amp;quot;COMMAND=serve_agy&amp;quot;&lt;br /&gt;
        shift + t : this sorts by total time spent&lt;br /&gt;
        shift + p : this sorts by processor time&lt;br /&gt;
        shift + w : to save this setting and enter  &#039;y&#039; to confirm&lt;br /&gt;
&lt;br /&gt;
11: /var/log/syslog&lt;br /&gt;
     Log of NEOSYS client requests&lt;br /&gt;
&lt;br /&gt;
12: /root/exodus/service/quick&lt;br /&gt;
     Displays the last time the svr file (in /root/hosts/&amp;lt;client&amp;gt;/data/&amp;lt;dbname&amp;gt;) was updated.&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Object Code/Libraries==&lt;br /&gt;
LIVE and TEST processes use different sets of object code.&lt;br /&gt;
TEST processes use libraries in ~/lib/, whereas LIVE processes use object code in ~/neo/lib&lt;br /&gt;
&lt;br /&gt;
This means development &amp;amp; testing can be done stress free on TEST database, as opposed to testing on production databases.&lt;br /&gt;
&lt;br /&gt;
When compiling using edic, the TEST object code is updated if the compilation is successful. (~/lib)&lt;br /&gt;
&lt;br /&gt;
==Dictionaries &amp;amp; Psql Functions==&lt;br /&gt;
&lt;br /&gt;
Dictionaries - data used to describe other data; specifically the fields of other files. &lt;br /&gt;
&lt;br /&gt;
There are three types of fields: &amp;lt;pre&amp;gt;&lt;br /&gt;
(F) Field for raw data E.g &amp;quot;Office 44 Building Rush&amp;quot;&lt;br /&gt;
(S) Symbolic or calculated E.g for total ans=field1+field2&lt;br /&gt;
(G) General or Group E.g &amp;quot;@CRT&amp;quot; which contains always contains the default columns to show on the output of the list program; if no columns provided in list command.&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Show dictionary using &amp;quot;EXO_DATA=test list dict.clients&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
===Development and deployment using &#039;dat&#039; files===&lt;br /&gt;
&lt;br /&gt;
====Rationale====&lt;br /&gt;
&lt;br /&gt;
Part of system development is the creation of various data that is neither programs nor layout i.e. not cpp, h, html, js, php files etc.&lt;br /&gt;
&lt;br /&gt;
For example:&lt;br /&gt;
&lt;br /&gt;
*Dictionaries are data about data.&lt;br /&gt;
*Language files are data about text to use for various languages.&lt;br /&gt;
*“Change logs” are data about changes in the system.&lt;br /&gt;
&lt;br /&gt;
Historically, in EXODUS and NEOSYS, the above data has been deployed in exodus database files using SQL text files. However SQL files are not convenient for development.&lt;br /&gt;
&lt;br /&gt;
Therefore, &#039;dat&#039; text files will be used now so that standard development tools including editors and git can be fully exploited.&lt;br /&gt;
&lt;br /&gt;
====&#039;dat&#039; files====&lt;br /&gt;
&lt;br /&gt;
Each database file is represented by an os directory of the same name.&lt;br /&gt;
&lt;br /&gt;
Each record in the database file is represented by an os text file where filename is the primary key.&lt;br /&gt;
&lt;br /&gt;
For example a record with key &#039;&#039;&#039;DEADLINE&#039;&#039;&#039; in a dat file &#039;&#039;&#039;dict.materials&#039;&#039;&#039; would be represented as an os text file &#039;&#039;&#039;dat/dict.materials/DEADLINE&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Each line in the os text file represents one field in the db record. In other words, db record FM characters are represented by new line characters in &#039;dat&#039; files. Any actual new line characters required in the record, and any backslashes, are escaped and appear as &#039;\n&#039; and &#039;\\&#039; in &#039;dat&#039; files. Other database field separator characters such as VM, SM, TM and STM are stored without any conversion.&lt;br /&gt;
&lt;br /&gt;
====Location of dat files====&lt;br /&gt;
&lt;br /&gt;
The development versions are stored in exodus and neosys src/dat dirs. They form part of the standard git repositories in parallel with cpp files.&lt;br /&gt;
&lt;br /&gt;
The operational versions are stored in ~/dat and ~/live/dat alongside bin and lib dirs and are automatically installed into databases as database files on service startup. Any database functions embedded in the text files (pgsql) are also automatically installed at the same time.&lt;br /&gt;
&lt;br /&gt;
===Delete Database dictionary file===&lt;br /&gt;
&lt;br /&gt;
cli syncdat deletes database files if the dat dir is empty or contains a file &#039;SYNCDAT_DELETE&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
touch neosys/src/dat/dict.users/SYNC_DELETE&lt;br /&gt;
neosys/src~: syncdat&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====Editing and deploying a &#039;dat&#039; file====&lt;br /&gt;
&lt;br /&gt;
It is currently a three step process to edit and deploy such &#039;dat&#039; files. &lt;br /&gt;
&lt;br /&gt;
=====Edit the &#039;dat&#039; file (i.e dict.file record)=====&lt;br /&gt;
&lt;br /&gt;
Note that EXODUS service and NEOSYS service have different src/dat folders.&lt;br /&gt;
&lt;br /&gt;
Editing language items:&lt;br /&gt;
&lt;br /&gt;
 edir dat/alanguage/SCHEDULES*ARABIC&lt;br /&gt;
&lt;br /&gt;
Editing a dictionary item:&lt;br /&gt;
&lt;br /&gt;
 edir dat/dict.materials/DEADLINE&lt;br /&gt;
&lt;br /&gt;
Editing a pgsql function in a dictionary:&lt;br /&gt;
&lt;br /&gt;
 edir dat/dict.materials/DEADLINE 8&lt;br /&gt;
&lt;br /&gt;
=====Copy all &#039;dat&#039; files to ~/dat =====&lt;br /&gt;
&lt;br /&gt;
This step might be removed at a later date.&lt;br /&gt;
&lt;br /&gt;
This will cause all test databases to immediately restart and load any &#039;dat&#039; file changes into dictionaries and data files and also create any new or modified pgsql functions.&lt;br /&gt;
&lt;br /&gt;
If any ~/neosys/src/dat files were edited:&lt;br /&gt;
&lt;br /&gt;
 cd ~/neosys/src&lt;br /&gt;
 &lt;br /&gt;
 ./compall dat&lt;br /&gt;
&lt;br /&gt;
and/or, if exodus/service/dat files were edited&lt;br /&gt;
&lt;br /&gt;
 cd ~/exodus/service/src&lt;br /&gt;
 &lt;br /&gt;
 ./compall dat&lt;br /&gt;
&lt;br /&gt;
=====Copy all programs and &#039;dat&#039; files to ~/live/bin|lib|dat=====&lt;br /&gt;
&lt;br /&gt;
This should only be run after testing. It will cause all live databases to automatically restart and do the same as the test databases mentioned above.&lt;br /&gt;
&lt;br /&gt;
 cd ~/exodus/service&lt;br /&gt;
 &lt;br /&gt;
 ./copyall CONFIRM&lt;br /&gt;
&lt;br /&gt;
=====Delete dat record =====&lt;br /&gt;
&lt;br /&gt;
Simply open the corresponding dat file, remove all lines and save.&lt;br /&gt;
&lt;br /&gt;
===Psql unaccent extension===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The unaccent extension and the immutable_unaccent function are created in the db ‘template1’ during exodus installation while user is postgres which is a superuser.&lt;br /&gt;
&lt;br /&gt;
Thereafter all new databases are created as copies of template1 so they contain the extension and function&lt;br /&gt;
&lt;br /&gt;
====Error====&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
MVDBException:ERROR: function immutable_unaccent(text) does not exist&lt;br /&gt;
ERROR:  permission denied to create extension &amp;quot;unaccent&amp;quot;&lt;br /&gt;
HINT:  Must be superuser to create this extension. &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====Solution====&lt;br /&gt;
sudo -u postgres psql -c &#039;ALTER USER exodus WITH SUPERUSER;&#039;&lt;br /&gt;
&lt;br /&gt;
==Processes==&lt;br /&gt;
The TEST process for all database use the same object code stored in /root/lib, whereas all LIVE process use the object code in /root/neo/.&lt;br /&gt;
&lt;br /&gt;
==Postgres==&lt;br /&gt;
Connect into postgres shell:&lt;br /&gt;
 alias psql=&#039;sudo -u postgres psql&#039;&lt;br /&gt;
&lt;br /&gt;
Delete a database:&lt;br /&gt;
 sudo -u postgres dropdb &amp;lt;dbcode&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Debugging Exodus==&lt;br /&gt;
&lt;br /&gt;
===Debugging Live/Test services===&lt;br /&gt;
&lt;br /&gt;
./test &amp;lt;dbname&amp;gt; - execute test programs on _test database.&lt;br /&gt;
&lt;br /&gt;
./run &amp;lt;dbname&amp;gt;  - execute test programs on live database.&lt;br /&gt;
&lt;br /&gt;
===Debugging var values===&lt;br /&gt;
&lt;br /&gt;
Explanation of var flag value in gdb debug mode.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
(gdb) p varx                                                           &lt;br /&gt;
$2 = {var_str = &amp;quot;&amp;quot;, var_int = 0, var_dbl = 0, var_typ = {flags_ = 2}}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Each exodus var object contains 4 variables of type std::string (var_str), int (var_int), long double (var_dbl) and another int (var_typ i.e flags).&lt;br /&gt;
&lt;br /&gt;
The first 3 bits of var_typ (flags_) are used to signify which of the other variables are assigned.&lt;br /&gt;
&lt;br /&gt;
First bit = string is un/assigned. Second bit = int is un/assigned. Third bit = double un/assigned (a combination of these bits describes whether var_str/ var_int/ var_dbl are assigned.&lt;br /&gt;
&lt;br /&gt;
Examples: &lt;br /&gt;
&lt;br /&gt;
000 (binary) =  0 (decimal) = non are assigned.&lt;br /&gt;
&lt;br /&gt;
110 (binary) =  3 (decimal) = var_str &amp;amp; var_int are assigned.&lt;br /&gt;
&lt;br /&gt;
001 (binary) =  4 (decimal) = var_dbl is assigned.&lt;br /&gt;
&lt;br /&gt;
====To inspect a “common” variable====&lt;br /&gt;
&lt;br /&gt;
e,g, a variable called ba.ledgern&lt;br /&gt;
&lt;br /&gt;
 p ((subExodusProgram::ba_common)ba).ledgern&lt;br /&gt;
&lt;br /&gt;
====To inspect a common block====&lt;br /&gt;
&lt;br /&gt;
e.g. a common block ba&lt;br /&gt;
&lt;br /&gt;
 ptype (subExodusProgram::ba_common)ba&lt;br /&gt;
&lt;br /&gt;
====To dump all variables in a common====&lt;br /&gt;
&lt;br /&gt;
e.g all variables in ba&lt;br /&gt;
&lt;br /&gt;
 p (subExodusProgram::ba_common)ba&lt;br /&gt;
&lt;br /&gt;
====What types are available in a program?====&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;info types common&lt;br /&gt;
info types subExodus&lt;br /&gt;
info types libexodus&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====Other commands====&lt;br /&gt;
&lt;br /&gt;
 explore subExodusProgram::ba_common&lt;br /&gt;
&lt;br /&gt;
===Process Hung or consuming +100% CPU===&lt;br /&gt;
If process is consuming +100% CPU then it is likely stuck in an infinite loop.&lt;br /&gt;
&lt;br /&gt;
 ./doall &amp;lt;CLIENT&amp;gt; stop&lt;br /&gt;
&lt;br /&gt;
 ./run &amp;lt;CLIENT&amp;gt; &lt;br /&gt;
&lt;br /&gt;
 ./test &amp;lt;CLIENT&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Search through recent logs for &amp;lt;CLIENT&amp;gt; looking for requests that didn&#039;t return OK at the time nagios alerted of Hung process.&lt;br /&gt;
&lt;br /&gt;
A user may also instigate the error again, so monitor the CLIENT&#039;s service CPU usage.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
If cause found recreate it in test and once test process hit +100% break in test debugger.&lt;br /&gt;
&lt;br /&gt;
If cause not found, you will have to continue checking logs for the request that caused it or hope a user recreates the issue in live debugged service.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Once you&#039;ve broken in the debugged with the error, enter &amp;quot;n&amp;quot; and hold the enter key until you just seeing line repeat.&lt;br /&gt;
&lt;br /&gt;
Pay attention to start of loops code. E.g WHILE or FOR. (there is likely an error is there)&lt;br /&gt;
&lt;br /&gt;
==./doall==&lt;br /&gt;
====General====&lt;br /&gt;
&lt;br /&gt;
~/neosys/doall [LIVE|TEST] &amp;lt;DBCODE|ALL&amp;gt; &amp;lt; ACTION [OPTIONS,..]  | bash -- COMMAND ]&lt;br /&gt;
&lt;br /&gt;
Example: &lt;br /&gt;
 ./doall TEST ALL create_site t-&lt;br /&gt;
Result:&lt;br /&gt;
Create site for ALL TEST databases, using domain name prefix option &amp;quot;t-&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Screen 6: ./doall script contains all the necessary information(codes) to setup an installation.&lt;br /&gt;
It includes scripts to backup, restore, create an Apache site, create/start/stop/status a service, import an AREV database into postgres and more.&lt;br /&gt;
&lt;br /&gt;
====backup_db====&lt;br /&gt;
&lt;br /&gt;
*Does a backup &amp;amp; restore of a LIVE database into the corresponding TEST database.&lt;br /&gt;
*Backup &amp;lt;dbcode&amp;gt;.sql file is written to /root/backups/sql; which is rsynced to nl19:/backups/current/exodus/&lt;br /&gt;
*Unlike AREV, postgres can perform a &amp;quot;backup&amp;quot; of a database whilst the system is in use.&lt;br /&gt;
&lt;br /&gt;
==Git==&lt;br /&gt;
&lt;br /&gt;
There are two repositories, one for EXODUS and the other for NEOSYS.&lt;br /&gt;
&lt;br /&gt;
===Using git to make changes===&lt;br /&gt;
&lt;br /&gt;
Before following steps you must have a tested updated to a program/file/script. Do not commit untested changes to avoid a messy git history of reverts.&lt;br /&gt;
&lt;br /&gt;
Update your local repo before committing to local repo using the g alias for &amp;quot;git pull --ff-only ; git push &amp;amp;&amp;amp; git status&#039;&amp;quot;:&lt;br /&gt;
&amp;lt;pre&amp;gt;g&amp;lt;/pre&amp;gt;&lt;br /&gt;
Check which updates/files have not yet been staged and/or committed:&lt;br /&gt;
Add your updates to the staged area:&lt;br /&gt;
&amp;lt;pre&amp;gt;git add &amp;lt;filename&amp;gt;&amp;lt;/pre&amp;gt;&lt;br /&gt;
or if all the changes made need to be staged:&lt;br /&gt;
&amp;lt;pre&amp;gt;git add -a&amp;lt;/pre&amp;gt;&lt;br /&gt;
Make a commit with a descriptive message on purpose of updates:&lt;br /&gt;
&amp;lt;pre&amp;gt;git commit -m &amp;lt;description n purpose of changes&amp;gt;&amp;lt;/pre&amp;gt;&lt;br /&gt;
Again use g alias:&lt;br /&gt;
&amp;lt;pre&amp;gt;g&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Other useful git cmds===&lt;br /&gt;
&lt;br /&gt;
Do not use this commands unless you know what WILL happen. &lt;br /&gt;
*git pull - Instead use the safe &amp;quot;git pull --ff-only&amp;quot;&lt;br /&gt;
Stick to the alias &amp;quot;g&amp;quot; which does &amp;quot;git pull --ff-only ; git push &amp;amp;&amp;amp; git status&#039;&amp;quot;&lt;br /&gt;
&lt;br /&gt;
*git log - display history of commits to master branch&lt;br /&gt;
*git diff - display the differences in files between working files and files in local repo.&lt;br /&gt;
*git status - display: which updated files are staged/not staged(tracked)&lt;br /&gt;
*git stash - &lt;br /&gt;
*git branch - switch to a new branch&lt;br /&gt;
*git branch &amp;lt;branchname&amp;gt; - will switch to this branch only if it exists&lt;br /&gt;
*git checkout - DESTROYS/Updates the state of local working directory with the state of the files in the local repo. (YOU WILL LOSE non staged updates)&lt;br /&gt;
*git restore &amp;lt;filename&amp;gt; - DESTROYS/Updates the file with the version in the local repo. (like with git checkout but for a specific file)&lt;br /&gt;
*git checkin - &lt;br /&gt;
*git revert &amp;lt;commitHash&amp;gt; - reverses a specific commit (use git log to get the chosen commit hash)&lt;br /&gt;
*git ..&lt;br /&gt;
&lt;br /&gt;
==Converting AREV programs to EXODUS==&lt;br /&gt;
===Decompile AREV to C++===&lt;br /&gt;
&lt;br /&gt;
Do in Master AREV Installation Maintenance mode: (win7)&lt;br /&gt;
&lt;br /&gt;
#ATTACH ADECOMC &lt;br /&gt;
#*ADECOM &amp;lt;programname&amp;gt;   *single program&lt;br /&gt;
#*ADECOM &amp;lt;prog1&amp;gt; &amp;lt;prog2&amp;gt; &lt;br /&gt;
#*ADECOMALL              *all programs   (CHECK FIRST)&lt;br /&gt;
&lt;br /&gt;
Include the option &amp;quot;(V)&amp;quot; in the command to print the C++ to a notepad, which can easily be copy and pasted.&lt;br /&gt;
&lt;br /&gt;
===Getting C++ program to Exodus Installation===&lt;br /&gt;
&lt;br /&gt;
Two methods: (use the first for one off programs)&lt;br /&gt;
&lt;br /&gt;
====Copy &amp;amp; Paste====&lt;br /&gt;
&lt;br /&gt;
Compile program and open source code in notepad&lt;br /&gt;
&lt;br /&gt;
 ADECOM &amp;lt;programname&amp;gt; (V)&lt;br /&gt;
&lt;br /&gt;
Find which directory the program belongs. e.g fin/med/job/sys e.t&lt;br /&gt;
&lt;br /&gt;
 find /cygdrive/d/exodus/pickos | grep &amp;lt;program name&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If cpp in SYS, the program belongs in ~/exodus/service/src OR if in MED JOB FIN GEN AGY the program belongs in ~/neosys/src&lt;br /&gt;
&lt;br /&gt;
Copy the source code in the text file from the first command.&lt;br /&gt;
&lt;br /&gt;
In Exodus, create a new .cpp (in correct directory) and paste the source code.&lt;br /&gt;
&lt;br /&gt;
Compile &amp;amp; Test&lt;br /&gt;
&lt;br /&gt;
====Rsync====&lt;br /&gt;
&lt;br /&gt;
 /d/exodus/arev/syncup.sh&lt;br /&gt;
&lt;br /&gt;
If cpp in SYS then: ~/exodus/service/src ./getpickos&lt;br /&gt;
&lt;br /&gt;
If cpp in MED JOB FIN GEN AGY then: *~/neosys/src&lt;br /&gt;
&lt;br /&gt;
===Compile C++ files to TEST system===&lt;br /&gt;
&lt;br /&gt;
#*./test &amp;lt;DBNAME&amp;gt;&lt;br /&gt;
#*~/neosys ./doall TEST &amp;lt;DBNAME&amp;gt; restart    #to get one service to start start using the new lib files&lt;br /&gt;
#*~/neosys ./doall TEST all restart         #to get all the services to start start using the new lib files&lt;br /&gt;
&lt;br /&gt;
===Install C++ files to LIVE System===&lt;br /&gt;
&lt;br /&gt;
#~/exodus/service/ ./copyall            #to copy all the ~/lib and bin files to ~/live/lib and bin ... which is used by all exodus/live services&lt;br /&gt;
&lt;br /&gt;
==Writing Standard Exodus Core Function/Method Testing==&lt;br /&gt;
Screen 9: ~/exodus/test/src/&lt;br /&gt;
There are a series of test programs that check whether methods/functions behave as intended.&lt;br /&gt;
They do this using the function, assert.. a 1 or more argument values produce one and only one output)&lt;br /&gt;
&lt;br /&gt;
e.g test_multilang.cpp or test_sort.cpp&lt;br /&gt;
&lt;br /&gt;
Two methods of running test programs:&lt;br /&gt;
*Screen 9: make test&lt;br /&gt;
*after compiling using edic/compile/c, enter test_prog_name. (Since compile has moved it to ~/bin)&lt;br /&gt;
&lt;br /&gt;
Difference between the two methods is make calls gdb directly;&lt;br /&gt;
whereas ~/bin/test_prog_name uses exodus compile program&lt;br /&gt;
#~/neosys ./doall LIVE all restart&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Upgrading Exodus==&lt;br /&gt;
&lt;br /&gt;
#Develop patch in Dev system &lt;br /&gt;
&lt;br /&gt;
===Patching neosys/src or exodus/service/src===&lt;br /&gt;
&lt;br /&gt;
#Manually insert patches and compile into test programs.&lt;br /&gt;
#If patch dat files then run neosys/compall to get dat files into ~/dat&lt;br /&gt;
*If Patsalides:&lt;br /&gt;
*#SITE_DIR=ptcy ./test basic &lt;br /&gt;
*#login to BASIC_TEST and test&lt;br /&gt;
*Other clients:&lt;br /&gt;
*#./test DBCODE&lt;br /&gt;
*#login to DBCODE and test patches works&lt;br /&gt;
#run exodus/service/copyall and check only the patched programs are listed. (if not, see Troubleshoot below)&lt;br /&gt;
#Inform users to log off for 10mins. As a rule of thumb, live services must be stopped before copying test programs to live.&lt;br /&gt;
#exodus/service/copyall CONFIRM&lt;br /&gt;
&lt;br /&gt;
====Troubleshoot====&lt;br /&gt;
&lt;br /&gt;
=====./copyall lists programs you have not patched=====&lt;br /&gt;
Use exodus/service/copyone to copy only your patched programs one by one. (./copyone will not copy dat files)&lt;br /&gt;
&lt;br /&gt;
===Upgrading to new version===&lt;br /&gt;
&lt;br /&gt;
READ: remember there is no test version of libexodus programs. This means that if libexodus programs are compiled and installed, neosys/src and exodus/services LIVE programs MUST BE UPGRADED.&lt;br /&gt;
&lt;br /&gt;
#Upgrade test system to test&lt;br /&gt;
##If a dev system like de2, git stash any uncommitted changes other staff may be working on.&lt;br /&gt;
##Run &amp;quot;g&amp;quot; in ~/exodus (to do git pull --ff-only)&lt;br /&gt;
##Run &amp;quot;m&amp;quot; in ~/exodus (to compile and install libexodus)&lt;br /&gt;
##Run &amp;quot;~/neosys/upgrade.all.sh live&amp;quot; in ~/neosys (to upgrade exodus/service and neosys/src live programs)&lt;br /&gt;
##Begin testing&lt;br /&gt;
#Upgrade clients&lt;br /&gt;
##*Client hosted - Schedule a planned upgrade with client.&lt;br /&gt;
##*NEOSYS hosted - Inform all clients/users of planned morning upgrade, 24hours in advanced.      (TODO: &#039;What&#039;s New in NEOSYS&#039;) AND (emailallusers.cpp)&lt;br /&gt;
##Day of upgrade, check USB backup was successful &amp;amp; make a container snapshot, otherwise do not proceed.&lt;br /&gt;
##Stop services&lt;br /&gt;
##Run &amp;quot;g&amp;quot; in ~/exodus (to do git pull --ff-only)&lt;br /&gt;
##Run &amp;quot;m&amp;quot; in ~/exodus (to compile and install libexodus)&lt;br /&gt;
##Run &amp;quot;~/neosys/upgrade.all.sh live&amp;quot;. &lt;br /&gt;
##Check services started automatically without issues.&lt;br /&gt;
#Inform users their system has been upgraded and they can login.&lt;br /&gt;
&lt;br /&gt;
===Roll Back Upgrade===&lt;br /&gt;
&lt;br /&gt;
If for any reason the entire upgrade needs to be reverted (excludes clients database), follow steps below:&lt;br /&gt;
&lt;br /&gt;
#Inform users that there is a problem and services need to be stopped.&lt;br /&gt;
#Stop all exodus processes.&lt;br /&gt;
#Restore the morning&#039;s USB backup by: (Note this backup contains:  source/obj code, /etc, neosys scripts but not client data)&lt;br /&gt;
##Login into container&#039;s host and rsync the morning&#039;s usb backup to the container&#039;s /:&lt;br /&gt;
#*&amp;lt;pre&amp;gt;rsync --dry-run -avz -e &#039;ssh -p &amp;lt;C_SSHPORT&amp;gt;&#039; /backups/usb/&amp;lt;C_CODE&amp;gt; &amp;lt;C_CODE&amp;gt;:/      (Example: rsync --dry-run -avz -e &#039;ssh -p 19582&#039; /backups/usb/ad1 ad1:/&amp;lt;/pre&amp;gt;)&lt;br /&gt;
#Quick sane check, the latest git commit is not the latest git commit in the remote repo.&lt;br /&gt;
#Inform users they can login.&lt;br /&gt;
&lt;br /&gt;
==Configuring services to autostart during login==&lt;br /&gt;
For Ptcy.&lt;br /&gt;
&lt;br /&gt;
#Create a file &#039;autostart.cfg&#039; in the data folder &lt;br /&gt;
&lt;br /&gt;
 touch /root/hosts/&amp;lt;dbname&amp;gt;/data/autostart.cfg&lt;br /&gt;
&lt;br /&gt;
This will autostart a database service as long as at least one database service in that directory is running.&lt;br /&gt;
&lt;br /&gt;
For example, demo service will autostart during login if,&lt;br /&gt;
#/root/hosts/demo/data/autostart.cfg exists and&lt;br /&gt;
#demo_test service is running&lt;br /&gt;
&lt;br /&gt;
==Speedup postgresql importing databases==&lt;br /&gt;
&lt;br /&gt;
Can be sped up by a factor of 10 BUT may result in corrupt files in case of hard OS crash where the dirty memory is not flushed to storage.&lt;br /&gt;
&lt;br /&gt;
Therefore it is advisable to use this feature only briefly and REMEMBER TO REMOVE IT! &lt;br /&gt;
&lt;br /&gt;
Email to support@neosys.com whenever using it or use personal notes not memory.&lt;br /&gt;
&lt;br /&gt;
nano /etc/postgresql/12/main/postgresql.conf&lt;br /&gt;
&lt;br /&gt;
Uncomment or add a line&lt;br /&gt;
 fsync = off&lt;br /&gt;
Restart postgres … will break any neosys/exodus running processes.&lt;br /&gt;
 r postgresql&lt;br /&gt;
or reload postgres may also work&lt;br /&gt;
&lt;br /&gt;
==Database Attach==&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
root@exodus:~/exodus/cli/src# dbattach&lt;br /&gt;
dbattach - Attach foreign database files to the current default database&lt;br /&gt;
&lt;br /&gt;
Syntax is dbattach TARGETDB [FILENAME,...] {OPTION...}&lt;br /&gt;
&lt;br /&gt;
Options:&lt;br /&gt;
&lt;br /&gt;
  F   Forcibly delete any normal files in the current default database.&lt;br /&gt;
&lt;br /&gt;
  R   Detach foreign files&lt;br /&gt;
  RR  Remove foreign database connection.&lt;br /&gt;
  RRR Remove all foreign database connections and attachments.&lt;br /&gt;
&lt;br /&gt;
  L   List attached foreign files in the current default database&lt;br /&gt;
&lt;br /&gt;
If no filenames are provided then a database connection is created.&lt;br /&gt;
This is *required* before filenames can be provided and attached.&lt;br /&gt;
&lt;br /&gt;
Notes:&lt;br /&gt;
&lt;br /&gt;
Attachments are permanent until re-attached or removed.&lt;br /&gt;
&lt;br /&gt;
Indexes on attached files behave strangely.&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Issues:&lt;br /&gt;
&lt;br /&gt;
TARGETDB must be on the same connection as the current default database.&lt;br /&gt;
&lt;br /&gt;
Current user must have access to the foreign database.&lt;br /&gt;
&lt;br /&gt;
If EXO_USER and EXO_PASS are not set then exodus defaults are used.&lt;br /&gt;
&lt;br /&gt;
exodus .config file is not used currently.&lt;/div&gt;</summary>
		<author><name>Gregory</name></author>
	</entry>
	<entry>
		<id>https://techwiki.neosys.com/index.php?title=EXODUS_Knowledge&amp;diff=4002</id>
		<title>EXODUS Knowledge</title>
		<link rel="alternate" type="text/html" href="https://techwiki.neosys.com/index.php?title=EXODUS_Knowledge&amp;diff=4002"/>
		<updated>2022-10-27T05:26:21Z</updated>

		<summary type="html">&lt;p&gt;Gregory: /* Development and deployment using &amp;#039;dat&amp;#039; files */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==TMUX Screens==&lt;br /&gt;
&lt;br /&gt;
To create the EXODUS maintenance/programming environment&lt;br /&gt;
 exodus#: ./tmux.exodus&lt;br /&gt;
&lt;br /&gt;
===Screens===&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
0: /&lt;br /&gt;
    General work for server services/configs. i.e /etc/nagios, /etc/apache2, /var/log/mail.log or general networking.&lt;br /&gt;
&lt;br /&gt;
1: /root/exodus/&lt;br /&gt;
    Exodus core is installed. Contains build and make libraries here ./libexodus&lt;br /&gt;
&lt;br /&gt;
2: /root/exodus/libexodus/exodus&lt;br /&gt;
    Core exodus library source code which emulate the AREV system e.g var.cpp&lt;br /&gt;
    &lt;br /&gt;
3: /root/exodus/cli/src&lt;br /&gt;
    Exodus Command Line Interface E.g edir, edic, list, listfiles, delete, createdb, deletedb.&lt;br /&gt;
    &lt;br /&gt;
4: root/exodus/service&lt;br /&gt;
    EXODUS core default host directory but also contains scripts that create/manage requirements of a service (create_service, create_db, create_site, backup_db, restore_db, start, stop, status)&lt;br /&gt;
    The www/3/exodus has generic .htm, php and .js which provide basic website functionality i.e Login page, Support Menu, User details, Authorization.&lt;br /&gt;
    NEOSYS www files linked into ./www, from /root/neosys/web, which pulled from NEOSYS www git.&lt;br /&gt;
&lt;br /&gt;
5: /root/exodus/service/src&lt;br /&gt;
    Exodus core service programs (programs that are not related to NEOSYS agency operations and can be used to support other non-NEOSYS services) eg listen, usersubs, sendmail, openfile, select, sort, list,.&lt;br /&gt;
&lt;br /&gt;
    Extra info:    &lt;br /&gt;
    The dat/ has generic dictionary files. (See Section Dictionaries &amp;amp; Psql Functions)&lt;br /&gt;
    TODO: compall currently throws few warnings. Read them and familiarise. In case new warnings appear, notify Steve.    &lt;br /&gt;
        &lt;br /&gt;
6: /root/neosys&lt;br /&gt;
    NEOSYS specific client installation &amp;amp; management scripts e.g .doall, import_db and import_files (from AREV), ./run ./test (see below for these two commands)&lt;br /&gt;
    &lt;br /&gt;
7: /root/neosys/src&lt;br /&gt;
    NEOSYS Agency programs (see section How AREV programs are distributed in EXODUS src/*.cpp&lt;br /&gt;
    /root/neosys has the neosys .git&lt;br /&gt;
&lt;br /&gt;
8: /root/hosts&lt;br /&gt;
    client specific files  e.g logs, images, (shared ./www -&amp;gt; root/exodus/service/www&lt;br /&gt;
&lt;br /&gt;
9: /root/exodus/test/src&lt;br /&gt;
    series of programs that test whether subroutines (specifically Exodus core libraries) work as they should eg for the var lib - &amp;quot;assert( var(&amp;quot;11111&amp;quot;).isnum());&amp;quot;&lt;br /&gt;
&lt;br /&gt;
10: bash /bin/top&lt;br /&gt;
    Monitor for NEOSYS client processes&lt;br /&gt;
    Displays customised format: sorted by total time spend and by processor time.&lt;br /&gt;
     Press &amp;quot;=&amp;quot; : to change to standard top format&lt;br /&gt;
     Press shift + w : to save format settings, replacing the old customised top format&lt;br /&gt;
     To go back to the customised format do:&lt;br /&gt;
        Press &amp;quot;o&amp;quot;&lt;br /&gt;
        Type &amp;quot;COMMAND=serve_agy&amp;quot;&lt;br /&gt;
        shift + t : this sorts by total time spent&lt;br /&gt;
        shift + p : this sorts by processor time&lt;br /&gt;
        shift + w : to save this setting and enter  &#039;y&#039; to confirm&lt;br /&gt;
&lt;br /&gt;
11: /var/log/syslog&lt;br /&gt;
     Log of NEOSYS client requests&lt;br /&gt;
&lt;br /&gt;
12: /root/exodus/service/quick&lt;br /&gt;
     Displays the last time the svr file (in /root/hosts/&amp;lt;client&amp;gt;/data/&amp;lt;dbname&amp;gt;) was updated.&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Object Code/Libraries==&lt;br /&gt;
LIVE and TEST processes use different sets of object code.&lt;br /&gt;
TEST processes use libraries in ~/lib/, whereas LIVE processes use object code in ~/neo/lib&lt;br /&gt;
&lt;br /&gt;
This means development &amp;amp; testing can be done stress free on TEST database, as opposed to testing on production databases.&lt;br /&gt;
&lt;br /&gt;
When compiling using edic, the TEST object code is updated if the compilation is successful. (~/lib)&lt;br /&gt;
&lt;br /&gt;
==Dictionaries &amp;amp; Psql Functions==&lt;br /&gt;
&lt;br /&gt;
Dictionaries - data used to describe other data; specifically the fields of other files. &lt;br /&gt;
&lt;br /&gt;
There are three types of fields: &amp;lt;pre&amp;gt;&lt;br /&gt;
(F) Field for raw data E.g &amp;quot;Office 44 Building Rush&amp;quot;&lt;br /&gt;
(S) Symbolic or calculated E.g for total ans=field1+field2&lt;br /&gt;
(G) General or Group E.g &amp;quot;@CRT&amp;quot; which contains always contains the default columns to show on the output of the list program; if no columns provided in list command.&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Show dictionary using &amp;quot;EXO_DATA=test list dict.clients&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
===Development and deployment using &#039;dat&#039; files===&lt;br /&gt;
&lt;br /&gt;
====Rationale====&lt;br /&gt;
&lt;br /&gt;
Part of system development is the creation of various data that is neither programs nor layout i.e. not cpp, h, html, js, php files etc.&lt;br /&gt;
&lt;br /&gt;
For example:&lt;br /&gt;
&lt;br /&gt;
*Dictionaries are data about data.&lt;br /&gt;
*Language files are data about text to use for various languages.&lt;br /&gt;
*“Change logs” are data about changes in the system.&lt;br /&gt;
&lt;br /&gt;
Historically, in EXODUS and NEOSYS, the above data has been deployed in exodus database files using SQL text files. However SQL files are not convenient for development.&lt;br /&gt;
&lt;br /&gt;
Therefore, &#039;dat&#039; text files will be used now so that standard development tools including editors and git can be fully exploited.&lt;br /&gt;
&lt;br /&gt;
====&#039;dat&#039; files====&lt;br /&gt;
&lt;br /&gt;
Each database file is represented by an os directory of the same name.&lt;br /&gt;
&lt;br /&gt;
Each record in the database file is represented by an os text file where filename is the primary key.&lt;br /&gt;
&lt;br /&gt;
For example a record with key &#039;&#039;&#039;DEADLINE&#039;&#039;&#039; in a dat file &#039;&#039;&#039;dict.materials&#039;&#039;&#039; would be represented as an os text file &#039;&#039;&#039;dat/dict.materials/DEADLINE&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Each line in the os text file represents one field in the db record. In other words, db record FM characters are represented by new line characters in &#039;dat&#039; files. Any actual new line characters required in the record, and any backslashes, are escaped and appear as &#039;\n&#039; and &#039;\\&#039; in &#039;dat&#039; files. Other database field separator characters such as VM, SM, TM and STM are stored without any conversion.&lt;br /&gt;
&lt;br /&gt;
====Location of dat files====&lt;br /&gt;
&lt;br /&gt;
The development versions are stored in exodus and neosys src/dat dirs. They form part of the standard git repositories in parallel with cpp files.&lt;br /&gt;
&lt;br /&gt;
The operational versions are stored in ~/dat and ~/live/dat alongside bin and lib dirs and are automatically installed into databases as database files on service startup. Any database functions embedded in the text files (pgsql) are also automatically installed at the same time.&lt;br /&gt;
&lt;br /&gt;
===Delete Database dictionary file===&lt;br /&gt;
&lt;br /&gt;
cli syncdat deletes database files if the dat dir is empty or contains a file &#039;SYNCDAT_DELETE&#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
touch neosys/src/dat/dict.users/SYNC_DELETE&lt;br /&gt;
neosys/src~: syncdat&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====Editing and deploying a &#039;dat&#039; file====&lt;br /&gt;
&lt;br /&gt;
It is currently a three step process to edit and deploy such &#039;dat&#039; files. &lt;br /&gt;
&lt;br /&gt;
=====Edit the &#039;dat&#039; file (i.e dict.file record)=====&lt;br /&gt;
&lt;br /&gt;
Note that EXODUS service and NEOSYS service have different src/dat folders.&lt;br /&gt;
&lt;br /&gt;
Editing language items:&lt;br /&gt;
&lt;br /&gt;
 edir dat/alanguage/SCHEDULES*ARABIC&lt;br /&gt;
&lt;br /&gt;
Editing a dictionary item:&lt;br /&gt;
&lt;br /&gt;
 edir dat/dict.materials/DEADLINE&lt;br /&gt;
&lt;br /&gt;
Editing a pgsql function in a dictionary:&lt;br /&gt;
&lt;br /&gt;
 edir dat/dict.materials/DEADLINE 8&lt;br /&gt;
&lt;br /&gt;
=====Copy all &#039;dat&#039; files to ~/dat =====&lt;br /&gt;
&lt;br /&gt;
This step might be removed at a later date.&lt;br /&gt;
&lt;br /&gt;
This will cause all test databases to immediately restart and load any &#039;dat&#039; file changes into dictionaries and data files and also create any new or modified pgsql functions.&lt;br /&gt;
&lt;br /&gt;
If any ~/neosys/src/dat files were edited:&lt;br /&gt;
&lt;br /&gt;
 cd ~/neosys/src&lt;br /&gt;
 &lt;br /&gt;
 ./compall dat&lt;br /&gt;
&lt;br /&gt;
and/or, if exodus/service/dat files were edited&lt;br /&gt;
&lt;br /&gt;
 cd ~/exodus/service/src&lt;br /&gt;
 &lt;br /&gt;
 ./compall dat&lt;br /&gt;
&lt;br /&gt;
=====Copy all programs and &#039;dat&#039; files to ~/live/bin|lib|dat=====&lt;br /&gt;
&lt;br /&gt;
This should only be run after testing. It will cause all live databases to automatically restart and do the same as the test databases mentioned above.&lt;br /&gt;
&lt;br /&gt;
 cd ~/exodus/service&lt;br /&gt;
 &lt;br /&gt;
 ./copyall CONFIRM&lt;br /&gt;
&lt;br /&gt;
=====Delete dat record =====&lt;br /&gt;
&lt;br /&gt;
Simply open the corresponding dat file, remove all lines and save.&lt;br /&gt;
&lt;br /&gt;
===Psql unaccent extension===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The unaccent extension and the immutable_unaccent function are created in the db ‘template1’ during exodus installation while user is postgres which is a superuser.&lt;br /&gt;
&lt;br /&gt;
Thereafter all new databases are created as copies of template1 so they contain the extension and function&lt;br /&gt;
&lt;br /&gt;
====Error====&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
MVDBException:ERROR: function immutable_unaccent(text) does not exist&lt;br /&gt;
ERROR:  permission denied to create extension &amp;quot;unaccent&amp;quot;&lt;br /&gt;
HINT:  Must be superuser to create this extension. &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====Solution====&lt;br /&gt;
sudo -u postgres psql -c &#039;ALTER USER exodus WITH SUPERUSER;&#039;&lt;br /&gt;
&lt;br /&gt;
==Processes==&lt;br /&gt;
The TEST process for all database use the same object code stored in /root/lib, whereas all LIVE process use the object code in /root/neo/.&lt;br /&gt;
&lt;br /&gt;
==Postgres==&lt;br /&gt;
Connect into postgres shell:&lt;br /&gt;
 alias psql=&#039;sudo -u postgres psql&#039;&lt;br /&gt;
&lt;br /&gt;
Delete a database:&lt;br /&gt;
 sudo -u postgres dropdb &amp;lt;dbcode&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Debugging Exodus==&lt;br /&gt;
&lt;br /&gt;
===Debugging Live/Test services===&lt;br /&gt;
&lt;br /&gt;
./test &amp;lt;dbname&amp;gt; - execute test programs on _test database.&lt;br /&gt;
&lt;br /&gt;
./run &amp;lt;dbname&amp;gt;  - execute test programs on live database.&lt;br /&gt;
&lt;br /&gt;
===Debugging var values===&lt;br /&gt;
&lt;br /&gt;
Explanation of var flag value in gdb debug mode.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
(gdb) p varx                                                           &lt;br /&gt;
$2 = {var_str = &amp;quot;&amp;quot;, var_int = 0, var_dbl = 0, var_typ = {flags_ = 2}}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Each exodus var object contains 3 variables of type string, int and double.&lt;br /&gt;
&lt;br /&gt;
All 3 may be unassigned or only the string be assigned or just the int and double e.t.&lt;br /&gt;
&lt;br /&gt;
You can tell which variable type of a var object are set based on the var&#039;s flag value.&lt;br /&gt;
&lt;br /&gt;
1 = Means the string is assigned&lt;br /&gt;
2 = Means the int is assigned&lt;br /&gt;
4 = Means the double is assigned&lt;br /&gt;
&lt;br /&gt;
Example: If the flag is 7 (1+2+4), then all types are assigned.&lt;br /&gt;
&lt;br /&gt;
====To inspect a “common” variable====&lt;br /&gt;
&lt;br /&gt;
e,g, a variable called ba.ledgern&lt;br /&gt;
&lt;br /&gt;
 p ((subExodusProgram::ba_common)ba).ledgern&lt;br /&gt;
&lt;br /&gt;
====To inspect a common block====&lt;br /&gt;
&lt;br /&gt;
e.g. a common block ba&lt;br /&gt;
&lt;br /&gt;
 ptype (subExodusProgram::ba_common)ba&lt;br /&gt;
&lt;br /&gt;
====To dump all variables in a common====&lt;br /&gt;
&lt;br /&gt;
e.g all variables in ba&lt;br /&gt;
&lt;br /&gt;
 p (subExodusProgram::ba_common)ba&lt;br /&gt;
&lt;br /&gt;
====What types are available in a program?====&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;info types common&lt;br /&gt;
info types subExodus&lt;br /&gt;
info types libexodus&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====Other commands====&lt;br /&gt;
&lt;br /&gt;
 explore subExodusProgram::ba_common&lt;br /&gt;
&lt;br /&gt;
===Process Hung or consuming +100% CPU===&lt;br /&gt;
If process is consuming +100% CPU then it is likely stuck in an infinite loop.&lt;br /&gt;
&lt;br /&gt;
 ./doall &amp;lt;CLIENT&amp;gt; stop&lt;br /&gt;
&lt;br /&gt;
 ./run &amp;lt;CLIENT&amp;gt; &lt;br /&gt;
&lt;br /&gt;
 ./test &amp;lt;CLIENT&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Search through recent logs for &amp;lt;CLIENT&amp;gt; looking for requests that didn&#039;t return OK at the time nagios alerted of Hung process.&lt;br /&gt;
&lt;br /&gt;
A user may also instigate the error again, so monitor the CLIENT&#039;s service CPU usage.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
If cause found recreate it in test and once test process hit +100% break in test debugger.&lt;br /&gt;
&lt;br /&gt;
If cause not found, you will have to continue checking logs for the request that caused it or hope a user recreates the issue in live debugged service.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Once you&#039;ve broken in the debugged with the error, enter &amp;quot;n&amp;quot; and hold the enter key until you just seeing line repeat.&lt;br /&gt;
&lt;br /&gt;
Pay attention to start of loops code. E.g WHILE or FOR. (there is likely an error is there)&lt;br /&gt;
&lt;br /&gt;
==./doall==&lt;br /&gt;
====General====&lt;br /&gt;
&lt;br /&gt;
~/neosys/doall [LIVE|TEST] &amp;lt;DBCODE|ALL&amp;gt; &amp;lt; ACTION [OPTIONS,..]  | bash -- COMMAND ]&lt;br /&gt;
&lt;br /&gt;
Example: &lt;br /&gt;
 ./doall TEST ALL create_site t-&lt;br /&gt;
Result:&lt;br /&gt;
Create site for ALL TEST databases, using domain name prefix option &amp;quot;t-&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Screen 6: ./doall script contains all the necessary information(codes) to setup an installation.&lt;br /&gt;
It includes scripts to backup, restore, create an Apache site, create/start/stop/status a service, import an AREV database into postgres and more.&lt;br /&gt;
&lt;br /&gt;
====backup_db====&lt;br /&gt;
&lt;br /&gt;
*Does a backup &amp;amp; restore of a LIVE database into the corresponding TEST database.&lt;br /&gt;
*Backup &amp;lt;dbcode&amp;gt;.sql file is written to /root/backups/sql; which is rsynced to nl19:/backups/current/exodus/&lt;br /&gt;
*Unlike AREV, postgres can perform a &amp;quot;backup&amp;quot; of a database whilst the system is in use.&lt;br /&gt;
&lt;br /&gt;
==Git==&lt;br /&gt;
&lt;br /&gt;
There are two repositories, one for EXODUS and the other for NEOSYS.&lt;br /&gt;
&lt;br /&gt;
===Using git to make changes===&lt;br /&gt;
&lt;br /&gt;
Before following steps you must have a tested updated to a program/file/script. Do not commit untested changes to avoid a messy git history of reverts.&lt;br /&gt;
&lt;br /&gt;
Update your local repo before committing to local repo using the g alias for &amp;quot;git pull --ff-only ; git push &amp;amp;&amp;amp; git status&#039;&amp;quot;:&lt;br /&gt;
&amp;lt;pre&amp;gt;g&amp;lt;/pre&amp;gt;&lt;br /&gt;
Check which updates/files have not yet been staged and/or committed:&lt;br /&gt;
Add your updates to the staged area:&lt;br /&gt;
&amp;lt;pre&amp;gt;git add &amp;lt;filename&amp;gt;&amp;lt;/pre&amp;gt;&lt;br /&gt;
or if all the changes made need to be staged:&lt;br /&gt;
&amp;lt;pre&amp;gt;git add -a&amp;lt;/pre&amp;gt;&lt;br /&gt;
Make a commit with a descriptive message on purpose of updates:&lt;br /&gt;
&amp;lt;pre&amp;gt;git commit -m &amp;lt;description n purpose of changes&amp;gt;&amp;lt;/pre&amp;gt;&lt;br /&gt;
Again use g alias:&lt;br /&gt;
&amp;lt;pre&amp;gt;g&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Other useful git cmds===&lt;br /&gt;
&lt;br /&gt;
Do not use this commands unless you know what WILL happen. &lt;br /&gt;
*git pull - Instead use the safe &amp;quot;git pull --ff-only&amp;quot;&lt;br /&gt;
Stick to the alias &amp;quot;g&amp;quot; which does &amp;quot;git pull --ff-only ; git push &amp;amp;&amp;amp; git status&#039;&amp;quot;&lt;br /&gt;
&lt;br /&gt;
*git log - display history of commits to master branch&lt;br /&gt;
*git diff - display the differences in files between working files and files in local repo.&lt;br /&gt;
*git status - display: which updated files are staged/not staged(tracked)&lt;br /&gt;
*git stash - &lt;br /&gt;
*git branch - switch to a new branch&lt;br /&gt;
*git branch &amp;lt;branchname&amp;gt; - will switch to this branch only if it exists&lt;br /&gt;
*git checkout - DESTROYS/Updates the state of local working directory with the state of the files in the local repo. (YOU WILL LOSE non staged updates)&lt;br /&gt;
*git restore &amp;lt;filename&amp;gt; - DESTROYS/Updates the file with the version in the local repo. (like with git checkout but for a specific file)&lt;br /&gt;
*git checkin - &lt;br /&gt;
*git revert &amp;lt;commitHash&amp;gt; - reverses a specific commit (use git log to get the chosen commit hash)&lt;br /&gt;
*git ..&lt;br /&gt;
&lt;br /&gt;
==Converting AREV programs to EXODUS==&lt;br /&gt;
===Decompile AREV to C++===&lt;br /&gt;
&lt;br /&gt;
Do in Master AREV Installation Maintenance mode: (win7)&lt;br /&gt;
&lt;br /&gt;
#ATTACH ADECOMC &lt;br /&gt;
#*ADECOM &amp;lt;programname&amp;gt;   *single program&lt;br /&gt;
#*ADECOM &amp;lt;prog1&amp;gt; &amp;lt;prog2&amp;gt; &lt;br /&gt;
#*ADECOMALL              *all programs   (CHECK FIRST)&lt;br /&gt;
&lt;br /&gt;
Include the option &amp;quot;(V)&amp;quot; in the command to print the C++ to a notepad, which can easily be copy and pasted.&lt;br /&gt;
&lt;br /&gt;
===Getting C++ program to Exodus Installation===&lt;br /&gt;
&lt;br /&gt;
Two methods: (use the first for one off programs)&lt;br /&gt;
&lt;br /&gt;
====Copy &amp;amp; Paste====&lt;br /&gt;
&lt;br /&gt;
Compile program and open source code in notepad&lt;br /&gt;
&lt;br /&gt;
 ADECOM &amp;lt;programname&amp;gt; (V)&lt;br /&gt;
&lt;br /&gt;
Find which directory the program belongs. e.g fin/med/job/sys e.t&lt;br /&gt;
&lt;br /&gt;
 find /cygdrive/d/exodus/pickos | grep &amp;lt;program name&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If cpp in SYS, the program belongs in ~/exodus/service/src OR if in MED JOB FIN GEN AGY the program belongs in ~/neosys/src&lt;br /&gt;
&lt;br /&gt;
Copy the source code in the text file from the first command.&lt;br /&gt;
&lt;br /&gt;
In Exodus, create a new .cpp (in correct directory) and paste the source code.&lt;br /&gt;
&lt;br /&gt;
Compile &amp;amp; Test&lt;br /&gt;
&lt;br /&gt;
====Rsync====&lt;br /&gt;
&lt;br /&gt;
 /d/exodus/arev/syncup.sh&lt;br /&gt;
&lt;br /&gt;
If cpp in SYS then: ~/exodus/service/src ./getpickos&lt;br /&gt;
&lt;br /&gt;
If cpp in MED JOB FIN GEN AGY then: *~/neosys/src&lt;br /&gt;
&lt;br /&gt;
===Compile C++ files to TEST system===&lt;br /&gt;
&lt;br /&gt;
#*./test &amp;lt;DBNAME&amp;gt;&lt;br /&gt;
#*~/neosys ./doall TEST &amp;lt;DBNAME&amp;gt; restart    #to get one service to start start using the new lib files&lt;br /&gt;
#*~/neosys ./doall TEST all restart         #to get all the services to start start using the new lib files&lt;br /&gt;
&lt;br /&gt;
===Install C++ files to LIVE System===&lt;br /&gt;
&lt;br /&gt;
#~/exodus/service/ ./copyall            #to copy all the ~/lib and bin files to ~/live/lib and bin ... which is used by all exodus/live services&lt;br /&gt;
&lt;br /&gt;
==Writing Standard Exodus Core Function/Method Testing==&lt;br /&gt;
Screen 9: ~/exodus/test/src/&lt;br /&gt;
There are a series of test programs that check whether methods/functions behave as intended.&lt;br /&gt;
They do this using the function, assert.. a 1 or more argument values produce one and only one output)&lt;br /&gt;
&lt;br /&gt;
e.g test_multilang.cpp or test_sort.cpp&lt;br /&gt;
&lt;br /&gt;
Two methods of running test programs:&lt;br /&gt;
*Screen 9: make test&lt;br /&gt;
*after compiling using edic/compile/c, enter test_prog_name. (Since compile has moved it to ~/bin)&lt;br /&gt;
&lt;br /&gt;
Difference between the two methods is make calls gdb directly;&lt;br /&gt;
whereas ~/bin/test_prog_name uses exodus compile program&lt;br /&gt;
#~/neosys ./doall LIVE all restart&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Upgrading Exodus==&lt;br /&gt;
&lt;br /&gt;
#Develop patch in Dev system &lt;br /&gt;
&lt;br /&gt;
===Patching neosys/src or exodus/service/src===&lt;br /&gt;
&lt;br /&gt;
#Manually insert patches and compile into test programs.&lt;br /&gt;
#If patch dat files then run neosys/compall to get dat files into ~/dat&lt;br /&gt;
*If Patsalides:&lt;br /&gt;
*#SITE_DIR=ptcy ./test basic &lt;br /&gt;
*#login to BASIC_TEST and test&lt;br /&gt;
*Other clients:&lt;br /&gt;
*#./test DBCODE&lt;br /&gt;
*#login to DBCODE and test patches works&lt;br /&gt;
#run exodus/service/copyall and check only the patched programs are listed. (if not, see Troubleshoot below)&lt;br /&gt;
#Inform users to log off for 10mins. As a rule of thumb, live services must be stopped before copying test programs to live.&lt;br /&gt;
#exodus/service/copyall CONFIRM&lt;br /&gt;
&lt;br /&gt;
====Troubleshoot====&lt;br /&gt;
&lt;br /&gt;
=====./copyall lists programs you have not patched=====&lt;br /&gt;
Use exodus/service/copyone to copy only your patched programs one by one. (./copyone will not copy dat files)&lt;br /&gt;
&lt;br /&gt;
===Upgrading to new version===&lt;br /&gt;
&lt;br /&gt;
READ: remember there is no test version of libexodus programs. This means that if libexodus programs are compiled and installed, neosys/src and exodus/services LIVE programs MUST BE UPGRADED.&lt;br /&gt;
&lt;br /&gt;
#Upgrade test system to test&lt;br /&gt;
##If a dev system like de2, git stash any uncommitted changes other staff may be working on.&lt;br /&gt;
##Run &amp;quot;g&amp;quot; in ~/exodus (to do git pull --ff-only)&lt;br /&gt;
##Run &amp;quot;m&amp;quot; in ~/exodus (to compile and install libexodus)&lt;br /&gt;
##Run &amp;quot;~/neosys/upgrade.all.sh live&amp;quot; in ~/neosys (to upgrade exodus/service and neosys/src live programs)&lt;br /&gt;
##Begin testing&lt;br /&gt;
#Upgrade clients&lt;br /&gt;
##*Client hosted - Schedule a planned upgrade with client.&lt;br /&gt;
##*NEOSYS hosted - Inform all clients/users of planned morning upgrade, 24hours in advanced.      (TODO: &#039;What&#039;s New in NEOSYS&#039;) AND (emailallusers.cpp)&lt;br /&gt;
##Day of upgrade, check USB backup was successful &amp;amp; make a container snapshot, otherwise do not proceed.&lt;br /&gt;
##Stop services&lt;br /&gt;
##Run &amp;quot;g&amp;quot; in ~/exodus (to do git pull --ff-only)&lt;br /&gt;
##Run &amp;quot;m&amp;quot; in ~/exodus (to compile and install libexodus)&lt;br /&gt;
##Run &amp;quot;~/neosys/upgrade.all.sh live&amp;quot;. &lt;br /&gt;
##Check services started automatically without issues.&lt;br /&gt;
#Inform users their system has been upgraded and they can login.&lt;br /&gt;
&lt;br /&gt;
===Roll Back Upgrade===&lt;br /&gt;
&lt;br /&gt;
If for any reason the entire upgrade needs to be reverted (excludes clients database), follow steps below:&lt;br /&gt;
&lt;br /&gt;
#Inform users that there is a problem and services need to be stopped.&lt;br /&gt;
#Stop all exodus processes.&lt;br /&gt;
#Restore the morning&#039;s USB backup by: (Note this backup contains:  source/obj code, /etc, neosys scripts but not client data)&lt;br /&gt;
##Login into container&#039;s host and rsync the morning&#039;s usb backup to the container&#039;s /:&lt;br /&gt;
#*&amp;lt;pre&amp;gt;rsync --dry-run -avz -e &#039;ssh -p &amp;lt;C_SSHPORT&amp;gt;&#039; /backups/usb/&amp;lt;C_CODE&amp;gt; &amp;lt;C_CODE&amp;gt;:/      (Example: rsync --dry-run -avz -e &#039;ssh -p 19582&#039; /backups/usb/ad1 ad1:/&amp;lt;/pre&amp;gt;)&lt;br /&gt;
#Quick sane check, the latest git commit is not the latest git commit in the remote repo.&lt;br /&gt;
#Inform users they can login.&lt;br /&gt;
&lt;br /&gt;
==Configuring services to autostart during login==&lt;br /&gt;
For Ptcy.&lt;br /&gt;
&lt;br /&gt;
#Create a file &#039;autostart.cfg&#039; in the data folder &lt;br /&gt;
&lt;br /&gt;
 touch /root/hosts/&amp;lt;dbname&amp;gt;/data/autostart.cfg&lt;br /&gt;
&lt;br /&gt;
This will autostart a database service as long as at least one database service in that directory is running.&lt;br /&gt;
&lt;br /&gt;
For example, demo service will autostart during login if,&lt;br /&gt;
#/root/hosts/demo/data/autostart.cfg exists and&lt;br /&gt;
#demo_test service is running&lt;br /&gt;
&lt;br /&gt;
==Speedup postgresql importing databases==&lt;br /&gt;
&lt;br /&gt;
Can be sped up by a factor of 10 BUT may result in corrupt files in case of hard OS crash where the dirty memory is not flushed to storage.&lt;br /&gt;
&lt;br /&gt;
Therefore it is advisable to use this feature only briefly and REMEMBER TO REMOVE IT! &lt;br /&gt;
&lt;br /&gt;
Email to support@neosys.com whenever using it or use personal notes not memory.&lt;br /&gt;
&lt;br /&gt;
nano /etc/postgresql/12/main/postgresql.conf&lt;br /&gt;
&lt;br /&gt;
Uncomment or add a line&lt;br /&gt;
 fsync = off&lt;br /&gt;
Restart postgres … will break any neosys/exodus running processes.&lt;br /&gt;
 r postgresql&lt;br /&gt;
or reload postgres may also work&lt;br /&gt;
&lt;br /&gt;
==Database Attach==&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
root@exodus:~/exodus/cli/src# dbattach&lt;br /&gt;
dbattach - Attach foreign database files to the current default database&lt;br /&gt;
&lt;br /&gt;
Syntax is dbattach TARGETDB [FILENAME,...] {OPTION...}&lt;br /&gt;
&lt;br /&gt;
Options:&lt;br /&gt;
&lt;br /&gt;
  F   Forcibly delete any normal files in the current default database.&lt;br /&gt;
&lt;br /&gt;
  R   Detach foreign files&lt;br /&gt;
  RR  Remove foreign database connection.&lt;br /&gt;
  RRR Remove all foreign database connections and attachments.&lt;br /&gt;
&lt;br /&gt;
  L   List attached foreign files in the current default database&lt;br /&gt;
&lt;br /&gt;
If no filenames are provided then a database connection is created.&lt;br /&gt;
This is *required* before filenames can be provided and attached.&lt;br /&gt;
&lt;br /&gt;
Notes:&lt;br /&gt;
&lt;br /&gt;
Attachments are permanent until re-attached or removed.&lt;br /&gt;
&lt;br /&gt;
Indexes on attached files behave strangely.&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Issues:&lt;br /&gt;
&lt;br /&gt;
TARGETDB must be on the same connection as the current default database.&lt;br /&gt;
&lt;br /&gt;
Current user must have access to the foreign database.&lt;br /&gt;
&lt;br /&gt;
If EXO_USER and EXO_PASS are not set then exodus defaults are used.&lt;br /&gt;
&lt;br /&gt;
exodus .config file is not used currently.&lt;/div&gt;</summary>
		<author><name>Gregory</name></author>
	</entry>
	<entry>
		<id>https://techwiki.neosys.com/index.php?title=EXODUS_Knowledge&amp;diff=4001</id>
		<title>EXODUS Knowledge</title>
		<link rel="alternate" type="text/html" href="https://techwiki.neosys.com/index.php?title=EXODUS_Knowledge&amp;diff=4001"/>
		<updated>2022-10-13T05:55:23Z</updated>

		<summary type="html">&lt;p&gt;Gregory: /* Copy all programs and &amp;#039;dat&amp;#039; files to ~/live/bin|lib|dat */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==TMUX Screens==&lt;br /&gt;
&lt;br /&gt;
To create the EXODUS maintenance/programming environment&lt;br /&gt;
 exodus#: ./tmux.exodus&lt;br /&gt;
&lt;br /&gt;
===Screens===&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
0: /&lt;br /&gt;
    General work for server services/configs. i.e /etc/nagios, /etc/apache2, /var/log/mail.log or general networking.&lt;br /&gt;
&lt;br /&gt;
1: /root/exodus/&lt;br /&gt;
    Exodus core is installed. Contains build and make libraries here ./libexodus&lt;br /&gt;
&lt;br /&gt;
2: /root/exodus/libexodus/exodus&lt;br /&gt;
    Core exodus library source code which emulate the AREV system e.g var.cpp&lt;br /&gt;
    &lt;br /&gt;
3: /root/exodus/cli/src&lt;br /&gt;
    Exodus Command Line Interface E.g edir, edic, list, listfiles, delete, createdb, deletedb.&lt;br /&gt;
    &lt;br /&gt;
4: root/exodus/service&lt;br /&gt;
    EXODUS core default host directory but also contains scripts that create/manage requirements of a service (create_service, create_db, create_site, backup_db, restore_db, start, stop, status)&lt;br /&gt;
    The www/3/exodus has generic .htm, php and .js which provide basic website functionality i.e Login page, Support Menu, User details, Authorization.&lt;br /&gt;
    NEOSYS www files linked into ./www, from /root/neosys/web, which pulled from NEOSYS www git.&lt;br /&gt;
&lt;br /&gt;
5: /root/exodus/service/src&lt;br /&gt;
    Exodus core service programs (programs that are not related to NEOSYS agency operations and can be used to support other non-NEOSYS services) eg listen, usersubs, sendmail, openfile, select, sort, list,.&lt;br /&gt;
&lt;br /&gt;
    Extra info:    &lt;br /&gt;
    The dat/ has generic dictionary files. (See Section Dictionaries &amp;amp; Psql Functions)&lt;br /&gt;
    TODO: compall currently throws few warnings. Read them and familiarise. In case new warnings appear, notify Steve.    &lt;br /&gt;
        &lt;br /&gt;
6: /root/neosys&lt;br /&gt;
    NEOSYS specific client installation &amp;amp; management scripts e.g .doall, import_db and import_files (from AREV), ./run ./test (see below for these two commands)&lt;br /&gt;
    &lt;br /&gt;
7: /root/neosys/src&lt;br /&gt;
    NEOSYS Agency programs (see section How AREV programs are distributed in EXODUS src/*.cpp&lt;br /&gt;
    /root/neosys has the neosys .git&lt;br /&gt;
&lt;br /&gt;
8: /root/hosts&lt;br /&gt;
    client specific files  e.g logs, images, (shared ./www -&amp;gt; root/exodus/service/www&lt;br /&gt;
&lt;br /&gt;
9: /root/exodus/test/src&lt;br /&gt;
    series of programs that test whether subroutines (specifically Exodus core libraries) work as they should eg for the var lib - &amp;quot;assert( var(&amp;quot;11111&amp;quot;).isnum());&amp;quot;&lt;br /&gt;
&lt;br /&gt;
10: bash /bin/top&lt;br /&gt;
    Monitor for NEOSYS client processes&lt;br /&gt;
    Displays customised format: sorted by total time spend and by processor time.&lt;br /&gt;
     Press &amp;quot;=&amp;quot; : to change to standard top format&lt;br /&gt;
     Press shift + w : to save format settings, replacing the old customised top format&lt;br /&gt;
     To go back to the customised format do:&lt;br /&gt;
        Press &amp;quot;o&amp;quot;&lt;br /&gt;
        Type &amp;quot;COMMAND=serve_agy&amp;quot;&lt;br /&gt;
        shift + t : this sorts by total time spent&lt;br /&gt;
        shift + p : this sorts by processor time&lt;br /&gt;
        shift + w : to save this setting and enter  &#039;y&#039; to confirm&lt;br /&gt;
&lt;br /&gt;
11: /var/log/syslog&lt;br /&gt;
     Log of NEOSYS client requests&lt;br /&gt;
&lt;br /&gt;
12: /root/exodus/service/quick&lt;br /&gt;
     Displays the last time the svr file (in /root/hosts/&amp;lt;client&amp;gt;/data/&amp;lt;dbname&amp;gt;) was updated.&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Object Code/Libraries==&lt;br /&gt;
LIVE and TEST processes use different sets of object code.&lt;br /&gt;
TEST processes use libraries in ~/lib/, whereas LIVE processes use object code in ~/neo/lib&lt;br /&gt;
&lt;br /&gt;
This means development &amp;amp; testing can be done stress free on TEST database, as opposed to testing on production databases.&lt;br /&gt;
&lt;br /&gt;
When compiling using edic, the TEST object code is updated if the compilation is successful. (~/lib)&lt;br /&gt;
&lt;br /&gt;
==Dictionaries &amp;amp; Psql Functions==&lt;br /&gt;
&lt;br /&gt;
Dictionaries - data used to describe other data; specifically the fields of other files. &lt;br /&gt;
&lt;br /&gt;
There are three types of fields: &amp;lt;pre&amp;gt;&lt;br /&gt;
(F) Field for raw data E.g &amp;quot;Office 44 Building Rush&amp;quot;&lt;br /&gt;
(S) Symbolic or calculated E.g for total ans=field1+field2&lt;br /&gt;
(G) General or Group E.g &amp;quot;@CRT&amp;quot; which contains always contains the default columns to show on the output of the list program; if no columns provided in list command.&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Show dictionary using &amp;quot;EXO_DATA=test list dict.clients&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
===Development and deployment using &#039;dat&#039; files===&lt;br /&gt;
&lt;br /&gt;
====Rationale====&lt;br /&gt;
&lt;br /&gt;
Part of system development is the creation of various data that is neither programs nor layout i.e. not cpp, h, html, js, php files etc.&lt;br /&gt;
&lt;br /&gt;
For example:&lt;br /&gt;
&lt;br /&gt;
*Dictionaries are data about data.&lt;br /&gt;
*Language files are data about text to use for various languages.&lt;br /&gt;
*“Change logs” are data about changes in the system.&lt;br /&gt;
&lt;br /&gt;
Historically, in EXODUS and NEOSYS, the above data has been deployed in exodus database files using SQL text files. However SQL files are not convenient for development.&lt;br /&gt;
&lt;br /&gt;
Therefore, &#039;dat&#039; text files will be used now so that standard development tools including editors and git can be fully exploited.&lt;br /&gt;
&lt;br /&gt;
====&#039;dat&#039; files====&lt;br /&gt;
&lt;br /&gt;
Each database file is represented by an os directory of the same name.&lt;br /&gt;
&lt;br /&gt;
Each record in the database file is represented by an os text file where filename is the primary key.&lt;br /&gt;
&lt;br /&gt;
For example a record with key &#039;&#039;&#039;DEADLINE&#039;&#039;&#039; in a dat file &#039;&#039;&#039;dict.materials&#039;&#039;&#039; would be represented as an os text file &#039;&#039;&#039;dat/dict.materials/DEADLINE&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Each line in the os text file represents one field in the db record. In other words, db record FM characters are represented by new line characters in &#039;dat&#039; files. Any actual new line characters required in the record, and any backslashes, are escaped and appear as &#039;\n&#039; and &#039;\\&#039; in &#039;dat&#039; files. Other database field separator characters such as VM, SM, TM and STM are stored without any conversion.&lt;br /&gt;
&lt;br /&gt;
====Location of dat files====&lt;br /&gt;
&lt;br /&gt;
The development versions are stored in exodus and neosys src/dat dirs. They form part of the standard git repositories in parallel with cpp files.&lt;br /&gt;
&lt;br /&gt;
The operational versions are stored in ~/dat and ~/live/dat alongside bin and lib dirs and are automatically installed into databases as database files on service startup. Any database functions embedded in the text files (pgsql) are also automatically installed at the same time.&lt;br /&gt;
&lt;br /&gt;
====Editing and deploying a &#039;dat&#039; file====&lt;br /&gt;
&lt;br /&gt;
It is currently a three step process to edit and deploy such &#039;dat&#039; files. &lt;br /&gt;
&lt;br /&gt;
=====Edit the &#039;dat&#039; file=====&lt;br /&gt;
&lt;br /&gt;
Note that EXODUS service and NEOSYS service have different src/dat folders.&lt;br /&gt;
&lt;br /&gt;
Editing language items:&lt;br /&gt;
&lt;br /&gt;
 edir dat/alanguage/SCHEDULES*ARABIC&lt;br /&gt;
&lt;br /&gt;
Editing a dictionary item:&lt;br /&gt;
&lt;br /&gt;
 edir dat/dict.materials/DEADLINE&lt;br /&gt;
&lt;br /&gt;
Editing a pgsql function in a dictionary:&lt;br /&gt;
&lt;br /&gt;
 edir dat/dict.materials/DEADLINE 8&lt;br /&gt;
&lt;br /&gt;
=====Copy all &#039;dat&#039; files to ~/dat =====&lt;br /&gt;
&lt;br /&gt;
This step might be removed at a later date.&lt;br /&gt;
&lt;br /&gt;
This will cause all test databases to immediately restart and load any &#039;dat&#039; file changes into dictionaries and data files and also create any new or modified pgsql functions.&lt;br /&gt;
&lt;br /&gt;
If any ~/neosys/src/dat files were edited:&lt;br /&gt;
&lt;br /&gt;
 cd ~/neosys/src&lt;br /&gt;
 &lt;br /&gt;
 ./compall dat&lt;br /&gt;
&lt;br /&gt;
and/or, if exodus/service/dat files were edited&lt;br /&gt;
&lt;br /&gt;
 cd ~/exodus/service/src&lt;br /&gt;
 &lt;br /&gt;
 ./compall dat&lt;br /&gt;
&lt;br /&gt;
=====Copy all programs and &#039;dat&#039; files to ~/live/bin|lib|dat=====&lt;br /&gt;
&lt;br /&gt;
This should only be run after testing. It will cause all live databases to automatically restart and do the same as the test databases mentioned above.&lt;br /&gt;
&lt;br /&gt;
 cd ~/exodus/service&lt;br /&gt;
 &lt;br /&gt;
 ./copyall CONFIRM&lt;br /&gt;
&lt;br /&gt;
=====Delete dat record =====&lt;br /&gt;
&lt;br /&gt;
Simply open the corresponding dat file, remove all lines and save.&lt;br /&gt;
&lt;br /&gt;
===Psql unaccent extension===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The unaccent extension and the immutable_unaccent function are created in the db ‘template1’ during exodus installation while user is postgres which is a superuser.&lt;br /&gt;
&lt;br /&gt;
Thereafter all new databases are created as copies of template1 so they contain the extension and function&lt;br /&gt;
&lt;br /&gt;
====Error====&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
MVDBException:ERROR: function immutable_unaccent(text) does not exist&lt;br /&gt;
ERROR:  permission denied to create extension &amp;quot;unaccent&amp;quot;&lt;br /&gt;
HINT:  Must be superuser to create this extension. &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====Solution====&lt;br /&gt;
sudo -u postgres psql -c &#039;ALTER USER exodus WITH SUPERUSER;&#039;&lt;br /&gt;
&lt;br /&gt;
==Processes==&lt;br /&gt;
The TEST process for all database use the same object code stored in /root/lib, whereas all LIVE process use the object code in /root/neo/.&lt;br /&gt;
&lt;br /&gt;
==Postgres==&lt;br /&gt;
Connect into postgres shell:&lt;br /&gt;
 alias psql=&#039;sudo -u postgres psql&#039;&lt;br /&gt;
&lt;br /&gt;
Delete a database:&lt;br /&gt;
 sudo -u postgres dropdb &amp;lt;dbcode&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Debugging Exodus==&lt;br /&gt;
&lt;br /&gt;
===Debugging Live/Test services===&lt;br /&gt;
&lt;br /&gt;
./test &amp;lt;dbname&amp;gt; - execute test programs on _test database.&lt;br /&gt;
&lt;br /&gt;
./run &amp;lt;dbname&amp;gt;  - execute test programs on live database.&lt;br /&gt;
&lt;br /&gt;
===Debugging var values===&lt;br /&gt;
&lt;br /&gt;
Explanation of var flag value in gdb debug mode.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
(gdb) p varx                                                           &lt;br /&gt;
$2 = {var_str = &amp;quot;&amp;quot;, var_int = 0, var_dbl = 0, var_typ = {flags_ = 2}}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Each exodus var object contains 3 variables of type string, int and double.&lt;br /&gt;
&lt;br /&gt;
All 3 may be unassigned or only the string be assigned or just the int and double e.t.&lt;br /&gt;
&lt;br /&gt;
You can tell which variable type of a var object are set based on the var&#039;s flag value.&lt;br /&gt;
&lt;br /&gt;
1 = Means the string is assigned&lt;br /&gt;
2 = Means the int is assigned&lt;br /&gt;
4 = Means the double is assigned&lt;br /&gt;
&lt;br /&gt;
Example: If the flag is 7 (1+2+4), then all types are assigned.&lt;br /&gt;
&lt;br /&gt;
====To inspect a “common” variable====&lt;br /&gt;
&lt;br /&gt;
e,g, a variable called ba.ledgern&lt;br /&gt;
&lt;br /&gt;
 p ((subExodusProgram::ba_common)ba).ledgern&lt;br /&gt;
&lt;br /&gt;
====To inspect a common block====&lt;br /&gt;
&lt;br /&gt;
e.g. a common block ba&lt;br /&gt;
&lt;br /&gt;
 ptype (subExodusProgram::ba_common)ba&lt;br /&gt;
&lt;br /&gt;
====To dump all variables in a common====&lt;br /&gt;
&lt;br /&gt;
e.g all variables in ba&lt;br /&gt;
&lt;br /&gt;
 p (subExodusProgram::ba_common)ba&lt;br /&gt;
&lt;br /&gt;
====What types are available in a program?====&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;info types common&lt;br /&gt;
info types subExodus&lt;br /&gt;
info types libexodus&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====Other commands====&lt;br /&gt;
&lt;br /&gt;
 explore subExodusProgram::ba_common&lt;br /&gt;
&lt;br /&gt;
===Process Hung or consuming +100% CPU===&lt;br /&gt;
If process is consuming +100% CPU then it is likely stuck in an infinite loop.&lt;br /&gt;
&lt;br /&gt;
 ./doall &amp;lt;CLIENT&amp;gt; stop&lt;br /&gt;
&lt;br /&gt;
 ./run &amp;lt;CLIENT&amp;gt; &lt;br /&gt;
&lt;br /&gt;
 ./test &amp;lt;CLIENT&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Search through recent logs for &amp;lt;CLIENT&amp;gt; looking for requests that didn&#039;t return OK at the time nagios alerted of Hung process.&lt;br /&gt;
&lt;br /&gt;
A user may also instigate the error again, so monitor the CLIENT&#039;s service CPU usage.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
If cause found recreate it in test and once test process hit +100% break in test debugger.&lt;br /&gt;
&lt;br /&gt;
If cause not found, you will have to continue checking logs for the request that caused it or hope a user recreates the issue in live debugged service.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Once you&#039;ve broken in the debugged with the error, enter &amp;quot;n&amp;quot; and hold the enter key until you just seeing line repeat.&lt;br /&gt;
&lt;br /&gt;
Pay attention to start of loops code. E.g WHILE or FOR. (there is likely an error is there)&lt;br /&gt;
&lt;br /&gt;
==./doall==&lt;br /&gt;
====General====&lt;br /&gt;
&lt;br /&gt;
~/neosys/doall [LIVE|TEST] &amp;lt;DBCODE|ALL&amp;gt; &amp;lt; ACTION [OPTIONS,..]  | bash -- COMMAND ]&lt;br /&gt;
&lt;br /&gt;
Example: &lt;br /&gt;
 ./doall TEST ALL create_site t-&lt;br /&gt;
Result:&lt;br /&gt;
Create site for ALL TEST databases, using domain name prefix option &amp;quot;t-&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Screen 6: ./doall script contains all the necessary information(codes) to setup an installation.&lt;br /&gt;
It includes scripts to backup, restore, create an Apache site, create/start/stop/status a service, import an AREV database into postgres and more.&lt;br /&gt;
&lt;br /&gt;
====backup_db====&lt;br /&gt;
&lt;br /&gt;
*Does a backup &amp;amp; restore of a LIVE database into the corresponding TEST database.&lt;br /&gt;
*Backup &amp;lt;dbcode&amp;gt;.sql file is written to /root/backups/sql; which is rsynced to nl19:/backups/current/exodus/&lt;br /&gt;
*Unlike AREV, postgres can perform a &amp;quot;backup&amp;quot; of a database whilst the system is in use.&lt;br /&gt;
&lt;br /&gt;
==Git==&lt;br /&gt;
&lt;br /&gt;
There are two repositories, one for EXODUS and the other for NEOSYS.&lt;br /&gt;
&lt;br /&gt;
===Using git to make changes===&lt;br /&gt;
&lt;br /&gt;
Before following steps you must have a tested updated to a program/file/script. Do not commit untested changes to avoid a messy git history of reverts.&lt;br /&gt;
&lt;br /&gt;
Update your local repo before committing to local repo using the g alias for &amp;quot;git pull --ff-only ; git push &amp;amp;&amp;amp; git status&#039;&amp;quot;:&lt;br /&gt;
&amp;lt;pre&amp;gt;g&amp;lt;/pre&amp;gt;&lt;br /&gt;
Check which updates/files have not yet been staged and/or committed:&lt;br /&gt;
Add your updates to the staged area:&lt;br /&gt;
&amp;lt;pre&amp;gt;git add &amp;lt;filename&amp;gt;&amp;lt;/pre&amp;gt;&lt;br /&gt;
or if all the changes made need to be staged:&lt;br /&gt;
&amp;lt;pre&amp;gt;git add -a&amp;lt;/pre&amp;gt;&lt;br /&gt;
Make a commit with a descriptive message on purpose of updates:&lt;br /&gt;
&amp;lt;pre&amp;gt;git commit -m &amp;lt;description n purpose of changes&amp;gt;&amp;lt;/pre&amp;gt;&lt;br /&gt;
Again use g alias:&lt;br /&gt;
&amp;lt;pre&amp;gt;g&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Other useful git cmds===&lt;br /&gt;
&lt;br /&gt;
Do not use this commands unless you know what WILL happen. &lt;br /&gt;
*git pull - Instead use the safe &amp;quot;git pull --ff-only&amp;quot;&lt;br /&gt;
Stick to the alias &amp;quot;g&amp;quot; which does &amp;quot;git pull --ff-only ; git push &amp;amp;&amp;amp; git status&#039;&amp;quot;&lt;br /&gt;
&lt;br /&gt;
*git log - display history of commits to master branch&lt;br /&gt;
*git diff - display the differences in files between working files and files in local repo.&lt;br /&gt;
*git status - display: which updated files are staged/not staged(tracked)&lt;br /&gt;
*git stash - &lt;br /&gt;
*git branch - switch to a new branch&lt;br /&gt;
*git branch &amp;lt;branchname&amp;gt; - will switch to this branch only if it exists&lt;br /&gt;
*git checkout - DESTROYS/Updates the state of local working directory with the state of the files in the local repo. (YOU WILL LOSE non staged updates)&lt;br /&gt;
*git restore &amp;lt;filename&amp;gt; - DESTROYS/Updates the file with the version in the local repo. (like with git checkout but for a specific file)&lt;br /&gt;
*git checkin - &lt;br /&gt;
*git revert &amp;lt;commitHash&amp;gt; - reverses a specific commit (use git log to get the chosen commit hash)&lt;br /&gt;
*git ..&lt;br /&gt;
&lt;br /&gt;
==Converting AREV programs to EXODUS==&lt;br /&gt;
===Decompile AREV to C++===&lt;br /&gt;
&lt;br /&gt;
Do in Master AREV Installation Maintenance mode: (win7)&lt;br /&gt;
&lt;br /&gt;
#ATTACH ADECOMC &lt;br /&gt;
#*ADECOM &amp;lt;programname&amp;gt;   *single program&lt;br /&gt;
#*ADECOM &amp;lt;prog1&amp;gt; &amp;lt;prog2&amp;gt; &lt;br /&gt;
#*ADECOMALL              *all programs   (CHECK FIRST)&lt;br /&gt;
&lt;br /&gt;
Include the option &amp;quot;(V)&amp;quot; in the command to print the C++ to a notepad, which can easily be copy and pasted.&lt;br /&gt;
&lt;br /&gt;
===Getting C++ program to Exodus Installation===&lt;br /&gt;
&lt;br /&gt;
Two methods: (use the first for one off programs)&lt;br /&gt;
&lt;br /&gt;
====Copy &amp;amp; Paste====&lt;br /&gt;
&lt;br /&gt;
Compile program and open source code in notepad&lt;br /&gt;
&lt;br /&gt;
 ADECOM &amp;lt;programname&amp;gt; (V)&lt;br /&gt;
&lt;br /&gt;
Find which directory the program belongs. e.g fin/med/job/sys e.t&lt;br /&gt;
&lt;br /&gt;
 find /cygdrive/d/exodus/pickos | grep &amp;lt;program name&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If cpp in SYS, the program belongs in ~/exodus/service/src OR if in MED JOB FIN GEN AGY the program belongs in ~/neosys/src&lt;br /&gt;
&lt;br /&gt;
Copy the source code in the text file from the first command.&lt;br /&gt;
&lt;br /&gt;
In Exodus, create a new .cpp (in correct directory) and paste the source code.&lt;br /&gt;
&lt;br /&gt;
Compile &amp;amp; Test&lt;br /&gt;
&lt;br /&gt;
====Rsync====&lt;br /&gt;
&lt;br /&gt;
 /d/exodus/arev/syncup.sh&lt;br /&gt;
&lt;br /&gt;
If cpp in SYS then: ~/exodus/service/src ./getpickos&lt;br /&gt;
&lt;br /&gt;
If cpp in MED JOB FIN GEN AGY then: *~/neosys/src&lt;br /&gt;
&lt;br /&gt;
===Compile C++ files to TEST system===&lt;br /&gt;
&lt;br /&gt;
#*./test &amp;lt;DBNAME&amp;gt;&lt;br /&gt;
#*~/neosys ./doall TEST &amp;lt;DBNAME&amp;gt; restart    #to get one service to start start using the new lib files&lt;br /&gt;
#*~/neosys ./doall TEST all restart         #to get all the services to start start using the new lib files&lt;br /&gt;
&lt;br /&gt;
===Install C++ files to LIVE System===&lt;br /&gt;
&lt;br /&gt;
#~/exodus/service/ ./copyall            #to copy all the ~/lib and bin files to ~/live/lib and bin ... which is used by all exodus/live services&lt;br /&gt;
&lt;br /&gt;
==Writing Standard Exodus Core Function/Method Testing==&lt;br /&gt;
Screen 9: ~/exodus/test/src/&lt;br /&gt;
There are a series of test programs that check whether methods/functions behave as intended.&lt;br /&gt;
They do this using the function, assert.. a 1 or more argument values produce one and only one output)&lt;br /&gt;
&lt;br /&gt;
e.g test_multilang.cpp or test_sort.cpp&lt;br /&gt;
&lt;br /&gt;
Two methods of running test programs:&lt;br /&gt;
*Screen 9: make test&lt;br /&gt;
*after compiling using edic/compile/c, enter test_prog_name. (Since compile has moved it to ~/bin)&lt;br /&gt;
&lt;br /&gt;
Difference between the two methods is make calls gdb directly;&lt;br /&gt;
whereas ~/bin/test_prog_name uses exodus compile program&lt;br /&gt;
#~/neosys ./doall LIVE all restart&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Upgrading Exodus==&lt;br /&gt;
&lt;br /&gt;
#Develop patch in Dev system &lt;br /&gt;
&lt;br /&gt;
===Patching neosys/src or exodus/service/src===&lt;br /&gt;
&lt;br /&gt;
#Manually insert patches and compile into test programs.&lt;br /&gt;
#If patch dat files then run neosys/compall to get dat files into ~/dat&lt;br /&gt;
*If Patsalides:&lt;br /&gt;
*#SITE_DIR=ptcy ./test basic &lt;br /&gt;
*#login to BASIC_TEST and test&lt;br /&gt;
*Other clients:&lt;br /&gt;
*#./test DBCODE&lt;br /&gt;
*#login to DBCODE and test patches works&lt;br /&gt;
#run exodus/service/copyall and check only the patched programs are listed. (if not, see Troubleshoot below)&lt;br /&gt;
#Inform users to log off for 10mins. As a rule of thumb, live services must be stopped before copying test programs to live.&lt;br /&gt;
#exodus/service/copyall CONFIRM&lt;br /&gt;
&lt;br /&gt;
====Troubleshoot====&lt;br /&gt;
&lt;br /&gt;
=====./copyall lists programs you have not patched=====&lt;br /&gt;
Use exodus/service/copyone to copy only your patched programs one by one. (./copyone will not copy dat files)&lt;br /&gt;
&lt;br /&gt;
===Upgrading to new version===&lt;br /&gt;
&lt;br /&gt;
READ: remember there is no test version of libexodus programs. This means that if libexodus programs are compiled and installed, neosys/src and exodus/services LIVE programs MUST BE UPGRADED.&lt;br /&gt;
&lt;br /&gt;
#Upgrade test system to test&lt;br /&gt;
##If a dev system like de2, git stash any uncommitted changes other staff may be working on.&lt;br /&gt;
##Run &amp;quot;g&amp;quot; in ~/exodus (to do git pull --ff-only)&lt;br /&gt;
##Run &amp;quot;m&amp;quot; in ~/exodus (to compile and install libexodus)&lt;br /&gt;
##Run &amp;quot;~/neosys/upgrade.all.sh live&amp;quot; in ~/neosys (to upgrade exodus/service and neosys/src live programs)&lt;br /&gt;
##Begin testing&lt;br /&gt;
#Upgrade clients&lt;br /&gt;
##*Client hosted - Schedule a planned upgrade with client.&lt;br /&gt;
##*NEOSYS hosted - Inform all clients/users of planned morning upgrade, 24hours in advanced.      (TODO: &#039;What&#039;s New in NEOSYS&#039;) AND (emailallusers.cpp)&lt;br /&gt;
##Day of upgrade, check USB backup was successful &amp;amp; make a container snapshot, otherwise do not proceed.&lt;br /&gt;
##Stop services&lt;br /&gt;
##Run &amp;quot;g&amp;quot; in ~/exodus (to do git pull --ff-only)&lt;br /&gt;
##Run &amp;quot;m&amp;quot; in ~/exodus (to compile and install libexodus)&lt;br /&gt;
##Run &amp;quot;~/neosys/upgrade.all.sh live&amp;quot;. &lt;br /&gt;
##Check services started automatically without issues.&lt;br /&gt;
#Inform users their system has been upgraded and they can login.&lt;br /&gt;
&lt;br /&gt;
===Roll Back Upgrade===&lt;br /&gt;
&lt;br /&gt;
If for any reason the entire upgrade needs to be reverted (excludes clients database), follow steps below:&lt;br /&gt;
&lt;br /&gt;
#Inform users that there is a problem and services need to be stopped.&lt;br /&gt;
#Stop all exodus processes.&lt;br /&gt;
#Restore the morning&#039;s USB backup by: (Note this backup contains:  source/obj code, /etc, neosys scripts but not client data)&lt;br /&gt;
##Login into container&#039;s host and rsync the morning&#039;s usb backup to the container&#039;s /:&lt;br /&gt;
#*&amp;lt;pre&amp;gt;rsync --dry-run -avz -e &#039;ssh -p &amp;lt;C_SSHPORT&amp;gt;&#039; /backups/usb/&amp;lt;C_CODE&amp;gt; &amp;lt;C_CODE&amp;gt;:/      (Example: rsync --dry-run -avz -e &#039;ssh -p 19582&#039; /backups/usb/ad1 ad1:/&amp;lt;/pre&amp;gt;)&lt;br /&gt;
#Quick sane check, the latest git commit is not the latest git commit in the remote repo.&lt;br /&gt;
#Inform users they can login.&lt;br /&gt;
&lt;br /&gt;
==Configuring services to autostart during login==&lt;br /&gt;
For Ptcy.&lt;br /&gt;
&lt;br /&gt;
#Create a file &#039;autostart.cfg&#039; in the data folder &lt;br /&gt;
&lt;br /&gt;
 touch /root/hosts/&amp;lt;dbname&amp;gt;/data/autostart.cfg&lt;br /&gt;
&lt;br /&gt;
This will autostart a database service as long as at least one database service in that directory is running.&lt;br /&gt;
&lt;br /&gt;
For example, demo service will autostart during login if,&lt;br /&gt;
#/root/hosts/demo/data/autostart.cfg exists and&lt;br /&gt;
#demo_test service is running&lt;br /&gt;
&lt;br /&gt;
==Speedup postgresql importing databases==&lt;br /&gt;
&lt;br /&gt;
Can be sped up by a factor of 10 BUT may result in corrupt files in case of hard OS crash where the dirty memory is not flushed to storage.&lt;br /&gt;
&lt;br /&gt;
Therefore it is advisable to use this feature only briefly and REMEMBER TO REMOVE IT! &lt;br /&gt;
&lt;br /&gt;
Email to support@neosys.com whenever using it or use personal notes not memory.&lt;br /&gt;
&lt;br /&gt;
nano /etc/postgresql/12/main/postgresql.conf&lt;br /&gt;
&lt;br /&gt;
Uncomment or add a line&lt;br /&gt;
 fsync = off&lt;br /&gt;
Restart postgres … will break any neosys/exodus running processes.&lt;br /&gt;
 r postgresql&lt;br /&gt;
or reload postgres may also work&lt;br /&gt;
&lt;br /&gt;
==Database Attach==&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
root@exodus:~/exodus/cli/src# dbattach&lt;br /&gt;
dbattach - Attach foreign database files to the current default database&lt;br /&gt;
&lt;br /&gt;
Syntax is dbattach TARGETDB [FILENAME,...] {OPTION...}&lt;br /&gt;
&lt;br /&gt;
Options:&lt;br /&gt;
&lt;br /&gt;
  F   Forcibly delete any normal files in the current default database.&lt;br /&gt;
&lt;br /&gt;
  R   Detach foreign files&lt;br /&gt;
  RR  Remove foreign database connection.&lt;br /&gt;
  RRR Remove all foreign database connections and attachments.&lt;br /&gt;
&lt;br /&gt;
  L   List attached foreign files in the current default database&lt;br /&gt;
&lt;br /&gt;
If no filenames are provided then a database connection is created.&lt;br /&gt;
This is *required* before filenames can be provided and attached.&lt;br /&gt;
&lt;br /&gt;
Notes:&lt;br /&gt;
&lt;br /&gt;
Attachments are permanent until re-attached or removed.&lt;br /&gt;
&lt;br /&gt;
Indexes on attached files behave strangely.&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Issues:&lt;br /&gt;
&lt;br /&gt;
TARGETDB must be on the same connection as the current default database.&lt;br /&gt;
&lt;br /&gt;
Current user must have access to the foreign database.&lt;br /&gt;
&lt;br /&gt;
If EXO_USER and EXO_PASS are not set then exodus defaults are used.&lt;br /&gt;
&lt;br /&gt;
exodus .config file is not used currently.&lt;/div&gt;</summary>
		<author><name>Gregory</name></author>
	</entry>
	<entry>
		<id>https://techwiki.neosys.com/index.php?title=EXODUS_Knowledge&amp;diff=4000</id>
		<title>EXODUS Knowledge</title>
		<link rel="alternate" type="text/html" href="https://techwiki.neosys.com/index.php?title=EXODUS_Knowledge&amp;diff=4000"/>
		<updated>2022-10-13T05:16:03Z</updated>

		<summary type="html">&lt;p&gt;Gregory: /* Copy all programs and &amp;#039;dat&amp;#039; files to ~/live/bin|lib|dat */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==TMUX Screens==&lt;br /&gt;
&lt;br /&gt;
To create the EXODUS maintenance/programming environment&lt;br /&gt;
 exodus#: ./tmux.exodus&lt;br /&gt;
&lt;br /&gt;
===Screens===&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
0: /&lt;br /&gt;
    General work for server services/configs. i.e /etc/nagios, /etc/apache2, /var/log/mail.log or general networking.&lt;br /&gt;
&lt;br /&gt;
1: /root/exodus/&lt;br /&gt;
    Exodus core is installed. Contains build and make libraries here ./libexodus&lt;br /&gt;
&lt;br /&gt;
2: /root/exodus/libexodus/exodus&lt;br /&gt;
    Core exodus library source code which emulate the AREV system e.g var.cpp&lt;br /&gt;
    &lt;br /&gt;
3: /root/exodus/cli/src&lt;br /&gt;
    Exodus Command Line Interface E.g edir, edic, list, listfiles, delete, createdb, deletedb.&lt;br /&gt;
    &lt;br /&gt;
4: root/exodus/service&lt;br /&gt;
    EXODUS core default host directory but also contains scripts that create/manage requirements of a service (create_service, create_db, create_site, backup_db, restore_db, start, stop, status)&lt;br /&gt;
    The www/3/exodus has generic .htm, php and .js which provide basic website functionality i.e Login page, Support Menu, User details, Authorization.&lt;br /&gt;
    NEOSYS www files linked into ./www, from /root/neosys/web, which pulled from NEOSYS www git.&lt;br /&gt;
&lt;br /&gt;
5: /root/exodus/service/src&lt;br /&gt;
    Exodus core service programs (programs that are not related to NEOSYS agency operations and can be used to support other non-NEOSYS services) eg listen, usersubs, sendmail, openfile, select, sort, list,.&lt;br /&gt;
&lt;br /&gt;
    Extra info:    &lt;br /&gt;
    The dat/ has generic dictionary files. (See Section Dictionaries &amp;amp; Psql Functions)&lt;br /&gt;
    TODO: compall currently throws few warnings. Read them and familiarise. In case new warnings appear, notify Steve.    &lt;br /&gt;
        &lt;br /&gt;
6: /root/neosys&lt;br /&gt;
    NEOSYS specific client installation &amp;amp; management scripts e.g .doall, import_db and import_files (from AREV), ./run ./test (see below for these two commands)&lt;br /&gt;
    &lt;br /&gt;
7: /root/neosys/src&lt;br /&gt;
    NEOSYS Agency programs (see section How AREV programs are distributed in EXODUS src/*.cpp&lt;br /&gt;
    /root/neosys has the neosys .git&lt;br /&gt;
&lt;br /&gt;
8: /root/hosts&lt;br /&gt;
    client specific files  e.g logs, images, (shared ./www -&amp;gt; root/exodus/service/www&lt;br /&gt;
&lt;br /&gt;
9: /root/exodus/test/src&lt;br /&gt;
    series of programs that test whether subroutines (specifically Exodus core libraries) work as they should eg for the var lib - &amp;quot;assert( var(&amp;quot;11111&amp;quot;).isnum());&amp;quot;&lt;br /&gt;
&lt;br /&gt;
10: bash /bin/top&lt;br /&gt;
    Monitor for NEOSYS client processes&lt;br /&gt;
    Displays customised format: sorted by total time spend and by processor time.&lt;br /&gt;
     Press &amp;quot;=&amp;quot; : to change to standard top format&lt;br /&gt;
     Press shift + w : to save format settings, replacing the old customised top format&lt;br /&gt;
     To go back to the customised format do:&lt;br /&gt;
        Press &amp;quot;o&amp;quot;&lt;br /&gt;
        Type &amp;quot;COMMAND=serve_agy&amp;quot;&lt;br /&gt;
        shift + t : this sorts by total time spent&lt;br /&gt;
        shift + p : this sorts by processor time&lt;br /&gt;
        shift + w : to save this setting and enter  &#039;y&#039; to confirm&lt;br /&gt;
&lt;br /&gt;
11: /var/log/syslog&lt;br /&gt;
     Log of NEOSYS client requests&lt;br /&gt;
&lt;br /&gt;
12: /root/exodus/service/quick&lt;br /&gt;
     Displays the last time the svr file (in /root/hosts/&amp;lt;client&amp;gt;/data/&amp;lt;dbname&amp;gt;) was updated.&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Object Code/Libraries==&lt;br /&gt;
LIVE and TEST processes use different sets of object code.&lt;br /&gt;
TEST processes use libraries in ~/lib/, whereas LIVE processes use object code in ~/neo/lib&lt;br /&gt;
&lt;br /&gt;
This means development &amp;amp; testing can be done stress free on TEST database, as opposed to testing on production databases.&lt;br /&gt;
&lt;br /&gt;
When compiling using edic, the TEST object code is updated if the compilation is successful. (~/lib)&lt;br /&gt;
&lt;br /&gt;
==Dictionaries &amp;amp; Psql Functions==&lt;br /&gt;
&lt;br /&gt;
Dictionaries - data used to describe other data; specifically the fields of other files. &lt;br /&gt;
&lt;br /&gt;
There are three types of fields: &amp;lt;pre&amp;gt;&lt;br /&gt;
(F) Field for raw data E.g &amp;quot;Office 44 Building Rush&amp;quot;&lt;br /&gt;
(S) Symbolic or calculated E.g for total ans=field1+field2&lt;br /&gt;
(G) General or Group E.g &amp;quot;@CRT&amp;quot; which contains always contains the default columns to show on the output of the list program; if no columns provided in list command.&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Show dictionary using &amp;quot;EXO_DATA=test list dict.clients&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
===Development and deployment using &#039;dat&#039; files===&lt;br /&gt;
&lt;br /&gt;
====Rationale====&lt;br /&gt;
&lt;br /&gt;
Part of system development is the creation of various data that is neither programs nor layout i.e. not cpp, h, html, js, php files etc.&lt;br /&gt;
&lt;br /&gt;
For example:&lt;br /&gt;
&lt;br /&gt;
*Dictionaries are data about data.&lt;br /&gt;
*Language files are data about text to use for various languages.&lt;br /&gt;
*“Change logs” are data about changes in the system.&lt;br /&gt;
&lt;br /&gt;
Historically, in EXODUS and NEOSYS, the above data has been deployed in exodus database files using SQL text files. However SQL files are not convenient for development.&lt;br /&gt;
&lt;br /&gt;
Therefore, &#039;dat&#039; text files will be used now so that standard development tools including editors and git can be fully exploited.&lt;br /&gt;
&lt;br /&gt;
====&#039;dat&#039; files====&lt;br /&gt;
&lt;br /&gt;
Each database file is represented by an os directory of the same name.&lt;br /&gt;
&lt;br /&gt;
Each record in the database file is represented by an os text file where filename is the primary key.&lt;br /&gt;
&lt;br /&gt;
For example a record with key &#039;&#039;&#039;DEADLINE&#039;&#039;&#039; in a dat file &#039;&#039;&#039;dict.materials&#039;&#039;&#039; would be represented as an os text file &#039;&#039;&#039;dat/dict.materials/DEADLINE&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Each line in the os text file represents one field in the db record. In other words, db record FM characters are represented by new line characters in &#039;dat&#039; files. Any actual new line characters required in the record, and any backslashes, are escaped and appear as &#039;\n&#039; and &#039;\\&#039; in &#039;dat&#039; files. Other database field separator characters such as VM, SM, TM and STM are stored without any conversion.&lt;br /&gt;
&lt;br /&gt;
====Location of dat files====&lt;br /&gt;
&lt;br /&gt;
The development versions are stored in exodus and neosys src/dat dirs. They form part of the standard git repositories in parallel with cpp files.&lt;br /&gt;
&lt;br /&gt;
The operational versions are stored in ~/dat and ~/live/dat alongside bin and lib dirs and are automatically installed into databases as database files on service startup. Any database functions embedded in the text files (pgsql) are also automatically installed at the same time.&lt;br /&gt;
&lt;br /&gt;
====Editing and deploying a &#039;dat&#039; file====&lt;br /&gt;
&lt;br /&gt;
It is currently a three step process to edit and deploy such &#039;dat&#039; files. &lt;br /&gt;
&lt;br /&gt;
=====Edit the &#039;dat&#039; file=====&lt;br /&gt;
&lt;br /&gt;
Note that EXODUS service and NEOSYS service have different src/dat folders.&lt;br /&gt;
&lt;br /&gt;
Editing language items:&lt;br /&gt;
&lt;br /&gt;
 edir dat/alanguage/SCHEDULES*ARABIC&lt;br /&gt;
&lt;br /&gt;
Editing a dictionary item:&lt;br /&gt;
&lt;br /&gt;
 edir dat/dict.materials/DEADLINE&lt;br /&gt;
&lt;br /&gt;
Editing a pgsql function in a dictionary:&lt;br /&gt;
&lt;br /&gt;
 edir dat/dict.materials/DEADLINE 8&lt;br /&gt;
&lt;br /&gt;
=====Copy all &#039;dat&#039; files to ~/dat =====&lt;br /&gt;
&lt;br /&gt;
This step might be removed at a later date.&lt;br /&gt;
&lt;br /&gt;
This will cause all test databases to immediately restart and load any &#039;dat&#039; file changes into dictionaries and data files and also create any new or modified pgsql functions.&lt;br /&gt;
&lt;br /&gt;
If any ~/neosys/src/dat files were edited:&lt;br /&gt;
&lt;br /&gt;
 cd ~/neosys/src&lt;br /&gt;
 &lt;br /&gt;
 ./compall dat&lt;br /&gt;
&lt;br /&gt;
and/or, if exodus/service/dat files were edited&lt;br /&gt;
&lt;br /&gt;
 cd ~/exodus/service/src&lt;br /&gt;
 &lt;br /&gt;
 ./compall dat&lt;br /&gt;
&lt;br /&gt;
=====Copy all programs and &#039;dat&#039; files to ~/live/bin|lib|dat=====&lt;br /&gt;
&lt;br /&gt;
This should only be run after testing. It will cause all live databases to automatically restart and do the same as the test databases mentioned above.&lt;br /&gt;
&lt;br /&gt;
 cd ~/exodus/service&lt;br /&gt;
 &lt;br /&gt;
 ./copyall CONFIRM&lt;br /&gt;
​&lt;br /&gt;
=====Delete dat record =====&lt;br /&gt;
&lt;br /&gt;
Simply open the corresponding dat file, remove all lines and save.&lt;br /&gt;
&lt;br /&gt;
===Psql unaccent extension===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The unaccent extension and the immutable_unaccent function are created in the db ‘template1’ during exodus installation while user is postgres which is a superuser.&lt;br /&gt;
&lt;br /&gt;
Thereafter all new databases are created as copies of template1 so they contain the extension and function&lt;br /&gt;
&lt;br /&gt;
====Error====&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
MVDBException:ERROR: function immutable_unaccent(text) does not exist&lt;br /&gt;
ERROR:  permission denied to create extension &amp;quot;unaccent&amp;quot;&lt;br /&gt;
HINT:  Must be superuser to create this extension. &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====Solution====&lt;br /&gt;
sudo -u postgres psql -c &#039;ALTER USER exodus WITH SUPERUSER;&#039;&lt;br /&gt;
&lt;br /&gt;
==Processes==&lt;br /&gt;
The TEST process for all database use the same object code stored in /root/lib, whereas all LIVE process use the object code in /root/neo/.&lt;br /&gt;
&lt;br /&gt;
==Postgres==&lt;br /&gt;
Connect into postgres shell:&lt;br /&gt;
 alias psql=&#039;sudo -u postgres psql&#039;&lt;br /&gt;
&lt;br /&gt;
Delete a database:&lt;br /&gt;
 sudo -u postgres dropdb &amp;lt;dbcode&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Debugging Exodus==&lt;br /&gt;
&lt;br /&gt;
===Debugging Live/Test services===&lt;br /&gt;
&lt;br /&gt;
./test &amp;lt;dbname&amp;gt; - execute test programs on _test database.&lt;br /&gt;
&lt;br /&gt;
./run &amp;lt;dbname&amp;gt;  - execute test programs on live database.&lt;br /&gt;
&lt;br /&gt;
===Debugging var values===&lt;br /&gt;
&lt;br /&gt;
Explanation of var flag value in gdb debug mode.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
(gdb) p varx                                                           &lt;br /&gt;
$2 = {var_str = &amp;quot;&amp;quot;, var_int = 0, var_dbl = 0, var_typ = {flags_ = 2}}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Each exodus var object contains 3 variables of type string, int and double.&lt;br /&gt;
&lt;br /&gt;
All 3 may be unassigned or only the string be assigned or just the int and double e.t.&lt;br /&gt;
&lt;br /&gt;
You can tell which variable type of a var object are set based on the var&#039;s flag value.&lt;br /&gt;
&lt;br /&gt;
1 = Means the string is assigned&lt;br /&gt;
2 = Means the int is assigned&lt;br /&gt;
4 = Means the double is assigned&lt;br /&gt;
&lt;br /&gt;
Example: If the flag is 7 (1+2+4), then all types are assigned.&lt;br /&gt;
&lt;br /&gt;
====To inspect a “common” variable====&lt;br /&gt;
&lt;br /&gt;
e,g, a variable called ba.ledgern&lt;br /&gt;
&lt;br /&gt;
 p ((subExodusProgram::ba_common)ba).ledgern&lt;br /&gt;
&lt;br /&gt;
====To inspect a common block====&lt;br /&gt;
&lt;br /&gt;
e.g. a common block ba&lt;br /&gt;
&lt;br /&gt;
 ptype (subExodusProgram::ba_common)ba&lt;br /&gt;
&lt;br /&gt;
====To dump all variables in a common====&lt;br /&gt;
&lt;br /&gt;
e.g all variables in ba&lt;br /&gt;
&lt;br /&gt;
 p (subExodusProgram::ba_common)ba&lt;br /&gt;
&lt;br /&gt;
====What types are available in a program?====&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;info types common&lt;br /&gt;
info types subExodus&lt;br /&gt;
info types libexodus&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====Other commands====&lt;br /&gt;
&lt;br /&gt;
 explore subExodusProgram::ba_common&lt;br /&gt;
&lt;br /&gt;
===Process Hung or consuming +100% CPU===&lt;br /&gt;
If process is consuming +100% CPU then it is likely stuck in an infinite loop.&lt;br /&gt;
&lt;br /&gt;
 ./doall &amp;lt;CLIENT&amp;gt; stop&lt;br /&gt;
&lt;br /&gt;
 ./run &amp;lt;CLIENT&amp;gt; &lt;br /&gt;
&lt;br /&gt;
 ./test &amp;lt;CLIENT&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Search through recent logs for &amp;lt;CLIENT&amp;gt; looking for requests that didn&#039;t return OK at the time nagios alerted of Hung process.&lt;br /&gt;
&lt;br /&gt;
A user may also instigate the error again, so monitor the CLIENT&#039;s service CPU usage.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
If cause found recreate it in test and once test process hit +100% break in test debugger.&lt;br /&gt;
&lt;br /&gt;
If cause not found, you will have to continue checking logs for the request that caused it or hope a user recreates the issue in live debugged service.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Once you&#039;ve broken in the debugged with the error, enter &amp;quot;n&amp;quot; and hold the enter key until you just seeing line repeat.&lt;br /&gt;
&lt;br /&gt;
Pay attention to start of loops code. E.g WHILE or FOR. (there is likely an error is there)&lt;br /&gt;
&lt;br /&gt;
==./doall==&lt;br /&gt;
====General====&lt;br /&gt;
&lt;br /&gt;
~/neosys/doall [LIVE|TEST] &amp;lt;DBCODE|ALL&amp;gt; &amp;lt; ACTION [OPTIONS,..]  | bash -- COMMAND ]&lt;br /&gt;
&lt;br /&gt;
Example: &lt;br /&gt;
 ./doall TEST ALL create_site t-&lt;br /&gt;
Result:&lt;br /&gt;
Create site for ALL TEST databases, using domain name prefix option &amp;quot;t-&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Screen 6: ./doall script contains all the necessary information(codes) to setup an installation.&lt;br /&gt;
It includes scripts to backup, restore, create an Apache site, create/start/stop/status a service, import an AREV database into postgres and more.&lt;br /&gt;
&lt;br /&gt;
====backup_db====&lt;br /&gt;
&lt;br /&gt;
*Does a backup &amp;amp; restore of a LIVE database into the corresponding TEST database.&lt;br /&gt;
*Backup &amp;lt;dbcode&amp;gt;.sql file is written to /root/backups/sql; which is rsynced to nl19:/backups/current/exodus/&lt;br /&gt;
*Unlike AREV, postgres can perform a &amp;quot;backup&amp;quot; of a database whilst the system is in use.&lt;br /&gt;
&lt;br /&gt;
==Git==&lt;br /&gt;
&lt;br /&gt;
There are two repositories, one for EXODUS and the other for NEOSYS.&lt;br /&gt;
&lt;br /&gt;
===Using git to make changes===&lt;br /&gt;
&lt;br /&gt;
Before following steps you must have a tested updated to a program/file/script. Do not commit untested changes to avoid a messy git history of reverts.&lt;br /&gt;
&lt;br /&gt;
Update your local repo before committing to local repo using the g alias for &amp;quot;git pull --ff-only ; git push &amp;amp;&amp;amp; git status&#039;&amp;quot;:&lt;br /&gt;
&amp;lt;pre&amp;gt;g&amp;lt;/pre&amp;gt;&lt;br /&gt;
Check which updates/files have not yet been staged and/or committed:&lt;br /&gt;
Add your updates to the staged area:&lt;br /&gt;
&amp;lt;pre&amp;gt;git add &amp;lt;filename&amp;gt;&amp;lt;/pre&amp;gt;&lt;br /&gt;
or if all the changes made need to be staged:&lt;br /&gt;
&amp;lt;pre&amp;gt;git add -a&amp;lt;/pre&amp;gt;&lt;br /&gt;
Make a commit with a descriptive message on purpose of updates:&lt;br /&gt;
&amp;lt;pre&amp;gt;git commit -m &amp;lt;description n purpose of changes&amp;gt;&amp;lt;/pre&amp;gt;&lt;br /&gt;
Again use g alias:&lt;br /&gt;
&amp;lt;pre&amp;gt;g&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Other useful git cmds===&lt;br /&gt;
&lt;br /&gt;
Do not use this commands unless you know what WILL happen. &lt;br /&gt;
*git pull - Instead use the safe &amp;quot;git pull --ff-only&amp;quot;&lt;br /&gt;
Stick to the alias &amp;quot;g&amp;quot; which does &amp;quot;git pull --ff-only ; git push &amp;amp;&amp;amp; git status&#039;&amp;quot;&lt;br /&gt;
&lt;br /&gt;
*git log - display history of commits to master branch&lt;br /&gt;
*git diff - display the differences in files between working files and files in local repo.&lt;br /&gt;
*git status - display: which updated files are staged/not staged(tracked)&lt;br /&gt;
*git stash - &lt;br /&gt;
*git branch - switch to a new branch&lt;br /&gt;
*git branch &amp;lt;branchname&amp;gt; - will switch to this branch only if it exists&lt;br /&gt;
*git checkout - DESTROYS/Updates the state of local working directory with the state of the files in the local repo. (YOU WILL LOSE non staged updates)&lt;br /&gt;
*git restore &amp;lt;filename&amp;gt; - DESTROYS/Updates the file with the version in the local repo. (like with git checkout but for a specific file)&lt;br /&gt;
*git checkin - &lt;br /&gt;
*git revert &amp;lt;commitHash&amp;gt; - reverses a specific commit (use git log to get the chosen commit hash)&lt;br /&gt;
*git ..&lt;br /&gt;
&lt;br /&gt;
==Converting AREV programs to EXODUS==&lt;br /&gt;
===Decompile AREV to C++===&lt;br /&gt;
&lt;br /&gt;
Do in Master AREV Installation Maintenance mode: (win7)&lt;br /&gt;
&lt;br /&gt;
#ATTACH ADECOMC &lt;br /&gt;
#*ADECOM &amp;lt;programname&amp;gt;   *single program&lt;br /&gt;
#*ADECOM &amp;lt;prog1&amp;gt; &amp;lt;prog2&amp;gt; &lt;br /&gt;
#*ADECOMALL              *all programs   (CHECK FIRST)&lt;br /&gt;
&lt;br /&gt;
Include the option &amp;quot;(V)&amp;quot; in the command to print the C++ to a notepad, which can easily be copy and pasted.&lt;br /&gt;
&lt;br /&gt;
===Getting C++ program to Exodus Installation===&lt;br /&gt;
&lt;br /&gt;
Two methods: (use the first for one off programs)&lt;br /&gt;
&lt;br /&gt;
====Copy &amp;amp; Paste====&lt;br /&gt;
&lt;br /&gt;
Compile program and open source code in notepad&lt;br /&gt;
&lt;br /&gt;
 ADECOM &amp;lt;programname&amp;gt; (V)&lt;br /&gt;
&lt;br /&gt;
Find which directory the program belongs. e.g fin/med/job/sys e.t&lt;br /&gt;
&lt;br /&gt;
 find /cygdrive/d/exodus/pickos | grep &amp;lt;program name&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If cpp in SYS, the program belongs in ~/exodus/service/src OR if in MED JOB FIN GEN AGY the program belongs in ~/neosys/src&lt;br /&gt;
&lt;br /&gt;
Copy the source code in the text file from the first command.&lt;br /&gt;
&lt;br /&gt;
In Exodus, create a new .cpp (in correct directory) and paste the source code.&lt;br /&gt;
&lt;br /&gt;
Compile &amp;amp; Test&lt;br /&gt;
&lt;br /&gt;
====Rsync====&lt;br /&gt;
&lt;br /&gt;
 /d/exodus/arev/syncup.sh&lt;br /&gt;
&lt;br /&gt;
If cpp in SYS then: ~/exodus/service/src ./getpickos&lt;br /&gt;
&lt;br /&gt;
If cpp in MED JOB FIN GEN AGY then: *~/neosys/src&lt;br /&gt;
&lt;br /&gt;
===Compile C++ files to TEST system===&lt;br /&gt;
&lt;br /&gt;
#*./test &amp;lt;DBNAME&amp;gt;&lt;br /&gt;
#*~/neosys ./doall TEST &amp;lt;DBNAME&amp;gt; restart    #to get one service to start start using the new lib files&lt;br /&gt;
#*~/neosys ./doall TEST all restart         #to get all the services to start start using the new lib files&lt;br /&gt;
&lt;br /&gt;
===Install C++ files to LIVE System===&lt;br /&gt;
&lt;br /&gt;
#~/exodus/service/ ./copyall            #to copy all the ~/lib and bin files to ~/live/lib and bin ... which is used by all exodus/live services&lt;br /&gt;
&lt;br /&gt;
==Writing Standard Exodus Core Function/Method Testing==&lt;br /&gt;
Screen 9: ~/exodus/test/src/&lt;br /&gt;
There are a series of test programs that check whether methods/functions behave as intended.&lt;br /&gt;
They do this using the function, assert.. a 1 or more argument values produce one and only one output)&lt;br /&gt;
&lt;br /&gt;
e.g test_multilang.cpp or test_sort.cpp&lt;br /&gt;
&lt;br /&gt;
Two methods of running test programs:&lt;br /&gt;
*Screen 9: make test&lt;br /&gt;
*after compiling using edic/compile/c, enter test_prog_name. (Since compile has moved it to ~/bin)&lt;br /&gt;
&lt;br /&gt;
Difference between the two methods is make calls gdb directly;&lt;br /&gt;
whereas ~/bin/test_prog_name uses exodus compile program&lt;br /&gt;
#~/neosys ./doall LIVE all restart&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Upgrading Exodus==&lt;br /&gt;
&lt;br /&gt;
#Develop patch in Dev system &lt;br /&gt;
&lt;br /&gt;
===Patching neosys/src or exodus/service/src===&lt;br /&gt;
&lt;br /&gt;
#Manually insert patches and compile into test programs.&lt;br /&gt;
#If patch dat files then run neosys/compall to get dat files into ~/dat&lt;br /&gt;
*If Patsalides:&lt;br /&gt;
*#SITE_DIR=ptcy ./test basic &lt;br /&gt;
*#login to BASIC_TEST and test&lt;br /&gt;
*Other clients:&lt;br /&gt;
*#./test DBCODE&lt;br /&gt;
*#login to DBCODE and test patches works&lt;br /&gt;
#run exodus/service/copyall and check only the patched programs are listed. (if not, see Troubleshoot below)&lt;br /&gt;
#Inform users to log off for 10mins. As a rule of thumb, live services must be stopped before copying test programs to live.&lt;br /&gt;
#exodus/service/copyall CONFIRM&lt;br /&gt;
&lt;br /&gt;
====Troubleshoot====&lt;br /&gt;
&lt;br /&gt;
=====./copyall lists programs you have not patched=====&lt;br /&gt;
Use exodus/service/copyone to copy only your patched programs one by one. (./copyone will not copy dat files)&lt;br /&gt;
&lt;br /&gt;
===Upgrading to new version===&lt;br /&gt;
&lt;br /&gt;
READ: remember there is no test version of libexodus programs. This means that if libexodus programs are compiled and installed, neosys/src and exodus/services LIVE programs MUST BE UPGRADED.&lt;br /&gt;
&lt;br /&gt;
#Upgrade test system to test&lt;br /&gt;
##If a dev system like de2, git stash any uncommitted changes other staff may be working on.&lt;br /&gt;
##Run &amp;quot;g&amp;quot; in ~/exodus (to do git pull --ff-only)&lt;br /&gt;
##Run &amp;quot;m&amp;quot; in ~/exodus (to compile and install libexodus)&lt;br /&gt;
##Run &amp;quot;~/neosys/upgrade.all.sh live&amp;quot; in ~/neosys (to upgrade exodus/service and neosys/src live programs)&lt;br /&gt;
##Begin testing&lt;br /&gt;
#Upgrade clients&lt;br /&gt;
##*Client hosted - Schedule a planned upgrade with client.&lt;br /&gt;
##*NEOSYS hosted - Inform all clients/users of planned morning upgrade, 24hours in advanced.      (TODO: &#039;What&#039;s New in NEOSYS&#039;) AND (emailallusers.cpp)&lt;br /&gt;
##Day of upgrade, check USB backup was successful &amp;amp; make a container snapshot, otherwise do not proceed.&lt;br /&gt;
##Stop services&lt;br /&gt;
##Run &amp;quot;g&amp;quot; in ~/exodus (to do git pull --ff-only)&lt;br /&gt;
##Run &amp;quot;m&amp;quot; in ~/exodus (to compile and install libexodus)&lt;br /&gt;
##Run &amp;quot;~/neosys/upgrade.all.sh live&amp;quot;. &lt;br /&gt;
##Check services started automatically without issues.&lt;br /&gt;
#Inform users their system has been upgraded and they can login.&lt;br /&gt;
&lt;br /&gt;
===Roll Back Upgrade===&lt;br /&gt;
&lt;br /&gt;
If for any reason the entire upgrade needs to be reverted (excludes clients database), follow steps below:&lt;br /&gt;
&lt;br /&gt;
#Inform users that there is a problem and services need to be stopped.&lt;br /&gt;
#Stop all exodus processes.&lt;br /&gt;
#Restore the morning&#039;s USB backup by: (Note this backup contains:  source/obj code, /etc, neosys scripts but not client data)&lt;br /&gt;
##Login into container&#039;s host and rsync the morning&#039;s usb backup to the container&#039;s /:&lt;br /&gt;
#*&amp;lt;pre&amp;gt;rsync --dry-run -avz -e &#039;ssh -p &amp;lt;C_SSHPORT&amp;gt;&#039; /backups/usb/&amp;lt;C_CODE&amp;gt; &amp;lt;C_CODE&amp;gt;:/      (Example: rsync --dry-run -avz -e &#039;ssh -p 19582&#039; /backups/usb/ad1 ad1:/&amp;lt;/pre&amp;gt;)&lt;br /&gt;
#Quick sane check, the latest git commit is not the latest git commit in the remote repo.&lt;br /&gt;
#Inform users they can login.&lt;br /&gt;
&lt;br /&gt;
==Configuring services to autostart during login==&lt;br /&gt;
For Ptcy.&lt;br /&gt;
&lt;br /&gt;
#Create a file &#039;autostart.cfg&#039; in the data folder &lt;br /&gt;
&lt;br /&gt;
 touch /root/hosts/&amp;lt;dbname&amp;gt;/data/autostart.cfg&lt;br /&gt;
&lt;br /&gt;
This will autostart a database service as long as at least one database service in that directory is running.&lt;br /&gt;
&lt;br /&gt;
For example, demo service will autostart during login if,&lt;br /&gt;
#/root/hosts/demo/data/autostart.cfg exists and&lt;br /&gt;
#demo_test service is running&lt;br /&gt;
&lt;br /&gt;
==Speedup postgresql importing databases==&lt;br /&gt;
&lt;br /&gt;
Can be sped up by a factor of 10 BUT may result in corrupt files in case of hard OS crash where the dirty memory is not flushed to storage.&lt;br /&gt;
&lt;br /&gt;
Therefore it is advisable to use this feature only briefly and REMEMBER TO REMOVE IT! &lt;br /&gt;
&lt;br /&gt;
Email to support@neosys.com whenever using it or use personal notes not memory.&lt;br /&gt;
&lt;br /&gt;
nano /etc/postgresql/12/main/postgresql.conf&lt;br /&gt;
&lt;br /&gt;
Uncomment or add a line&lt;br /&gt;
 fsync = off&lt;br /&gt;
Restart postgres … will break any neosys/exodus running processes.&lt;br /&gt;
 r postgresql&lt;br /&gt;
or reload postgres may also work&lt;br /&gt;
&lt;br /&gt;
==Database Attach==&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
root@exodus:~/exodus/cli/src# dbattach&lt;br /&gt;
dbattach - Attach foreign database files to the current default database&lt;br /&gt;
&lt;br /&gt;
Syntax is dbattach TARGETDB [FILENAME,...] {OPTION...}&lt;br /&gt;
&lt;br /&gt;
Options:&lt;br /&gt;
&lt;br /&gt;
  F   Forcibly delete any normal files in the current default database.&lt;br /&gt;
&lt;br /&gt;
  R   Detach foreign files&lt;br /&gt;
  RR  Remove foreign database connection.&lt;br /&gt;
  RRR Remove all foreign database connections and attachments.&lt;br /&gt;
&lt;br /&gt;
  L   List attached foreign files in the current default database&lt;br /&gt;
&lt;br /&gt;
If no filenames are provided then a database connection is created.&lt;br /&gt;
This is *required* before filenames can be provided and attached.&lt;br /&gt;
&lt;br /&gt;
Notes:&lt;br /&gt;
&lt;br /&gt;
Attachments are permanent until re-attached or removed.&lt;br /&gt;
&lt;br /&gt;
Indexes on attached files behave strangely.&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Issues:&lt;br /&gt;
&lt;br /&gt;
TARGETDB must be on the same connection as the current default database.&lt;br /&gt;
&lt;br /&gt;
Current user must have access to the foreign database.&lt;br /&gt;
&lt;br /&gt;
If EXO_USER and EXO_PASS are not set then exodus defaults are used.&lt;br /&gt;
&lt;br /&gt;
exodus .config file is not used currently.&lt;/div&gt;</summary>
		<author><name>Gregory</name></author>
	</entry>
	<entry>
		<id>https://techwiki.neosys.com/index.php?title=EXODUS_Knowledge&amp;diff=3997</id>
		<title>EXODUS Knowledge</title>
		<link rel="alternate" type="text/html" href="https://techwiki.neosys.com/index.php?title=EXODUS_Knowledge&amp;diff=3997"/>
		<updated>2022-10-07T07:47:00Z</updated>

		<summary type="html">&lt;p&gt;Gregory: /* Screens */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==TMUX Screens==&lt;br /&gt;
&lt;br /&gt;
To create the EXODUS maintenance/programming environment&lt;br /&gt;
 exodus#: ./tmux.exodus&lt;br /&gt;
&lt;br /&gt;
===Screens===&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
0: /&lt;br /&gt;
    General work for server services/configs. i.e /etc/nagios, /etc/apache2, /var/log/mail.log or general networking.&lt;br /&gt;
&lt;br /&gt;
1: /root/exodus/&lt;br /&gt;
    Exodus core is installed. Contains build and make libraries here ./libexodus&lt;br /&gt;
&lt;br /&gt;
2: /root/exodus/libexodus/exodus&lt;br /&gt;
    Core exodus library source code which emulate the AREV system e.g var.cpp&lt;br /&gt;
    &lt;br /&gt;
3: /root/exodus/cli/src&lt;br /&gt;
    Exodus Command Line Interface E.g edir, edic, list, listfiles, delete, createdb, deletedb.&lt;br /&gt;
    &lt;br /&gt;
4: root/exodus/service&lt;br /&gt;
    EXODUS core default host directory but also contains scripts that create/manage requirements of a service (create_service, create_db, create_site, backup_db, restore_db, start, stop, status)&lt;br /&gt;
    The www/3/exodus has generic .htm, php and .js which provide basic website functionality i.e Login page, Support Menu, User details, Authorization.&lt;br /&gt;
    NEOSYS www files linked into ./www, from /root/neosys/web, which pulled from NEOSYS www git.&lt;br /&gt;
&lt;br /&gt;
5: /root/exodus/service/src&lt;br /&gt;
    Exodus core service programs (programs that are not related to NEOSYS agency operations and can be used to support other non-NEOSYS services) eg listen, usersubs, sendmail, openfile, select, sort, list,.&lt;br /&gt;
&lt;br /&gt;
    Extra info:    &lt;br /&gt;
    The dat/ has generic dictionary files. (See Section Dictionaries &amp;amp; Psql Functions)&lt;br /&gt;
    TODO: compall currently throws few warnings. Read them and familiarise. In case new warnings appear, notify Steve.    &lt;br /&gt;
        &lt;br /&gt;
6: /root/neosys&lt;br /&gt;
    NEOSYS specific client installation &amp;amp; management scripts e.g .doall, import_db and import_files (from AREV), ./run ./test (see below for these two commands)&lt;br /&gt;
    &lt;br /&gt;
7: /root/neosys/src&lt;br /&gt;
    NEOSYS Agency programs (see section How AREV programs are distributed in EXODUS src/*.cpp&lt;br /&gt;
    /root/neosys has the neosys .git&lt;br /&gt;
&lt;br /&gt;
8: /root/hosts&lt;br /&gt;
    client specific files  e.g logs, images, (shared ./www -&amp;gt; root/exodus/service/www&lt;br /&gt;
&lt;br /&gt;
9: /root/exodus/test/src&lt;br /&gt;
    series of programs that test whether subroutines (specifically Exodus core libraries) work as they should eg for the var lib - &amp;quot;assert( var(&amp;quot;11111&amp;quot;).isnum());&amp;quot;&lt;br /&gt;
&lt;br /&gt;
10: bash /bin/top&lt;br /&gt;
    Monitor for NEOSYS client processes&lt;br /&gt;
    Displays customised format: sorted by total time spend and by processor time.&lt;br /&gt;
     Press &amp;quot;=&amp;quot; : to change to standard top format&lt;br /&gt;
     Press shift + w : to save format settings, replacing the old customised top format&lt;br /&gt;
     To go back to the customised format do:&lt;br /&gt;
        Press &amp;quot;o&amp;quot;&lt;br /&gt;
        Type &amp;quot;COMMAND=serve_agy&amp;quot;&lt;br /&gt;
        shift + t : this sorts by total time spent&lt;br /&gt;
        shift + p : this sorts by processor time&lt;br /&gt;
        shift + w : to save this setting and enter  &#039;y&#039; to confirm&lt;br /&gt;
&lt;br /&gt;
11: /var/log/syslog&lt;br /&gt;
     Log of NEOSYS client requests&lt;br /&gt;
&lt;br /&gt;
12: /root/exodus/service/quick&lt;br /&gt;
     Displays the last time the svr file (in /root/hosts/&amp;lt;client&amp;gt;/data/&amp;lt;dbname&amp;gt;) was updated.&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Object Code/Libraries==&lt;br /&gt;
LIVE and TEST processes use different sets of object code.&lt;br /&gt;
TEST processes use libraries in ~/lib/, whereas LIVE processes use object code in ~/neo/lib&lt;br /&gt;
&lt;br /&gt;
This means development &amp;amp; testing can be done stress free on TEST database, as opposed to testing on production databases.&lt;br /&gt;
&lt;br /&gt;
When compiling using edic, the TEST object code is updated if the compilation is successful. (~/lib)&lt;br /&gt;
&lt;br /&gt;
==Dictionaries &amp;amp; Psql Functions==&lt;br /&gt;
&lt;br /&gt;
Dictionaries - data used to describe other data; specifically the fields of other files. &lt;br /&gt;
&lt;br /&gt;
There are three types of fields: &amp;lt;pre&amp;gt;&lt;br /&gt;
(F) Field for raw data E.g &amp;quot;Office 44 Building Rush&amp;quot;&lt;br /&gt;
(S) Symbolic or calculated E.g for total ans=field1+field2&lt;br /&gt;
(G) General or Group E.g &amp;quot;@CRT&amp;quot; which contains always contains the default columns to show on the output of the list program; if no columns provided in list command.&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Show dictionary using &amp;quot;EXO_DATA=test list dict.clients&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
===Development and deployment using &#039;dat&#039; files===&lt;br /&gt;
&lt;br /&gt;
====Rationale====&lt;br /&gt;
&lt;br /&gt;
Part of system development is the creation of various data that is neither programs nor layout i.e. not cpp, h, html, js, php files etc.&lt;br /&gt;
&lt;br /&gt;
For example:&lt;br /&gt;
&lt;br /&gt;
*Dictionaries are data about data.&lt;br /&gt;
*Language files are data about text to use for various languages.&lt;br /&gt;
*“Change logs” are data about changes in the system.&lt;br /&gt;
&lt;br /&gt;
Historically, in EXODUS and NEOSYS, the above data has been deployed in exodus database files using SQL text files. However SQL files are not convenient for development.&lt;br /&gt;
&lt;br /&gt;
Therefore, &#039;dat&#039; text files will be used now so that standard development tools including editors and git can be fully exploited.&lt;br /&gt;
&lt;br /&gt;
====&#039;dat&#039; files====&lt;br /&gt;
&lt;br /&gt;
Each database file is represented by an os directory of the same name.&lt;br /&gt;
&lt;br /&gt;
Each record in the database file is represented by an os text file where filename is the primary key.&lt;br /&gt;
&lt;br /&gt;
For example a record with key &#039;&#039;&#039;DEADLINE&#039;&#039;&#039; in a dat file &#039;&#039;&#039;dict.materials&#039;&#039;&#039; would be represented as an os text file &#039;&#039;&#039;dat/dict.materials/DEADLINE&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Each line in the os text file represents one field in the db record. In other words, db record FM characters are represented by new line characters in &#039;dat&#039; files. Any actual new line characters required in the record, and any backslashes, are escaped and appear as &#039;\n&#039; and &#039;\\&#039; in &#039;dat&#039; files. Other database field separator characters such as VM, SM, TM and STM are stored without any conversion.&lt;br /&gt;
&lt;br /&gt;
====Location of dat files====&lt;br /&gt;
&lt;br /&gt;
The development versions are stored in exodus and neosys src/dat dirs. They form part of the standard git repositories in parallel with cpp files.&lt;br /&gt;
&lt;br /&gt;
The operational versions are stored in ~/dat and ~/live/dat alongside bin and lib dirs and are automatically installed into databases as database files on service startup. Any database functions embedded in the text files (pgsql) are also automatically installed at the same time.&lt;br /&gt;
&lt;br /&gt;
====Editing and deploying a &#039;dat&#039; file====&lt;br /&gt;
&lt;br /&gt;
It is currently a three step process to edit and deploy such &#039;dat&#039; files. &lt;br /&gt;
&lt;br /&gt;
=====Edit the &#039;dat&#039; file=====&lt;br /&gt;
&lt;br /&gt;
Note that EXODUS service and NEOSYS service have different src/dat folders.&lt;br /&gt;
&lt;br /&gt;
Editing language items:&lt;br /&gt;
&lt;br /&gt;
 edir dat/alanguage/SCHEDULES*ARABIC&lt;br /&gt;
&lt;br /&gt;
Editing a dictionary item:&lt;br /&gt;
&lt;br /&gt;
 edir dat/dict.materials/DEADLINE&lt;br /&gt;
&lt;br /&gt;
Editing a pgsql function in a dictionary:&lt;br /&gt;
&lt;br /&gt;
 edir dat/dict.materials/DEADLINE 8&lt;br /&gt;
&lt;br /&gt;
=====Copy all &#039;dat&#039; files to ~/dat =====&lt;br /&gt;
&lt;br /&gt;
This step might be removed at a later date.&lt;br /&gt;
&lt;br /&gt;
This will cause all test databases to immediately restart and load any &#039;dat&#039; file changes into dictionaries and data files and also create any new or modified pgsql functions.&lt;br /&gt;
&lt;br /&gt;
If any ~/neosys/src/dat files were edited:&lt;br /&gt;
&lt;br /&gt;
 cd ~/neosys/src&lt;br /&gt;
 &lt;br /&gt;
 ./compall dat&lt;br /&gt;
&lt;br /&gt;
and/or, if exodus/service/dat files were edited&lt;br /&gt;
&lt;br /&gt;
 cd ~/exodus/service/src&lt;br /&gt;
 &lt;br /&gt;
 ./compall dat&lt;br /&gt;
&lt;br /&gt;
=====Copy all programs and &#039;dat&#039; files to ~/live/bin|lib|dat=====&lt;br /&gt;
&lt;br /&gt;
This should only be run after testing. It will cause all live databases to automatically restart and do the same as the test databases mentioned above.&lt;br /&gt;
&lt;br /&gt;
 cd ~/exodus/service&lt;br /&gt;
 &lt;br /&gt;
 ./copyall CONFIRM&lt;br /&gt;
​&lt;br /&gt;
&lt;br /&gt;
===Psql unaccent extension===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The unaccent extension and the immutable_unaccent function are created in the db ‘template1’ during exodus installation while user is postgres which is a superuser.&lt;br /&gt;
&lt;br /&gt;
Thereafter all new databases are created as copies of template1 so they contain the extension and function&lt;br /&gt;
&lt;br /&gt;
====Error====&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
MVDBException:ERROR: function immutable_unaccent(text) does not exist&lt;br /&gt;
ERROR:  permission denied to create extension &amp;quot;unaccent&amp;quot;&lt;br /&gt;
HINT:  Must be superuser to create this extension. &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====Solution====&lt;br /&gt;
sudo -u postgres psql -c &#039;ALTER USER exodus WITH SUPERUSER;&#039;&lt;br /&gt;
&lt;br /&gt;
==Processes==&lt;br /&gt;
The TEST process for all database use the same object code stored in /root/lib, whereas all LIVE process use the object code in /root/neo/.&lt;br /&gt;
&lt;br /&gt;
==Postgres==&lt;br /&gt;
Connect into postgres shell:&lt;br /&gt;
 alias psql=&#039;sudo -u postgres psql&#039;&lt;br /&gt;
&lt;br /&gt;
Delete a database:&lt;br /&gt;
 sudo -u postgres dropdb &amp;lt;dbcode&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Debugging Exodus==&lt;br /&gt;
&lt;br /&gt;
===Debugging Live/Test services===&lt;br /&gt;
&lt;br /&gt;
./test &amp;lt;dbname&amp;gt; - execute test programs on _test database.&lt;br /&gt;
&lt;br /&gt;
./run &amp;lt;dbname&amp;gt;  - execute test programs on live database.&lt;br /&gt;
&lt;br /&gt;
===Debugging var values===&lt;br /&gt;
&lt;br /&gt;
Explanation of var flag value in gdb debug mode.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
(gdb) p varx                                                           &lt;br /&gt;
$2 = {var_str = &amp;quot;&amp;quot;, var_int = 0, var_dbl = 0, var_typ = {flags_ = 2}}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Each exodus var object contains 3 variables of type string, int and double.&lt;br /&gt;
&lt;br /&gt;
All 3 may be unassigned or only the string be assigned or just the int and double e.t.&lt;br /&gt;
&lt;br /&gt;
You can tell which variable type of a var object are set based on the var&#039;s flag value.&lt;br /&gt;
&lt;br /&gt;
1 = Means the string is assigned&lt;br /&gt;
2 = Means the int is assigned&lt;br /&gt;
4 = Means the double is assigned&lt;br /&gt;
&lt;br /&gt;
Example: If the flag is 7 (1+2+4), then all types are assigned.&lt;br /&gt;
&lt;br /&gt;
====To inspect a “common” variable====&lt;br /&gt;
&lt;br /&gt;
e,g, a variable called ba.ledgern&lt;br /&gt;
&lt;br /&gt;
 p ((subExodusProgram::ba_common)ba).ledgern&lt;br /&gt;
&lt;br /&gt;
====To inspect a common block====&lt;br /&gt;
&lt;br /&gt;
e.g. a common block ba&lt;br /&gt;
&lt;br /&gt;
 ptype (subExodusProgram::ba_common)ba&lt;br /&gt;
&lt;br /&gt;
====To dump all variables in a common====&lt;br /&gt;
&lt;br /&gt;
e.g all variables in ba&lt;br /&gt;
&lt;br /&gt;
 p (subExodusProgram::ba_common)ba&lt;br /&gt;
&lt;br /&gt;
====What types are available in a program?====&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;info types common&lt;br /&gt;
info types subExodus&lt;br /&gt;
info types libexodus&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====Other commands====&lt;br /&gt;
&lt;br /&gt;
 explore subExodusProgram::ba_common&lt;br /&gt;
&lt;br /&gt;
===Process Hung or consuming +100% CPU===&lt;br /&gt;
If process is consuming +100% CPU then it is likely stuck in an infinite loop.&lt;br /&gt;
&lt;br /&gt;
 ./doall &amp;lt;CLIENT&amp;gt; stop&lt;br /&gt;
&lt;br /&gt;
 ./run &amp;lt;CLIENT&amp;gt; &lt;br /&gt;
&lt;br /&gt;
 ./test &amp;lt;CLIENT&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Search through recent logs for &amp;lt;CLIENT&amp;gt; looking for requests that didn&#039;t return OK at the time nagios alerted of Hung process.&lt;br /&gt;
&lt;br /&gt;
A user may also instigate the error again, so monitor the CLIENT&#039;s service CPU usage.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
If cause found recreate it in test and once test process hit +100% break in test debugger.&lt;br /&gt;
&lt;br /&gt;
If cause not found, you will have to continue checking logs for the request that caused it or hope a user recreates the issue in live debugged service.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Once you&#039;ve broken in the debugged with the error, enter &amp;quot;n&amp;quot; and hold the enter key until you just seeing line repeat.&lt;br /&gt;
&lt;br /&gt;
Pay attention to start of loops code. E.g WHILE or FOR. (there is likely an error is there)&lt;br /&gt;
&lt;br /&gt;
==./doall==&lt;br /&gt;
====General====&lt;br /&gt;
&lt;br /&gt;
~/neosys/doall [LIVE|TEST] &amp;lt;DBCODE|ALL&amp;gt; &amp;lt; ACTION [OPTIONS,..]  | bash -- COMMAND ]&lt;br /&gt;
&lt;br /&gt;
Example: &lt;br /&gt;
 ./doall TEST ALL create_site t-&lt;br /&gt;
Result:&lt;br /&gt;
Create site for ALL TEST databases, using domain name prefix option &amp;quot;t-&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Screen 6: ./doall script contains all the necessary information(codes) to setup an installation.&lt;br /&gt;
It includes scripts to backup, restore, create an Apache site, create/start/stop/status a service, import an AREV database into postgres and more.&lt;br /&gt;
&lt;br /&gt;
====backup_db====&lt;br /&gt;
&lt;br /&gt;
*Does a backup &amp;amp; restore of a LIVE database into the corresponding TEST database.&lt;br /&gt;
*Backup &amp;lt;dbcode&amp;gt;.sql file is written to /root/backups/sql; which is rsynced to nl19:/backups/current/exodus/&lt;br /&gt;
*Unlike AREV, postgres can perform a &amp;quot;backup&amp;quot; of a database whilst the system is in use.&lt;br /&gt;
&lt;br /&gt;
==Git==&lt;br /&gt;
&lt;br /&gt;
There are two repositories, one for EXODUS and the other for NEOSYS.&lt;br /&gt;
&lt;br /&gt;
===Using git to make changes===&lt;br /&gt;
&lt;br /&gt;
Before following steps you must have a tested updated to a program/file/script. Do not commit untested changes to avoid a messy git history of reverts.&lt;br /&gt;
&lt;br /&gt;
Update your local repo before committing to local repo using the g alias for &amp;quot;git pull --ff-only ; git push &amp;amp;&amp;amp; git status&#039;&amp;quot;:&lt;br /&gt;
&amp;lt;pre&amp;gt;g&amp;lt;/pre&amp;gt;&lt;br /&gt;
Check which updates/files have not yet been staged and/or committed:&lt;br /&gt;
Add your updates to the staged area:&lt;br /&gt;
&amp;lt;pre&amp;gt;git add &amp;lt;filename&amp;gt;&amp;lt;/pre&amp;gt;&lt;br /&gt;
or if all the changes made need to be staged:&lt;br /&gt;
&amp;lt;pre&amp;gt;git add -a&amp;lt;/pre&amp;gt;&lt;br /&gt;
Make a commit with a descriptive message on purpose of updates:&lt;br /&gt;
&amp;lt;pre&amp;gt;git commit -m &amp;lt;description n purpose of changes&amp;gt;&amp;lt;/pre&amp;gt;&lt;br /&gt;
Again use g alias:&lt;br /&gt;
&amp;lt;pre&amp;gt;g&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Other useful git cmds===&lt;br /&gt;
&lt;br /&gt;
Do not use this commands unless you know what WILL happen. &lt;br /&gt;
*git pull - Instead use the safe &amp;quot;git pull --ff-only&amp;quot;&lt;br /&gt;
Stick to the alias &amp;quot;g&amp;quot; which does &amp;quot;git pull --ff-only ; git push &amp;amp;&amp;amp; git status&#039;&amp;quot;&lt;br /&gt;
&lt;br /&gt;
*git log - display history of commits to master branch&lt;br /&gt;
*git diff - display the differences in files between working files and files in local repo.&lt;br /&gt;
*git status - display: which updated files are staged/not staged(tracked)&lt;br /&gt;
*git stash - &lt;br /&gt;
*git branch - switch to a new branch&lt;br /&gt;
*git branch &amp;lt;branchname&amp;gt; - will switch to this branch only if it exists&lt;br /&gt;
*git checkout - DESTROYS/Updates the state of local working directory with the state of the files in the local repo. (YOU WILL LOSE non staged updates)&lt;br /&gt;
*git restore &amp;lt;filename&amp;gt; - DESTROYS/Updates the file with the version in the local repo. (like with git checkout but for a specific file)&lt;br /&gt;
*git checkin - &lt;br /&gt;
*git revert &amp;lt;commitHash&amp;gt; - reverses a specific commit (use git log to get the chosen commit hash)&lt;br /&gt;
*git ..&lt;br /&gt;
&lt;br /&gt;
==Converting AREV programs to EXODUS==&lt;br /&gt;
===Decompile AREV to C++===&lt;br /&gt;
&lt;br /&gt;
Do in Master AREV Installation Maintenance mode: (win7)&lt;br /&gt;
&lt;br /&gt;
#ATTACH ADECOMC &lt;br /&gt;
#*ADECOM &amp;lt;programname&amp;gt;   *single program&lt;br /&gt;
#*ADECOM &amp;lt;prog1&amp;gt; &amp;lt;prog2&amp;gt; &lt;br /&gt;
#*ADECOMALL              *all programs   (CHECK FIRST)&lt;br /&gt;
&lt;br /&gt;
Include the option &amp;quot;(V)&amp;quot; in the command to print the C++ to a notepad, which can easily be copy and pasted.&lt;br /&gt;
&lt;br /&gt;
===Getting C++ program to Exodus Installation===&lt;br /&gt;
&lt;br /&gt;
Two methods: (use the first for one off programs)&lt;br /&gt;
&lt;br /&gt;
====Copy &amp;amp; Paste====&lt;br /&gt;
&lt;br /&gt;
Compile program and open source code in notepad&lt;br /&gt;
&lt;br /&gt;
 ADECOM &amp;lt;programname&amp;gt; (V)&lt;br /&gt;
&lt;br /&gt;
Find which directory the program belongs. e.g fin/med/job/sys e.t&lt;br /&gt;
&lt;br /&gt;
 find /cygdrive/d/exodus/pickos | grep &amp;lt;program name&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If cpp in SYS, the program belongs in ~/exodus/service/src OR if in MED JOB FIN GEN AGY the program belongs in ~/neosys/src&lt;br /&gt;
&lt;br /&gt;
Copy the source code in the text file from the first command.&lt;br /&gt;
&lt;br /&gt;
In Exodus, create a new .cpp (in correct directory) and paste the source code.&lt;br /&gt;
&lt;br /&gt;
Compile &amp;amp; Test&lt;br /&gt;
&lt;br /&gt;
====Rsync====&lt;br /&gt;
&lt;br /&gt;
 /d/exodus/arev/syncup.sh&lt;br /&gt;
&lt;br /&gt;
If cpp in SYS then: ~/exodus/service/src ./getpickos&lt;br /&gt;
&lt;br /&gt;
If cpp in MED JOB FIN GEN AGY then: *~/neosys/src&lt;br /&gt;
&lt;br /&gt;
===Compile C++ files to TEST system===&lt;br /&gt;
&lt;br /&gt;
#*./test &amp;lt;DBNAME&amp;gt;&lt;br /&gt;
#*~/neosys ./doall TEST &amp;lt;DBNAME&amp;gt; restart    #to get one service to start start using the new lib files&lt;br /&gt;
#*~/neosys ./doall TEST all restart         #to get all the services to start start using the new lib files&lt;br /&gt;
&lt;br /&gt;
===Install C++ files to LIVE System===&lt;br /&gt;
&lt;br /&gt;
#~/exodus/service/ ./copyall            #to copy all the ~/lib and bin files to ~/live/lib and bin ... which is used by all exodus/live services&lt;br /&gt;
&lt;br /&gt;
==Writing Standard Exodus Core Function/Method Testing==&lt;br /&gt;
Screen 9: ~/exodus/test/src/&lt;br /&gt;
There are a series of test programs that check whether methods/functions behave as intended.&lt;br /&gt;
They do this using the function, assert.. a 1 or more argument values produce one and only one output)&lt;br /&gt;
&lt;br /&gt;
e.g test_multilang.cpp or test_sort.cpp&lt;br /&gt;
&lt;br /&gt;
Two methods of running test programs:&lt;br /&gt;
*Screen 9: make test&lt;br /&gt;
*after compiling using edic/compile/c, enter test_prog_name. (Since compile has moved it to ~/bin)&lt;br /&gt;
&lt;br /&gt;
Difference between the two methods is make calls gdb directly;&lt;br /&gt;
whereas ~/bin/test_prog_name uses exodus compile program&lt;br /&gt;
#~/neosys ./doall LIVE all restart&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Upgrading Exodus==&lt;br /&gt;
&lt;br /&gt;
#Develop patch in Dev system &lt;br /&gt;
&lt;br /&gt;
===Patching neosys/src or exodus/service/src===&lt;br /&gt;
&lt;br /&gt;
#Manually insert patches and compile into test programs.&lt;br /&gt;
#If patch dat files then run neosys/compall to get dat files into ~/dat&lt;br /&gt;
*If Patsalides:&lt;br /&gt;
*#SITE_DIR=ptcy ./test basic &lt;br /&gt;
*#login to BASIC_TEST and test&lt;br /&gt;
*Other clients:&lt;br /&gt;
*#./test DBCODE&lt;br /&gt;
*#login to DBCODE and test patches works&lt;br /&gt;
#run exodus/service/copyall and check only the patched programs are listed. (if not, see Troubleshoot below)&lt;br /&gt;
#Inform users to log off for 10mins. As a rule of thumb, live services must be stopped before copying test programs to live.&lt;br /&gt;
#exodus/service/copyall CONFIRM&lt;br /&gt;
&lt;br /&gt;
====Troubleshoot====&lt;br /&gt;
&lt;br /&gt;
=====./copyall lists programs you have not patched=====&lt;br /&gt;
Use exodus/service/copyone to copy only your patched programs one by one. (./copyone will not copy dat files)&lt;br /&gt;
&lt;br /&gt;
===Upgrading to new version===&lt;br /&gt;
&lt;br /&gt;
READ: remember there is no test version of libexodus programs. This means that if libexodus programs are compiled and installed, neosys/src and exodus/services LIVE programs MUST BE UPGRADED.&lt;br /&gt;
&lt;br /&gt;
#Upgrade test system to test&lt;br /&gt;
##If a dev system like de2, git stash any uncommitted changes other staff may be working on.&lt;br /&gt;
##Run &amp;quot;g&amp;quot; in ~/exodus (to do git pull --ff-only)&lt;br /&gt;
##Run &amp;quot;m&amp;quot; in ~/exodus (to compile and install libexodus)&lt;br /&gt;
##Run &amp;quot;~/neosys/upgrade.all.sh live&amp;quot; in ~/neosys (to upgrade exodus/service and neosys/src live programs)&lt;br /&gt;
##Begin testing&lt;br /&gt;
#Upgrade clients&lt;br /&gt;
##*Client hosted - Schedule a planned upgrade with client.&lt;br /&gt;
##*NEOSYS hosted - Inform all clients/users of planned morning upgrade, 24hours in advanced.      (TODO: &#039;What&#039;s New in NEOSYS&#039;) AND (emailallusers.cpp)&lt;br /&gt;
##Day of upgrade, check USB backup was successful &amp;amp; make a container snapshot, otherwise do not proceed.&lt;br /&gt;
##Stop services&lt;br /&gt;
##Run &amp;quot;g&amp;quot; in ~/exodus (to do git pull --ff-only)&lt;br /&gt;
##Run &amp;quot;m&amp;quot; in ~/exodus (to compile and install libexodus)&lt;br /&gt;
##Run &amp;quot;~/neosys/upgrade.all.sh live&amp;quot;. &lt;br /&gt;
##Check services started automatically without issues.&lt;br /&gt;
#Inform users their system has been upgraded and they can login.&lt;br /&gt;
&lt;br /&gt;
===Roll Back Upgrade===&lt;br /&gt;
&lt;br /&gt;
If for any reason the entire upgrade needs to be reverted (excludes clients database), follow steps below:&lt;br /&gt;
&lt;br /&gt;
#Inform users that there is a problem and services need to be stopped.&lt;br /&gt;
#Stop all exodus processes.&lt;br /&gt;
#Restore the morning&#039;s USB backup by: (Note this backup contains:  source/obj code, /etc, neosys scripts but not client data)&lt;br /&gt;
##Login into container&#039;s host and rsync the morning&#039;s usb backup to the container&#039;s /:&lt;br /&gt;
#*&amp;lt;pre&amp;gt;rsync --dry-run -avz -e &#039;ssh -p &amp;lt;C_SSHPORT&amp;gt;&#039; /backups/usb/&amp;lt;C_CODE&amp;gt; &amp;lt;C_CODE&amp;gt;:/      (Example: rsync --dry-run -avz -e &#039;ssh -p 19582&#039; /backups/usb/ad1 ad1:/&amp;lt;/pre&amp;gt;)&lt;br /&gt;
#Quick sane check, the latest git commit is not the latest git commit in the remote repo.&lt;br /&gt;
#Inform users they can login.&lt;br /&gt;
&lt;br /&gt;
==Configuring services to autostart during login==&lt;br /&gt;
For Ptcy.&lt;br /&gt;
&lt;br /&gt;
#Create a file &#039;autostart.cfg&#039; in the data folder &lt;br /&gt;
&lt;br /&gt;
 touch /root/hosts/&amp;lt;dbname&amp;gt;/data/autostart.cfg&lt;br /&gt;
&lt;br /&gt;
This will autostart a database service as long as at least one database service in that directory is running.&lt;br /&gt;
&lt;br /&gt;
For example, demo service will autostart during login if,&lt;br /&gt;
#/root/hosts/demo/data/autostart.cfg exists and&lt;br /&gt;
#demo_test service is running&lt;br /&gt;
&lt;br /&gt;
==Speedup postgresql importing databases==&lt;br /&gt;
&lt;br /&gt;
Can be sped up by a factor of 10 BUT may result in corrupt files in case of hard OS crash where the dirty memory is not flushed to storage.&lt;br /&gt;
&lt;br /&gt;
Therefore it is advisable to use this feature only briefly and REMEMBER TO REMOVE IT! &lt;br /&gt;
&lt;br /&gt;
Email to support@neosys.com whenever using it or use personal notes not memory.&lt;br /&gt;
&lt;br /&gt;
nano /etc/postgresql/12/main/postgresql.conf&lt;br /&gt;
&lt;br /&gt;
Uncomment or add a line&lt;br /&gt;
 fsync = off&lt;br /&gt;
Restart postgres … will break any neosys/exodus running processes.&lt;br /&gt;
 r postgresql&lt;br /&gt;
or reload postgres may also work&lt;br /&gt;
&lt;br /&gt;
==Database Attach==&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
root@exodus:~/exodus/cli/src# dbattach&lt;br /&gt;
dbattach - Attach foreign database files to the current default database&lt;br /&gt;
&lt;br /&gt;
Syntax is dbattach TARGETDB [FILENAME,...] {OPTION...}&lt;br /&gt;
&lt;br /&gt;
Options:&lt;br /&gt;
&lt;br /&gt;
  F   Forcibly delete any normal files in the current default database.&lt;br /&gt;
&lt;br /&gt;
  R   Detach foreign files&lt;br /&gt;
  RR  Remove foreign database connection.&lt;br /&gt;
  RRR Remove all foreign database connections and attachments.&lt;br /&gt;
&lt;br /&gt;
  L   List attached foreign files in the current default database&lt;br /&gt;
&lt;br /&gt;
If no filenames are provided then a database connection is created.&lt;br /&gt;
This is *required* before filenames can be provided and attached.&lt;br /&gt;
&lt;br /&gt;
Notes:&lt;br /&gt;
&lt;br /&gt;
Attachments are permanent until re-attached or removed.&lt;br /&gt;
&lt;br /&gt;
Indexes on attached files behave strangely.&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Issues:&lt;br /&gt;
&lt;br /&gt;
TARGETDB must be on the same connection as the current default database.&lt;br /&gt;
&lt;br /&gt;
Current user must have access to the foreign database.&lt;br /&gt;
&lt;br /&gt;
If EXO_USER and EXO_PASS are not set then exodus defaults are used.&lt;br /&gt;
&lt;br /&gt;
exodus .config file is not used currently.&lt;/div&gt;</summary>
		<author><name>Gregory</name></author>
	</entry>
	<entry>
		<id>https://techwiki.neosys.com/index.php?title=EXODUS_Knowledge&amp;diff=3996</id>
		<title>EXODUS Knowledge</title>
		<link rel="alternate" type="text/html" href="https://techwiki.neosys.com/index.php?title=EXODUS_Knowledge&amp;diff=3996"/>
		<updated>2022-10-07T07:36:08Z</updated>

		<summary type="html">&lt;p&gt;Gregory: /* Dictionaries &amp;amp; Psql Functions */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==TMUX Screens==&lt;br /&gt;
&lt;br /&gt;
To create the EXODUS maintenance/programming environment&lt;br /&gt;
 exodus#: ./tmux.exodus&lt;br /&gt;
&lt;br /&gt;
===Screens===&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
0: /&lt;br /&gt;
    Work regarding exodus server. i.e /etc/nagios or general networking or /var/log/mail.log&lt;br /&gt;
&lt;br /&gt;
1: /root/exodus/&lt;br /&gt;
    Exodus core is installed Contains build and make libraries here ./libexodus&lt;br /&gt;
&lt;br /&gt;
2: /root/exodus/libexodus/exodus&lt;br /&gt;
    Core exodus (libraries that emulate the AREV system e.g mv.h )&lt;br /&gt;
    &lt;br /&gt;
3: /root/exodus/cli/src&lt;br /&gt;
    Exodus Command Line Interface e.g edir, edic, list, listfiles, delete, createdb&lt;br /&gt;
    &lt;br /&gt;
4: root/exodus/service&lt;br /&gt;
    EXODUS core default host directory but also contains scripts that create/manage requirements of a service (create_service, create_db, create_site, backup_db, restore_db, start, stop, status)&lt;br /&gt;
    One exception is NEOSYS www files are in ./www, which pulled from NEOSYS www git.&lt;br /&gt;
&lt;br /&gt;
5: /root/exodus/service/src&lt;br /&gt;
    Exodus core service programs (programs that are not related to NEOSYS agency operations and can be used to support other non-NEOSYS services) eg listen, usersubs, sendmail, openfile, select, sort, list,.&lt;br /&gt;
&lt;br /&gt;
    Extra info:    &lt;br /&gt;
    sql directory contains basic dictiorary files converted to sql instructions used when creating a EXODUS psql database&lt;br /&gt;
    e.g dict_voc.sql is a file that describes what to expect in certain fields of the voc file.&lt;br /&gt;
    TODO: compall currently throws few warnings. Read them and familiarise. In case new warnings appear, notify Steve.    &lt;br /&gt;
        &lt;br /&gt;
6: /root/neosys&lt;br /&gt;
    NEOSYS specific client installation management scripts e.g .doall, import_db and import_files (from AREV), ./run ./test (see below for these two commands)&lt;br /&gt;
    &lt;br /&gt;
7: /root/neosys/src&lt;br /&gt;
    NEOSYS Agency programs (see section How AREV programs are distributed in EXODUS src/*.cpp&lt;br /&gt;
    ../ has .git&lt;br /&gt;
&lt;br /&gt;
8: /root/hosts&lt;br /&gt;
    client specific files  e.g logs, images, (shared ./www -&amp;gt; root/exodus/service/www&lt;br /&gt;
&lt;br /&gt;
9: /root/exodus/test/src&lt;br /&gt;
    series of programs that test whether subroutines (specifically Exodus core libraries) work as they should eg for the var lib - &amp;quot;assert( var(&amp;quot;11111&amp;quot;).isnum());&amp;quot;&lt;br /&gt;
&lt;br /&gt;
10: bash /bin/top&lt;br /&gt;
    Monitor for NEOSYS client processes&lt;br /&gt;
    Displays customised format: sorted by total time spend and by processor time.&lt;br /&gt;
     Press &amp;quot;=&amp;quot; : to change to standard top format&lt;br /&gt;
     Press shift + w : to save format settings, replacing the old customised top format&lt;br /&gt;
     To go back to the customised format do:&lt;br /&gt;
        Press &amp;quot;o&amp;quot;&lt;br /&gt;
        Type &amp;quot;COMMAND=serve_agy&amp;quot;&lt;br /&gt;
        shift + t : this sorts by total time spent&lt;br /&gt;
        shift + p : this sorts by processor time&lt;br /&gt;
        shift + w : to save this setting and enter  &#039;y&#039; to confirm&lt;br /&gt;
&lt;br /&gt;
11: /var/log/syslog&lt;br /&gt;
     Log of NEOSYS client requests&lt;br /&gt;
&lt;br /&gt;
12: /root/exodus/service/quick&lt;br /&gt;
     Displays the last time the svr file (in /root/hosts/&amp;lt;client&amp;gt;/data/&amp;lt;dbname&amp;gt;) was updated.&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Object Code/Libraries==&lt;br /&gt;
LIVE and TEST processes use different sets of object code.&lt;br /&gt;
TEST processes use libraries in ~/lib/, whereas LIVE processes use object code in ~/neo/lib&lt;br /&gt;
&lt;br /&gt;
This means development &amp;amp; testing can be done stress free on TEST database, as opposed to testing on production databases.&lt;br /&gt;
&lt;br /&gt;
When compiling using edic, the TEST object code is updated if the compilation is successful. (~/lib)&lt;br /&gt;
&lt;br /&gt;
==Dictionaries &amp;amp; Psql Functions==&lt;br /&gt;
&lt;br /&gt;
Dictionaries - data used to describe other data; specifically the fields of other files. &lt;br /&gt;
&lt;br /&gt;
There are three types of fields: &amp;lt;pre&amp;gt;&lt;br /&gt;
(F) Field for raw data E.g &amp;quot;Office 44 Building Rush&amp;quot;&lt;br /&gt;
(S) Symbolic or calculated E.g for total ans=field1+field2&lt;br /&gt;
(G) General or Group E.g &amp;quot;@CRT&amp;quot; which contains always contains the default columns to show on the output of the list program; if no columns provided in list command.&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Show dictionary using &amp;quot;EXO_DATA=test list dict.clients&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
===Development and deployment using &#039;dat&#039; files===&lt;br /&gt;
&lt;br /&gt;
====Rationale====&lt;br /&gt;
&lt;br /&gt;
Part of system development is the creation of various data that is neither programs nor layout i.e. not cpp, h, html, js, php files etc.&lt;br /&gt;
&lt;br /&gt;
For example:&lt;br /&gt;
&lt;br /&gt;
*Dictionaries are data about data.&lt;br /&gt;
*Language files are data about text to use for various languages.&lt;br /&gt;
*“Change logs” are data about changes in the system.&lt;br /&gt;
&lt;br /&gt;
Historically, in EXODUS and NEOSYS, the above data has been deployed in exodus database files using SQL text files. However SQL files are not convenient for development.&lt;br /&gt;
&lt;br /&gt;
Therefore, &#039;dat&#039; text files will be used now so that standard development tools including editors and git can be fully exploited.&lt;br /&gt;
&lt;br /&gt;
====&#039;dat&#039; files====&lt;br /&gt;
&lt;br /&gt;
Each database file is represented by an os directory of the same name.&lt;br /&gt;
&lt;br /&gt;
Each record in the database file is represented by an os text file where filename is the primary key.&lt;br /&gt;
&lt;br /&gt;
For example a record with key &#039;&#039;&#039;DEADLINE&#039;&#039;&#039; in a dat file &#039;&#039;&#039;dict.materials&#039;&#039;&#039; would be represented as an os text file &#039;&#039;&#039;dat/dict.materials/DEADLINE&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Each line in the os text file represents one field in the db record. In other words, db record FM characters are represented by new line characters in &#039;dat&#039; files. Any actual new line characters required in the record, and any backslashes, are escaped and appear as &#039;\n&#039; and &#039;\\&#039; in &#039;dat&#039; files. Other database field separator characters such as VM, SM, TM and STM are stored without any conversion.&lt;br /&gt;
&lt;br /&gt;
====Location of dat files====&lt;br /&gt;
&lt;br /&gt;
The development versions are stored in exodus and neosys src/dat dirs. They form part of the standard git repositories in parallel with cpp files.&lt;br /&gt;
&lt;br /&gt;
The operational versions are stored in ~/dat and ~/live/dat alongside bin and lib dirs and are automatically installed into databases as database files on service startup. Any database functions embedded in the text files (pgsql) are also automatically installed at the same time.&lt;br /&gt;
&lt;br /&gt;
====Editing and deploying a &#039;dat&#039; file====&lt;br /&gt;
&lt;br /&gt;
It is currently a three step process to edit and deploy such &#039;dat&#039; files. &lt;br /&gt;
&lt;br /&gt;
=====Edit the &#039;dat&#039; file=====&lt;br /&gt;
&lt;br /&gt;
Note that EXODUS service and NEOSYS service have different src/dat folders.&lt;br /&gt;
&lt;br /&gt;
Editing language items:&lt;br /&gt;
&lt;br /&gt;
 edir dat/alanguage/SCHEDULES*ARABIC&lt;br /&gt;
&lt;br /&gt;
Editing a dictionary item:&lt;br /&gt;
&lt;br /&gt;
 edir dat/dict.materials/DEADLINE&lt;br /&gt;
&lt;br /&gt;
Editing a pgsql function in a dictionary:&lt;br /&gt;
&lt;br /&gt;
 edir dat/dict.materials/DEADLINE 8&lt;br /&gt;
&lt;br /&gt;
=====Copy all &#039;dat&#039; files to ~/dat =====&lt;br /&gt;
&lt;br /&gt;
This step might be removed at a later date.&lt;br /&gt;
&lt;br /&gt;
This will cause all test databases to immediately restart and load any &#039;dat&#039; file changes into dictionaries and data files and also create any new or modified pgsql functions.&lt;br /&gt;
&lt;br /&gt;
If any ~/neosys/src/dat files were edited:&lt;br /&gt;
&lt;br /&gt;
 cd ~/neosys/src&lt;br /&gt;
 &lt;br /&gt;
 ./compall dat&lt;br /&gt;
&lt;br /&gt;
and/or, if exodus/service/dat files were edited&lt;br /&gt;
&lt;br /&gt;
 cd ~/exodus/service/src&lt;br /&gt;
 &lt;br /&gt;
 ./compall dat&lt;br /&gt;
&lt;br /&gt;
=====Copy all programs and &#039;dat&#039; files to ~/live/bin|lib|dat=====&lt;br /&gt;
&lt;br /&gt;
This should only be run after testing. It will cause all live databases to automatically restart and do the same as the test databases mentioned above.&lt;br /&gt;
&lt;br /&gt;
 cd ~/exodus/service&lt;br /&gt;
 &lt;br /&gt;
 ./copyall CONFIRM&lt;br /&gt;
​&lt;br /&gt;
&lt;br /&gt;
===Psql unaccent extension===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The unaccent extension and the immutable_unaccent function are created in the db ‘template1’ during exodus installation while user is postgres which is a superuser.&lt;br /&gt;
&lt;br /&gt;
Thereafter all new databases are created as copies of template1 so they contain the extension and function&lt;br /&gt;
&lt;br /&gt;
====Error====&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
MVDBException:ERROR: function immutable_unaccent(text) does not exist&lt;br /&gt;
ERROR:  permission denied to create extension &amp;quot;unaccent&amp;quot;&lt;br /&gt;
HINT:  Must be superuser to create this extension. &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====Solution====&lt;br /&gt;
sudo -u postgres psql -c &#039;ALTER USER exodus WITH SUPERUSER;&#039;&lt;br /&gt;
&lt;br /&gt;
==Processes==&lt;br /&gt;
The TEST process for all database use the same object code stored in /root/lib, whereas all LIVE process use the object code in /root/neo/.&lt;br /&gt;
&lt;br /&gt;
==Postgres==&lt;br /&gt;
Connect into postgres shell:&lt;br /&gt;
 alias psql=&#039;sudo -u postgres psql&#039;&lt;br /&gt;
&lt;br /&gt;
Delete a database:&lt;br /&gt;
 sudo -u postgres dropdb &amp;lt;dbcode&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Debugging Exodus==&lt;br /&gt;
&lt;br /&gt;
===Debugging Live/Test services===&lt;br /&gt;
&lt;br /&gt;
./test &amp;lt;dbname&amp;gt; - execute test programs on _test database.&lt;br /&gt;
&lt;br /&gt;
./run &amp;lt;dbname&amp;gt;  - execute test programs on live database.&lt;br /&gt;
&lt;br /&gt;
===Debugging var values===&lt;br /&gt;
&lt;br /&gt;
Explanation of var flag value in gdb debug mode.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
(gdb) p varx                                                           &lt;br /&gt;
$2 = {var_str = &amp;quot;&amp;quot;, var_int = 0, var_dbl = 0, var_typ = {flags_ = 2}}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Each exodus var object contains 3 variables of type string, int and double.&lt;br /&gt;
&lt;br /&gt;
All 3 may be unassigned or only the string be assigned or just the int and double e.t.&lt;br /&gt;
&lt;br /&gt;
You can tell which variable type of a var object are set based on the var&#039;s flag value.&lt;br /&gt;
&lt;br /&gt;
1 = Means the string is assigned&lt;br /&gt;
2 = Means the int is assigned&lt;br /&gt;
4 = Means the double is assigned&lt;br /&gt;
&lt;br /&gt;
Example: If the flag is 7 (1+2+4), then all types are assigned.&lt;br /&gt;
&lt;br /&gt;
====To inspect a “common” variable====&lt;br /&gt;
&lt;br /&gt;
e,g, a variable called ba.ledgern&lt;br /&gt;
&lt;br /&gt;
 p ((subExodusProgram::ba_common)ba).ledgern&lt;br /&gt;
&lt;br /&gt;
====To inspect a common block====&lt;br /&gt;
&lt;br /&gt;
e.g. a common block ba&lt;br /&gt;
&lt;br /&gt;
 ptype (subExodusProgram::ba_common)ba&lt;br /&gt;
&lt;br /&gt;
====To dump all variables in a common====&lt;br /&gt;
&lt;br /&gt;
e.g all variables in ba&lt;br /&gt;
&lt;br /&gt;
 p (subExodusProgram::ba_common)ba&lt;br /&gt;
&lt;br /&gt;
====What types are available in a program?====&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;info types common&lt;br /&gt;
info types subExodus&lt;br /&gt;
info types libexodus&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====Other commands====&lt;br /&gt;
&lt;br /&gt;
 explore subExodusProgram::ba_common&lt;br /&gt;
&lt;br /&gt;
===Process Hung or consuming +100% CPU===&lt;br /&gt;
If process is consuming +100% CPU then it is likely stuck in an infinite loop.&lt;br /&gt;
&lt;br /&gt;
 ./doall &amp;lt;CLIENT&amp;gt; stop&lt;br /&gt;
&lt;br /&gt;
 ./run &amp;lt;CLIENT&amp;gt; &lt;br /&gt;
&lt;br /&gt;
 ./test &amp;lt;CLIENT&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Search through recent logs for &amp;lt;CLIENT&amp;gt; looking for requests that didn&#039;t return OK at the time nagios alerted of Hung process.&lt;br /&gt;
&lt;br /&gt;
A user may also instigate the error again, so monitor the CLIENT&#039;s service CPU usage.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
If cause found recreate it in test and once test process hit +100% break in test debugger.&lt;br /&gt;
&lt;br /&gt;
If cause not found, you will have to continue checking logs for the request that caused it or hope a user recreates the issue in live debugged service.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Once you&#039;ve broken in the debugged with the error, enter &amp;quot;n&amp;quot; and hold the enter key until you just seeing line repeat.&lt;br /&gt;
&lt;br /&gt;
Pay attention to start of loops code. E.g WHILE or FOR. (there is likely an error is there)&lt;br /&gt;
&lt;br /&gt;
==./doall==&lt;br /&gt;
====General====&lt;br /&gt;
&lt;br /&gt;
~/neosys/doall [LIVE|TEST] &amp;lt;DBCODE|ALL&amp;gt; &amp;lt; ACTION [OPTIONS,..]  | bash -- COMMAND ]&lt;br /&gt;
&lt;br /&gt;
Example: &lt;br /&gt;
 ./doall TEST ALL create_site t-&lt;br /&gt;
Result:&lt;br /&gt;
Create site for ALL TEST databases, using domain name prefix option &amp;quot;t-&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Screen 6: ./doall script contains all the necessary information(codes) to setup an installation.&lt;br /&gt;
It includes scripts to backup, restore, create an Apache site, create/start/stop/status a service, import an AREV database into postgres and more.&lt;br /&gt;
&lt;br /&gt;
====backup_db====&lt;br /&gt;
&lt;br /&gt;
*Does a backup &amp;amp; restore of a LIVE database into the corresponding TEST database.&lt;br /&gt;
*Backup &amp;lt;dbcode&amp;gt;.sql file is written to /root/backups/sql; which is rsynced to nl19:/backups/current/exodus/&lt;br /&gt;
*Unlike AREV, postgres can perform a &amp;quot;backup&amp;quot; of a database whilst the system is in use.&lt;br /&gt;
&lt;br /&gt;
==Git==&lt;br /&gt;
&lt;br /&gt;
There are two repositories, one for EXODUS and the other for NEOSYS.&lt;br /&gt;
&lt;br /&gt;
===Using git to make changes===&lt;br /&gt;
&lt;br /&gt;
Before following steps you must have a tested updated to a program/file/script. Do not commit untested changes to avoid a messy git history of reverts.&lt;br /&gt;
&lt;br /&gt;
Update your local repo before committing to local repo using the g alias for &amp;quot;git pull --ff-only ; git push &amp;amp;&amp;amp; git status&#039;&amp;quot;:&lt;br /&gt;
&amp;lt;pre&amp;gt;g&amp;lt;/pre&amp;gt;&lt;br /&gt;
Check which updates/files have not yet been staged and/or committed:&lt;br /&gt;
Add your updates to the staged area:&lt;br /&gt;
&amp;lt;pre&amp;gt;git add &amp;lt;filename&amp;gt;&amp;lt;/pre&amp;gt;&lt;br /&gt;
or if all the changes made need to be staged:&lt;br /&gt;
&amp;lt;pre&amp;gt;git add -a&amp;lt;/pre&amp;gt;&lt;br /&gt;
Make a commit with a descriptive message on purpose of updates:&lt;br /&gt;
&amp;lt;pre&amp;gt;git commit -m &amp;lt;description n purpose of changes&amp;gt;&amp;lt;/pre&amp;gt;&lt;br /&gt;
Again use g alias:&lt;br /&gt;
&amp;lt;pre&amp;gt;g&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Other useful git cmds===&lt;br /&gt;
&lt;br /&gt;
Do not use this commands unless you know what WILL happen. &lt;br /&gt;
*git pull - Instead use the safe &amp;quot;git pull --ff-only&amp;quot;&lt;br /&gt;
Stick to the alias &amp;quot;g&amp;quot; which does &amp;quot;git pull --ff-only ; git push &amp;amp;&amp;amp; git status&#039;&amp;quot;&lt;br /&gt;
&lt;br /&gt;
*git log - display history of commits to master branch&lt;br /&gt;
*git diff - display the differences in files between working files and files in local repo.&lt;br /&gt;
*git status - display: which updated files are staged/not staged(tracked)&lt;br /&gt;
*git stash - &lt;br /&gt;
*git branch - switch to a new branch&lt;br /&gt;
*git branch &amp;lt;branchname&amp;gt; - will switch to this branch only if it exists&lt;br /&gt;
*git checkout - DESTROYS/Updates the state of local working directory with the state of the files in the local repo. (YOU WILL LOSE non staged updates)&lt;br /&gt;
*git restore &amp;lt;filename&amp;gt; - DESTROYS/Updates the file with the version in the local repo. (like with git checkout but for a specific file)&lt;br /&gt;
*git checkin - &lt;br /&gt;
*git revert &amp;lt;commitHash&amp;gt; - reverses a specific commit (use git log to get the chosen commit hash)&lt;br /&gt;
*git ..&lt;br /&gt;
&lt;br /&gt;
==Converting AREV programs to EXODUS==&lt;br /&gt;
===Decompile AREV to C++===&lt;br /&gt;
&lt;br /&gt;
Do in Master AREV Installation Maintenance mode: (win7)&lt;br /&gt;
&lt;br /&gt;
#ATTACH ADECOMC &lt;br /&gt;
#*ADECOM &amp;lt;programname&amp;gt;   *single program&lt;br /&gt;
#*ADECOM &amp;lt;prog1&amp;gt; &amp;lt;prog2&amp;gt; &lt;br /&gt;
#*ADECOMALL              *all programs   (CHECK FIRST)&lt;br /&gt;
&lt;br /&gt;
Include the option &amp;quot;(V)&amp;quot; in the command to print the C++ to a notepad, which can easily be copy and pasted.&lt;br /&gt;
&lt;br /&gt;
===Getting C++ program to Exodus Installation===&lt;br /&gt;
&lt;br /&gt;
Two methods: (use the first for one off programs)&lt;br /&gt;
&lt;br /&gt;
====Copy &amp;amp; Paste====&lt;br /&gt;
&lt;br /&gt;
Compile program and open source code in notepad&lt;br /&gt;
&lt;br /&gt;
 ADECOM &amp;lt;programname&amp;gt; (V)&lt;br /&gt;
&lt;br /&gt;
Find which directory the program belongs. e.g fin/med/job/sys e.t&lt;br /&gt;
&lt;br /&gt;
 find /cygdrive/d/exodus/pickos | grep &amp;lt;program name&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If cpp in SYS, the program belongs in ~/exodus/service/src OR if in MED JOB FIN GEN AGY the program belongs in ~/neosys/src&lt;br /&gt;
&lt;br /&gt;
Copy the source code in the text file from the first command.&lt;br /&gt;
&lt;br /&gt;
In Exodus, create a new .cpp (in correct directory) and paste the source code.&lt;br /&gt;
&lt;br /&gt;
Compile &amp;amp; Test&lt;br /&gt;
&lt;br /&gt;
====Rsync====&lt;br /&gt;
&lt;br /&gt;
 /d/exodus/arev/syncup.sh&lt;br /&gt;
&lt;br /&gt;
If cpp in SYS then: ~/exodus/service/src ./getpickos&lt;br /&gt;
&lt;br /&gt;
If cpp in MED JOB FIN GEN AGY then: *~/neosys/src&lt;br /&gt;
&lt;br /&gt;
===Compile C++ files to TEST system===&lt;br /&gt;
&lt;br /&gt;
#*./test &amp;lt;DBNAME&amp;gt;&lt;br /&gt;
#*~/neosys ./doall TEST &amp;lt;DBNAME&amp;gt; restart    #to get one service to start start using the new lib files&lt;br /&gt;
#*~/neosys ./doall TEST all restart         #to get all the services to start start using the new lib files&lt;br /&gt;
&lt;br /&gt;
===Install C++ files to LIVE System===&lt;br /&gt;
&lt;br /&gt;
#~/exodus/service/ ./copyall            #to copy all the ~/lib and bin files to ~/live/lib and bin ... which is used by all exodus/live services&lt;br /&gt;
&lt;br /&gt;
==Writing Standard Exodus Core Function/Method Testing==&lt;br /&gt;
Screen 9: ~/exodus/test/src/&lt;br /&gt;
There are a series of test programs that check whether methods/functions behave as intended.&lt;br /&gt;
They do this using the function, assert.. a 1 or more argument values produce one and only one output)&lt;br /&gt;
&lt;br /&gt;
e.g test_multilang.cpp or test_sort.cpp&lt;br /&gt;
&lt;br /&gt;
Two methods of running test programs:&lt;br /&gt;
*Screen 9: make test&lt;br /&gt;
*after compiling using edic/compile/c, enter test_prog_name. (Since compile has moved it to ~/bin)&lt;br /&gt;
&lt;br /&gt;
Difference between the two methods is make calls gdb directly;&lt;br /&gt;
whereas ~/bin/test_prog_name uses exodus compile program&lt;br /&gt;
#~/neosys ./doall LIVE all restart&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Upgrading Exodus==&lt;br /&gt;
&lt;br /&gt;
#Develop patch in Dev system &lt;br /&gt;
&lt;br /&gt;
===Patching neosys/src or exodus/service/src===&lt;br /&gt;
&lt;br /&gt;
#Manually insert patches and compile into test programs.&lt;br /&gt;
#If patch dat files then run neosys/compall to get dat files into ~/dat&lt;br /&gt;
*If Patsalides:&lt;br /&gt;
*#SITE_DIR=ptcy ./test basic &lt;br /&gt;
*#login to BASIC_TEST and test&lt;br /&gt;
*Other clients:&lt;br /&gt;
*#./test DBCODE&lt;br /&gt;
*#login to DBCODE and test patches works&lt;br /&gt;
#run exodus/service/copyall and check only the patched programs are listed. (if not, see Troubleshoot below)&lt;br /&gt;
#Inform users to log off for 10mins. As a rule of thumb, live services must be stopped before copying test programs to live.&lt;br /&gt;
#exodus/service/copyall CONFIRM&lt;br /&gt;
&lt;br /&gt;
====Troubleshoot====&lt;br /&gt;
&lt;br /&gt;
=====./copyall lists programs you have not patched=====&lt;br /&gt;
Use exodus/service/copyone to copy only your patched programs one by one. (./copyone will not copy dat files)&lt;br /&gt;
&lt;br /&gt;
===Upgrading to new version===&lt;br /&gt;
&lt;br /&gt;
READ: remember there is no test version of libexodus programs. This means that if libexodus programs are compiled and installed, neosys/src and exodus/services LIVE programs MUST BE UPGRADED.&lt;br /&gt;
&lt;br /&gt;
#Upgrade test system to test&lt;br /&gt;
##If a dev system like de2, git stash any uncommitted changes other staff may be working on.&lt;br /&gt;
##Run &amp;quot;g&amp;quot; in ~/exodus (to do git pull --ff-only)&lt;br /&gt;
##Run &amp;quot;m&amp;quot; in ~/exodus (to compile and install libexodus)&lt;br /&gt;
##Run &amp;quot;~/neosys/upgrade.all.sh live&amp;quot; in ~/neosys (to upgrade exodus/service and neosys/src live programs)&lt;br /&gt;
##Begin testing&lt;br /&gt;
#Upgrade clients&lt;br /&gt;
##*Client hosted - Schedule a planned upgrade with client.&lt;br /&gt;
##*NEOSYS hosted - Inform all clients/users of planned morning upgrade, 24hours in advanced.      (TODO: &#039;What&#039;s New in NEOSYS&#039;) AND (emailallusers.cpp)&lt;br /&gt;
##Day of upgrade, check USB backup was successful &amp;amp; make a container snapshot, otherwise do not proceed.&lt;br /&gt;
##Stop services&lt;br /&gt;
##Run &amp;quot;g&amp;quot; in ~/exodus (to do git pull --ff-only)&lt;br /&gt;
##Run &amp;quot;m&amp;quot; in ~/exodus (to compile and install libexodus)&lt;br /&gt;
##Run &amp;quot;~/neosys/upgrade.all.sh live&amp;quot;. &lt;br /&gt;
##Check services started automatically without issues.&lt;br /&gt;
#Inform users their system has been upgraded and they can login.&lt;br /&gt;
&lt;br /&gt;
===Roll Back Upgrade===&lt;br /&gt;
&lt;br /&gt;
If for any reason the entire upgrade needs to be reverted (excludes clients database), follow steps below:&lt;br /&gt;
&lt;br /&gt;
#Inform users that there is a problem and services need to be stopped.&lt;br /&gt;
#Stop all exodus processes.&lt;br /&gt;
#Restore the morning&#039;s USB backup by: (Note this backup contains:  source/obj code, /etc, neosys scripts but not client data)&lt;br /&gt;
##Login into container&#039;s host and rsync the morning&#039;s usb backup to the container&#039;s /:&lt;br /&gt;
#*&amp;lt;pre&amp;gt;rsync --dry-run -avz -e &#039;ssh -p &amp;lt;C_SSHPORT&amp;gt;&#039; /backups/usb/&amp;lt;C_CODE&amp;gt; &amp;lt;C_CODE&amp;gt;:/      (Example: rsync --dry-run -avz -e &#039;ssh -p 19582&#039; /backups/usb/ad1 ad1:/&amp;lt;/pre&amp;gt;)&lt;br /&gt;
#Quick sane check, the latest git commit is not the latest git commit in the remote repo.&lt;br /&gt;
#Inform users they can login.&lt;br /&gt;
&lt;br /&gt;
==Configuring services to autostart during login==&lt;br /&gt;
For Ptcy.&lt;br /&gt;
&lt;br /&gt;
#Create a file &#039;autostart.cfg&#039; in the data folder &lt;br /&gt;
&lt;br /&gt;
 touch /root/hosts/&amp;lt;dbname&amp;gt;/data/autostart.cfg&lt;br /&gt;
&lt;br /&gt;
This will autostart a database service as long as at least one database service in that directory is running.&lt;br /&gt;
&lt;br /&gt;
For example, demo service will autostart during login if,&lt;br /&gt;
#/root/hosts/demo/data/autostart.cfg exists and&lt;br /&gt;
#demo_test service is running&lt;br /&gt;
&lt;br /&gt;
==Speedup postgresql importing databases==&lt;br /&gt;
&lt;br /&gt;
Can be sped up by a factor of 10 BUT may result in corrupt files in case of hard OS crash where the dirty memory is not flushed to storage.&lt;br /&gt;
&lt;br /&gt;
Therefore it is advisable to use this feature only briefly and REMEMBER TO REMOVE IT! &lt;br /&gt;
&lt;br /&gt;
Email to support@neosys.com whenever using it or use personal notes not memory.&lt;br /&gt;
&lt;br /&gt;
nano /etc/postgresql/12/main/postgresql.conf&lt;br /&gt;
&lt;br /&gt;
Uncomment or add a line&lt;br /&gt;
 fsync = off&lt;br /&gt;
Restart postgres … will break any neosys/exodus running processes.&lt;br /&gt;
 r postgresql&lt;br /&gt;
or reload postgres may also work&lt;br /&gt;
&lt;br /&gt;
==Database Attach==&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
root@exodus:~/exodus/cli/src# dbattach&lt;br /&gt;
dbattach - Attach foreign database files to the current default database&lt;br /&gt;
&lt;br /&gt;
Syntax is dbattach TARGETDB [FILENAME,...] {OPTION...}&lt;br /&gt;
&lt;br /&gt;
Options:&lt;br /&gt;
&lt;br /&gt;
  F   Forcibly delete any normal files in the current default database.&lt;br /&gt;
&lt;br /&gt;
  R   Detach foreign files&lt;br /&gt;
  RR  Remove foreign database connection.&lt;br /&gt;
  RRR Remove all foreign database connections and attachments.&lt;br /&gt;
&lt;br /&gt;
  L   List attached foreign files in the current default database&lt;br /&gt;
&lt;br /&gt;
If no filenames are provided then a database connection is created.&lt;br /&gt;
This is *required* before filenames can be provided and attached.&lt;br /&gt;
&lt;br /&gt;
Notes:&lt;br /&gt;
&lt;br /&gt;
Attachments are permanent until re-attached or removed.&lt;br /&gt;
&lt;br /&gt;
Indexes on attached files behave strangely.&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Issues:&lt;br /&gt;
&lt;br /&gt;
TARGETDB must be on the same connection as the current default database.&lt;br /&gt;
&lt;br /&gt;
Current user must have access to the foreign database.&lt;br /&gt;
&lt;br /&gt;
If EXO_USER and EXO_PASS are not set then exodus defaults are used.&lt;br /&gt;
&lt;br /&gt;
exodus .config file is not used currently.&lt;/div&gt;</summary>
		<author><name>Gregory</name></author>
	</entry>
	<entry>
		<id>https://techwiki.neosys.com/index.php?title=EXODUS_Knowledge&amp;diff=3981</id>
		<title>EXODUS Knowledge</title>
		<link rel="alternate" type="text/html" href="https://techwiki.neosys.com/index.php?title=EXODUS_Knowledge&amp;diff=3981"/>
		<updated>2022-06-02T07:48:39Z</updated>

		<summary type="html">&lt;p&gt;Gregory: /* Upgrading to new version */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==TMUX Screens==&lt;br /&gt;
&lt;br /&gt;
To create the EXODUS maintenance/programming environment&lt;br /&gt;
 exodus#: ./tmux.exodus&lt;br /&gt;
&lt;br /&gt;
===Screens===&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
0: /&lt;br /&gt;
    Work regarding exodus server. i.e /etc/nagios or general networking or /var/log/mail.log&lt;br /&gt;
&lt;br /&gt;
1: /root/exodus/&lt;br /&gt;
    Exodus core is installed Contains build and make libraries here ./libexodus&lt;br /&gt;
&lt;br /&gt;
2: /root/exodus/libexodus/exodus&lt;br /&gt;
    Core exodus (libraries that emulate the AREV system e.g mv.h )&lt;br /&gt;
    &lt;br /&gt;
3: /root/exodus/cli/src&lt;br /&gt;
    Exodus Command Line Interface e.g edir, edic, list, listfiles, delete, createdb&lt;br /&gt;
    &lt;br /&gt;
4: root/exodus/service&lt;br /&gt;
    EXODUS core default host directory but also contains scripts that create/manage requirements of a service (create_service, create_db, create_site, backup_db, restore_db, start, stop, status)&lt;br /&gt;
    One exception is NEOSYS www files are in ./www, which pulled from NEOSYS www git.&lt;br /&gt;
&lt;br /&gt;
5: /root/exodus/service/src&lt;br /&gt;
    Exodus core service programs (programs that are not related to NEOSYS agency operations and can be used to support other non-NEOSYS services) eg listen, usersubs, sendmail, openfile, select, sort, list,.&lt;br /&gt;
&lt;br /&gt;
    Extra info:    &lt;br /&gt;
    sql directory contains basic dictiorary files converted to sql instructions used when creating a EXODUS psql database&lt;br /&gt;
    e.g dict_voc.sql is a file that describes what to expect in certain fields of the voc file.&lt;br /&gt;
    TODO: compall currently throws few warnings. Read them and familiarise. In case new warnings appear, notify Steve.    &lt;br /&gt;
        &lt;br /&gt;
6: /root/neosys&lt;br /&gt;
    NEOSYS specific client installation management scripts e.g .doall, import_db and import_files (from AREV), ./run ./test (see below for these two commands)&lt;br /&gt;
    &lt;br /&gt;
7: /root/neosys/src&lt;br /&gt;
    NEOSYS Agency programs (see section How AREV programs are distributed in EXODUS src/*.cpp&lt;br /&gt;
    ../ has .git&lt;br /&gt;
&lt;br /&gt;
8: /root/hosts&lt;br /&gt;
    client specific files  e.g logs, images, (shared ./www -&amp;gt; root/exodus/service/www&lt;br /&gt;
&lt;br /&gt;
9: /root/exodus/test/src&lt;br /&gt;
    series of programs that test whether subroutines (specifically Exodus core libraries) work as they should eg for the var lib - &amp;quot;assert( var(&amp;quot;11111&amp;quot;).isnum());&amp;quot;&lt;br /&gt;
&lt;br /&gt;
10: bash /bin/top&lt;br /&gt;
    Monitor for NEOSYS client processes&lt;br /&gt;
    Displays customised format: sorted by total time spend and by processor time.&lt;br /&gt;
     Press &amp;quot;=&amp;quot; : to change to standard top format&lt;br /&gt;
     Press shift + w : to save format settings, replacing the old customised top format&lt;br /&gt;
     To go back to the customised format do:&lt;br /&gt;
        Press &amp;quot;o&amp;quot;&lt;br /&gt;
        Type &amp;quot;COMMAND=serve_agy&amp;quot;&lt;br /&gt;
        shift + t : this sorts by total time spent&lt;br /&gt;
        shift + p : this sorts by processor time&lt;br /&gt;
        shift + w : to save this setting and enter  &#039;y&#039; to confirm&lt;br /&gt;
&lt;br /&gt;
11: /var/log/syslog&lt;br /&gt;
     Log of NEOSYS client requests&lt;br /&gt;
&lt;br /&gt;
12: /root/exodus/service/quick&lt;br /&gt;
     Displays the last time the svr file (in /root/hosts/&amp;lt;client&amp;gt;/data/&amp;lt;dbname&amp;gt;) was updated.&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Object Code/Libraries==&lt;br /&gt;
LIVE and TEST processes use different sets of object code.&lt;br /&gt;
TEST processes use libraries in ~/lib/, whereas LIVE processes use object code in ~/neo/lib&lt;br /&gt;
&lt;br /&gt;
This means development &amp;amp; testing can be done stress free on TEST database, as opposed to testing on production databases.&lt;br /&gt;
&lt;br /&gt;
When compiling using edic, the TEST object code is updated if the compilation is successful. (~/lib)&lt;br /&gt;
In order to apply a tested patch to LIVE see [[Update LIVE programs]].&lt;br /&gt;
&lt;br /&gt;
==Dictionaries &amp;amp; Psql Functions==&lt;br /&gt;
&lt;br /&gt;
Dictionaries, data used to describe other data; specifically the fields of other files. &lt;br /&gt;
&lt;br /&gt;
There are three types of fields: &amp;lt;pre&amp;gt;&lt;br /&gt;
(F) field for raw data E.g &amp;quot;Office 44 Building Rush&amp;quot;&lt;br /&gt;
(S) symbolic or calculated E.g for total ans=field1+field2&lt;br /&gt;
(G) General, pending &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Show dictionary using &amp;quot;EXO_DATA=test list dict.clients&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
===Development and deployment using &#039;dat&#039; files===&lt;br /&gt;
&lt;br /&gt;
====Rationale====&lt;br /&gt;
&lt;br /&gt;
Part of system development is the creation of various data that is neither programs nor layout i.e. not cpp, h, html, js, php files etc.&lt;br /&gt;
&lt;br /&gt;
For example:&lt;br /&gt;
&lt;br /&gt;
*Dictionaries are data about data.&lt;br /&gt;
*Language files are data about text to use for various languages.&lt;br /&gt;
*“Change logs” are data about changes in the system.&lt;br /&gt;
&lt;br /&gt;
Historically, in EXODUS and NEOSYS, the above data has been deployed in exodus database files using SQL text files. However SQL files are not convenient for development.&lt;br /&gt;
&lt;br /&gt;
Therefore, &#039;dat&#039; text files will be used now so that standard development tools including editors and git can be fully exploited.&lt;br /&gt;
&lt;br /&gt;
====&#039;dat&#039; files====&lt;br /&gt;
&lt;br /&gt;
Each database file is represented by an os directory of the same name.&lt;br /&gt;
&lt;br /&gt;
Each record in the database file is represented by an os text file where filename is the primary key.&lt;br /&gt;
&lt;br /&gt;
For example a record with key &#039;&#039;&#039;DEADLINE&#039;&#039;&#039; in a dat file &#039;&#039;&#039;dict.materials&#039;&#039;&#039; would be represented as an os text file &#039;&#039;&#039;dat/dict.materials/DEADLINE&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Each line in the os text file represents one field in the db record. In other words, db record FM characters are represented by new line characters in &#039;dat&#039; files. Any actual new line characters required in the record, and any backslashes, are escaped and appear as &#039;\n&#039; and &#039;\\&#039; in &#039;dat&#039; files. Other database field separator characters such as VM, SM, TM and STM are stored without any conversion.&lt;br /&gt;
&lt;br /&gt;
====Location of dat files====&lt;br /&gt;
&lt;br /&gt;
The development versions are stored in exodus and neosys src/dat dirs. They form part of the standard git repositories in parallel with cpp files.&lt;br /&gt;
&lt;br /&gt;
The operational versions are stored in ~/dat and ~/live/dat alongside bin and lib dirs and are automatically installed into databases as database files on service startup. Any database functions embedded in the text files (pgsql) are also automatically installed at the same time.&lt;br /&gt;
&lt;br /&gt;
====Editing and deploying a &#039;dat&#039; file====&lt;br /&gt;
&lt;br /&gt;
It is currently a three step process to edit and deploy such &#039;dat&#039; files. &lt;br /&gt;
&lt;br /&gt;
=====Edit the &#039;dat&#039; file=====&lt;br /&gt;
&lt;br /&gt;
Note that EXODUS service and NEOSYS service have different src/dat folders.&lt;br /&gt;
&lt;br /&gt;
Editing language items:&lt;br /&gt;
&lt;br /&gt;
 edir dat/alanguage/SCHEDULES*ARABIC&lt;br /&gt;
&lt;br /&gt;
Editing a dictionary item:&lt;br /&gt;
&lt;br /&gt;
 edir dat/dict.materials/DEADLINE&lt;br /&gt;
&lt;br /&gt;
Editing a pgsql function in a dictionary:&lt;br /&gt;
&lt;br /&gt;
 edir dat/dict.materials/DEADLINE 8&lt;br /&gt;
&lt;br /&gt;
=====Copy all &#039;dat&#039; files to ~/dat =====&lt;br /&gt;
&lt;br /&gt;
This step might be removed at a later date.&lt;br /&gt;
&lt;br /&gt;
This will cause all test databases to immediately restart and load any &#039;dat&#039; file changes into dictionaries and data files and also create any new or modified pgsql functions.&lt;br /&gt;
&lt;br /&gt;
If any ~/neosys/src/dat files were edited:&lt;br /&gt;
&lt;br /&gt;
 cd ~/neosys/src&lt;br /&gt;
 &lt;br /&gt;
 ./compall dat&lt;br /&gt;
&lt;br /&gt;
and/or, if exodus/service/dat files were edited&lt;br /&gt;
&lt;br /&gt;
 cd ~/exodus/service/src&lt;br /&gt;
 &lt;br /&gt;
 ./compall dat&lt;br /&gt;
&lt;br /&gt;
=====Copy all programs and &#039;dat&#039; files to ~/live/bin|lib|dat=====&lt;br /&gt;
&lt;br /&gt;
This should only be run after testing. It will cause all live databases to automatically restart and do the same as the test databases mentioned above.&lt;br /&gt;
&lt;br /&gt;
 cd ~/exodus/service&lt;br /&gt;
 &lt;br /&gt;
 ./copyall CONFIRM&lt;br /&gt;
​&lt;br /&gt;
&lt;br /&gt;
===Psql unaccent extension===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The unaccent extension and the immutable_unaccent function are created in the db ‘template1’ during exodus installation while user is postgres which is a superuser.&lt;br /&gt;
&lt;br /&gt;
Thereafter all new databases are created as copies of template1 so they contain the extension and function&lt;br /&gt;
&lt;br /&gt;
====Error====&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
MVDBException:ERROR: function immutable_unaccent(text) does not exist&lt;br /&gt;
ERROR:  permission denied to create extension &amp;quot;unaccent&amp;quot;&lt;br /&gt;
HINT:  Must be superuser to create this extension. &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====Solution====&lt;br /&gt;
sudo -u postgres psql -c &#039;ALTER USER exodus WITH SUPERUSER;&#039;&lt;br /&gt;
&lt;br /&gt;
==Processes==&lt;br /&gt;
The TEST process for all database use the same object code stored in /root/lib, whereas all LIVE process use the object code in /root/neo/.&lt;br /&gt;
&lt;br /&gt;
==Postgres==&lt;br /&gt;
Connect into postgres shell:&lt;br /&gt;
 alias psql=&#039;sudo -u postgres psql&#039;&lt;br /&gt;
&lt;br /&gt;
Delete a database:&lt;br /&gt;
 sudo -u postgres dropdb &amp;lt;dbcode&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Debugging Exodus==&lt;br /&gt;
&lt;br /&gt;
===Debugging Live/Test services===&lt;br /&gt;
&lt;br /&gt;
./test &amp;lt;dbname&amp;gt; - execute test programs on _test database.&lt;br /&gt;
&lt;br /&gt;
./run &amp;lt;dbname&amp;gt;  - execute test programs on live database.&lt;br /&gt;
&lt;br /&gt;
===Debugging var values===&lt;br /&gt;
&lt;br /&gt;
Explanation of var flag value in gdb debug mode.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
(gdb) p varx                                                           &lt;br /&gt;
$2 = {var_str = &amp;quot;&amp;quot;, var_int = 0, var_dbl = 0, var_typ = {flags_ = 2}}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Each exodus var object contains 3 variables of type string, int and double.&lt;br /&gt;
&lt;br /&gt;
All 3 may be unassigned or only the string be assigned or just the int and double e.t.&lt;br /&gt;
&lt;br /&gt;
You can tell which variable type of a var object are set based on the var&#039;s flag value.&lt;br /&gt;
&lt;br /&gt;
1 = Means the string is assigned&lt;br /&gt;
2 = Means the int is assigned&lt;br /&gt;
4 = Means the double is assigned&lt;br /&gt;
&lt;br /&gt;
Example: If the flag is 7 (1+2+4), then all types are assigned.&lt;br /&gt;
&lt;br /&gt;
===Process Hung or consuming +100% CPU===&lt;br /&gt;
If process is consuming +100% CPU then it is likely stuck in an infinite loop.&lt;br /&gt;
&lt;br /&gt;
 ./doall &amp;lt;CLIENT&amp;gt; stop&lt;br /&gt;
&lt;br /&gt;
 ./run &amp;lt;CLIENT&amp;gt; &lt;br /&gt;
&lt;br /&gt;
 ./test &amp;lt;CLIENT&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Search through recent logs for &amp;lt;CLIENT&amp;gt; looking for requests that didn&#039;t return OK at the time nagios alerted of Hung process.&lt;br /&gt;
&lt;br /&gt;
A user may also instigate the error again, so monitor the CLIENT&#039;s service CPU usage.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
If cause found recreate it in test and once test process hit +100% break in test debugger.&lt;br /&gt;
&lt;br /&gt;
If cause not found, you will have to continue checking logs for the request that caused it or hope a user recreates the issue in live debugged service.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Once you&#039;ve broken in the debugged with the error, enter &amp;quot;n&amp;quot; and hold the enter key until you just seeing line repeat.&lt;br /&gt;
&lt;br /&gt;
Pay attention to start of loops code. E.g WHILE or FOR. (there is likely an error is there)&lt;br /&gt;
&lt;br /&gt;
==./doall==&lt;br /&gt;
====General====&lt;br /&gt;
&lt;br /&gt;
~/neosys/doall [LIVE|TEST] &amp;lt;DBCODE|ALL&amp;gt; &amp;lt; ACTION [OPTIONS,..]  | bash -- COMMAND ]&lt;br /&gt;
&lt;br /&gt;
Example: &lt;br /&gt;
 ./doall TEST ALL create_site t-&lt;br /&gt;
Result:&lt;br /&gt;
Create site for ALL TEST databases, using domain name prefix option &amp;quot;t-&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Screen 6: ./doall script contains all the necessary information(codes) to setup an installation.&lt;br /&gt;
It includes scripts to backup, restore, create an Apache site, create/start/stop/status a service, import an AREV database into postgres and more.&lt;br /&gt;
&lt;br /&gt;
====backup_db====&lt;br /&gt;
&lt;br /&gt;
*Does a backup &amp;amp; restore of a LIVE database into the corresponding TEST database.&lt;br /&gt;
*Backup &amp;lt;dbcode&amp;gt;.sql file is written to /root/backups/sql; which is rsynced to nl19:/backups/current/exodus/&lt;br /&gt;
*Unlike AREV, postgres can perform a &amp;quot;backup&amp;quot; of a database whilst the system is in use.&lt;br /&gt;
&lt;br /&gt;
==Git==&lt;br /&gt;
&lt;br /&gt;
There are two repositories, one for EXODUS and the other for NEOSYS.&lt;br /&gt;
&lt;br /&gt;
===Using git to make changes===&lt;br /&gt;
&lt;br /&gt;
Before following steps you must have a tested updated to a program/file/script. Do not commit untested changes to avoid a messy git history of reverts.&lt;br /&gt;
&lt;br /&gt;
Update your local repo before committing to local repo using the g alias for &amp;quot;git pull --ff-only ; git push &amp;amp;&amp;amp; git status&#039;&amp;quot;:&lt;br /&gt;
&amp;lt;pre&amp;gt;g&amp;lt;/pre&amp;gt;&lt;br /&gt;
Check which updates/files have not yet been staged and/or committed:&lt;br /&gt;
Add your updates to the staged area:&lt;br /&gt;
&amp;lt;pre&amp;gt;git add &amp;lt;filename&amp;gt;&amp;lt;/pre&amp;gt;&lt;br /&gt;
or if all the changes made need to be staged:&lt;br /&gt;
&amp;lt;pre&amp;gt;git add -a&amp;lt;/pre&amp;gt;&lt;br /&gt;
Make a commit with a descriptive message on purpose of updates:&lt;br /&gt;
&amp;lt;pre&amp;gt;git commit -m &amp;lt;description n purpose of changes&amp;gt;&amp;lt;/pre&amp;gt;&lt;br /&gt;
Again use g alias:&lt;br /&gt;
&amp;lt;pre&amp;gt;g&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Other useful git cmds===&lt;br /&gt;
&lt;br /&gt;
Do not use this commands unless you know what WILL happen. &lt;br /&gt;
*git pull - Instead use the safe &amp;quot;git pull --ff-only&amp;quot;&lt;br /&gt;
Stick to the alias &amp;quot;g&amp;quot; which does &amp;quot;git pull --ff-only ; git push &amp;amp;&amp;amp; git status&#039;&amp;quot;&lt;br /&gt;
&lt;br /&gt;
*git log - display history of commits to master branch&lt;br /&gt;
*git diff - display the differences in files between working files and files in local repo.&lt;br /&gt;
*git status - display: which updated files are staged/not staged(tracked)&lt;br /&gt;
*git stash - &lt;br /&gt;
*git branch - switch to a new branch&lt;br /&gt;
*git branch &amp;lt;branchname&amp;gt; - will switch to this branch only if it exists&lt;br /&gt;
*git checkout - DESTROYS/Updates the state of local working directory with the state of the files in the local repo. (YOU WILL LOSE non staged updates)&lt;br /&gt;
*git restore &amp;lt;filename&amp;gt; - DESTROYS/Updates the file with the version in the local repo. (like with git checkout but for a specific file)&lt;br /&gt;
*git checkin - &lt;br /&gt;
*git revert &amp;lt;commitHash&amp;gt; - reverses a specific commit (use git log to get the chosen commit hash)&lt;br /&gt;
*git ..&lt;br /&gt;
&lt;br /&gt;
==Converting AREV programs to EXODUS==&lt;br /&gt;
===Decompile AREV to C++===&lt;br /&gt;
&lt;br /&gt;
Do in Master AREV Installation Maintenance mode: (win7)&lt;br /&gt;
&lt;br /&gt;
#ATTACH ADECOMC &lt;br /&gt;
#*ADECOM &amp;lt;programname&amp;gt;   *single program&lt;br /&gt;
#*ADECOM &amp;lt;prog1&amp;gt; &amp;lt;prog2&amp;gt; &lt;br /&gt;
#*ADECOMALL              *all programs   (CHECK FIRST)&lt;br /&gt;
&lt;br /&gt;
Include the option &amp;quot;(V)&amp;quot; in the command to print the C++ to a notepad, which can easily be copy and pasted.&lt;br /&gt;
&lt;br /&gt;
===Getting C++ program to Exodus Installation===&lt;br /&gt;
&lt;br /&gt;
Two methods: (use the first for one off programs)&lt;br /&gt;
&lt;br /&gt;
====Copy &amp;amp; Paste====&lt;br /&gt;
&lt;br /&gt;
Compile program and open source code in notepad&lt;br /&gt;
&lt;br /&gt;
 ADECOM &amp;lt;programname&amp;gt; (V)&lt;br /&gt;
&lt;br /&gt;
Find which directory the program belongs. e.g fin/med/job/sys e.t&lt;br /&gt;
&lt;br /&gt;
 find /cygdrive/d/exodus/pickos | grep &amp;lt;program name&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If cpp in SYS, the program belongs in ~/exodus/service/src OR if in MED JOB FIN GEN AGY the program belongs in ~/neosys/src&lt;br /&gt;
&lt;br /&gt;
Copy the source code in the text file from the first command.&lt;br /&gt;
&lt;br /&gt;
In Exodus, create a new .cpp (in correct directory) and paste the source code.&lt;br /&gt;
&lt;br /&gt;
Compile &amp;amp; Test&lt;br /&gt;
&lt;br /&gt;
====Rsync====&lt;br /&gt;
&lt;br /&gt;
 /d/exodus/arev/syncup.sh&lt;br /&gt;
&lt;br /&gt;
If cpp in SYS then: ~/exodus/service/src ./getpickos&lt;br /&gt;
&lt;br /&gt;
If cpp in MED JOB FIN GEN AGY then: *~/neosys/src&lt;br /&gt;
&lt;br /&gt;
===Compile C++ files to TEST system===&lt;br /&gt;
&lt;br /&gt;
#*./test &amp;lt;DBNAME&amp;gt;&lt;br /&gt;
#*~/neosys ./doall TEST &amp;lt;DBNAME&amp;gt; restart    #to get one service to start start using the new lib files&lt;br /&gt;
#*~/neosys ./doall TEST all restart         #to get all the services to start start using the new lib files&lt;br /&gt;
&lt;br /&gt;
===Install C++ files to LIVE System===&lt;br /&gt;
&lt;br /&gt;
#~/exodus/service/ ./copyall            #to copy all the ~/lib and bin files to ~/live/lib and bin ... which is used by all exodus/live services&lt;br /&gt;
&lt;br /&gt;
==Writing Standard Exodus Core Function/Method Testing==&lt;br /&gt;
Screen 9: ~/exodus/test/src/&lt;br /&gt;
There are a series of test programs that check whether methods/functions behave as intended.&lt;br /&gt;
They do this using the function, assert.. a 1 or more argument values produce one and only one output)&lt;br /&gt;
&lt;br /&gt;
e.g test_multilang.cpp or test_sort.cpp&lt;br /&gt;
&lt;br /&gt;
Two methods of running test programs:&lt;br /&gt;
*Screen 9: make test&lt;br /&gt;
*after compiling using edic/compile/c, enter test_prog_name. (Since compile has moved it to ~/bin)&lt;br /&gt;
&lt;br /&gt;
Difference between the two methods is make calls gdb directly;&lt;br /&gt;
whereas ~/bin/test_prog_name uses exodus compile program&lt;br /&gt;
#~/neosys ./doall LIVE all restart&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Upgrading Exodus==&lt;br /&gt;
&lt;br /&gt;
#Develop patch in Dev system &lt;br /&gt;
&lt;br /&gt;
===Patching neosys/src or exodus/service/src===&lt;br /&gt;
&lt;br /&gt;
#Manually insert patches and compile into test programs.&lt;br /&gt;
#If patch dat files then run neosys/compall to get dat files into ~/dat&lt;br /&gt;
*If Patsalides:&lt;br /&gt;
*#SITE_DIR=ptcy ./test basic &lt;br /&gt;
*#login to BASIC_TEST and test&lt;br /&gt;
*Other clients:&lt;br /&gt;
*#./test DBCODE&lt;br /&gt;
*#login to DBCODE and test patches works&lt;br /&gt;
#run exodus/service/copyall and check only the patched programs are listed. (if not, see Troubleshoot below)&lt;br /&gt;
#Inform users to log off for 10mins. As a rule of thumb, live services must be stopped before copying test programs to live.&lt;br /&gt;
#exodus/service/copyall CONFIRM&lt;br /&gt;
&lt;br /&gt;
====Troubleshoot====&lt;br /&gt;
&lt;br /&gt;
=====./copyall lists programs you have not patched=====&lt;br /&gt;
Use exodus/service/copyone to copy only your patched programs one by one. (./copyone will not copy dat files)&lt;br /&gt;
&lt;br /&gt;
===Upgrading to new version===&lt;br /&gt;
&lt;br /&gt;
READ: remember there is no test version of libexodus programs. This means that if libexodus programs are compiled and installed, neosys/src and exodus/services LIVE programs MUST BE UPGRADED.&lt;br /&gt;
&lt;br /&gt;
#Upgrade test system to test&lt;br /&gt;
##If a dev system like de2, git stash any uncommitted changes other staff may be working on.&lt;br /&gt;
##Run &amp;quot;g&amp;quot; in ~/exodus (to do git pull --ff-only)&lt;br /&gt;
##Run &amp;quot;m&amp;quot; in ~/exodus (to compile and install libexodus)&lt;br /&gt;
##Run &amp;quot;~/neosys/upgrade.all.sh live&amp;quot; in ~/neosys (to upgrade exodus/service and neosys/src live programs)&lt;br /&gt;
##Begin testing&lt;br /&gt;
#Upgrade clients&lt;br /&gt;
##*Client hosted - Schedule a planned upgrade with client.&lt;br /&gt;
##*NEOSYS hosted - Inform all clients/users of planned morning upgrade, 24hours in advanced.      (TODO: &#039;What&#039;s New in NEOSYS&#039;) AND (emailallusers.cpp)&lt;br /&gt;
##Day of upgrade, check USB backup was successful &amp;amp; make a container snapshot, otherwise do not proceed.&lt;br /&gt;
##Stop services&lt;br /&gt;
##Run &amp;quot;g&amp;quot; in ~/exodus (to do git pull --ff-only)&lt;br /&gt;
##Run &amp;quot;m&amp;quot; in ~/exodus (to compile and install libexodus)&lt;br /&gt;
##Run &amp;quot;~/neosys/upgrade.all.sh live&amp;quot;. &lt;br /&gt;
##Check services started automatically without issues.&lt;br /&gt;
#Inform users their system has been upgraded and they can login.&lt;br /&gt;
&lt;br /&gt;
===Roll Back Upgrade===&lt;br /&gt;
&lt;br /&gt;
If for any reason the entire upgrade needs to be reverted (excludes clients database), follow steps below:&lt;br /&gt;
&lt;br /&gt;
#Inform users that there is a problem and services need to be stopped.&lt;br /&gt;
#Stop all exodus processes.&lt;br /&gt;
#Restore the morning&#039;s USB backup by: (Note this backup contains:  source/obj code, /etc, neosys scripts but not client data)&lt;br /&gt;
##Login into container&#039;s host and rsync the morning&#039;s usb backup to the container&#039;s /:&lt;br /&gt;
#*&amp;lt;pre&amp;gt;rsync --dry-run -avz -e &#039;ssh -p &amp;lt;C_SSHPORT&amp;gt;&#039; /backups/usb/&amp;lt;C_CODE&amp;gt; &amp;lt;C_CODE&amp;gt;:/      (Example: rsync --dry-run -avz -e &#039;ssh -p 19582&#039; /backups/usb/ad1 ad1:/&amp;lt;/pre&amp;gt;)&lt;br /&gt;
#Quick sane check, the latest git commit is not the latest git commit in the remote repo.&lt;br /&gt;
#Inform users they can login.&lt;br /&gt;
&lt;br /&gt;
==Configuring services to autostart during login==&lt;br /&gt;
For Ptcy.&lt;br /&gt;
&lt;br /&gt;
#Create a file &#039;autostart.cfg&#039; in the data folder &lt;br /&gt;
&lt;br /&gt;
 touch /root/hosts/&amp;lt;dbname&amp;gt;/data/autostart.cfg&lt;br /&gt;
&lt;br /&gt;
This will autostart a database service as long as at least one database service in that directory is running.&lt;br /&gt;
&lt;br /&gt;
For example, demo service will autostart during login if,&lt;br /&gt;
#/root/hosts/demo/data/autostart.cfg exists and&lt;br /&gt;
#demo_test service is running&lt;br /&gt;
&lt;br /&gt;
==Speedup postgresql importing databases==&lt;br /&gt;
&lt;br /&gt;
Can be sped up by a factor of 10 BUT may result in corrupt files in case of hard OS crash where the dirty memory is not flushed to storage.&lt;br /&gt;
&lt;br /&gt;
Therefore it is advisable to use this feature only briefly and REMEMBER TO REMOVE IT! &lt;br /&gt;
&lt;br /&gt;
Email to support@neosys.com whenever using it or use personal notes not memory.&lt;br /&gt;
&lt;br /&gt;
nano /etc/postgresql/12/main/postgresql.conf&lt;br /&gt;
&lt;br /&gt;
Uncomment or add a line&lt;br /&gt;
 fsync = off&lt;br /&gt;
Restart postgres … will break any neosys/exodus running processes.&lt;br /&gt;
 r postgresql&lt;br /&gt;
or reload postgres may also work&lt;br /&gt;
&lt;br /&gt;
==Database Attach==&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
root@exodus:~/exodus/cli/src# dbattach&lt;br /&gt;
dbattach - Attach foreign database files to the current default database&lt;br /&gt;
&lt;br /&gt;
Syntax is dbattach TARGETDB [FILENAME,...] {OPTION...}&lt;br /&gt;
&lt;br /&gt;
Options:&lt;br /&gt;
&lt;br /&gt;
  F   Forcibly delete any normal files in the current default database.&lt;br /&gt;
&lt;br /&gt;
  R   Detach foreign files&lt;br /&gt;
  RR  Remove foreign database connection.&lt;br /&gt;
  RRR Remove all foreign database connections and attachments.&lt;br /&gt;
&lt;br /&gt;
  L   List attached foreign files in the current default database&lt;br /&gt;
&lt;br /&gt;
If no filenames are provided then a database connection is created.&lt;br /&gt;
This is *required* before filenames can be provided and attached.&lt;br /&gt;
&lt;br /&gt;
Notes:&lt;br /&gt;
&lt;br /&gt;
Attachments are permanent until re-attached or removed.&lt;br /&gt;
&lt;br /&gt;
Indexes on attached files behave strangely.&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Issues:&lt;br /&gt;
&lt;br /&gt;
TARGETDB must be on the same connection as the current default database.&lt;br /&gt;
&lt;br /&gt;
Current user must have access to the foreign database.&lt;br /&gt;
&lt;br /&gt;
If EXO_USER and EXO_PASS are not set then exodus defaults are used.&lt;br /&gt;
&lt;br /&gt;
exodus .config file is not used currently.&lt;/div&gt;</summary>
		<author><name>Gregory</name></author>
	</entry>
	<entry>
		<id>https://techwiki.neosys.com/index.php?title=EXODUS_Knowledge&amp;diff=3980</id>
		<title>EXODUS Knowledge</title>
		<link rel="alternate" type="text/html" href="https://techwiki.neosys.com/index.php?title=EXODUS_Knowledge&amp;diff=3980"/>
		<updated>2022-06-02T07:06:43Z</updated>

		<summary type="html">&lt;p&gt;Gregory: /* ==./copyall lists programs you have not patched */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==TMUX Screens==&lt;br /&gt;
&lt;br /&gt;
To create the EXODUS maintenance/programming environment&lt;br /&gt;
 exodus#: ./tmux.exodus&lt;br /&gt;
&lt;br /&gt;
===Screens===&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
0: /&lt;br /&gt;
    Work regarding exodus server. i.e /etc/nagios or general networking or /var/log/mail.log&lt;br /&gt;
&lt;br /&gt;
1: /root/exodus/&lt;br /&gt;
    Exodus core is installed Contains build and make libraries here ./libexodus&lt;br /&gt;
&lt;br /&gt;
2: /root/exodus/libexodus/exodus&lt;br /&gt;
    Core exodus (libraries that emulate the AREV system e.g mv.h )&lt;br /&gt;
    &lt;br /&gt;
3: /root/exodus/cli/src&lt;br /&gt;
    Exodus Command Line Interface e.g edir, edic, list, listfiles, delete, createdb&lt;br /&gt;
    &lt;br /&gt;
4: root/exodus/service&lt;br /&gt;
    EXODUS core default host directory but also contains scripts that create/manage requirements of a service (create_service, create_db, create_site, backup_db, restore_db, start, stop, status)&lt;br /&gt;
    One exception is NEOSYS www files are in ./www, which pulled from NEOSYS www git.&lt;br /&gt;
&lt;br /&gt;
5: /root/exodus/service/src&lt;br /&gt;
    Exodus core service programs (programs that are not related to NEOSYS agency operations and can be used to support other non-NEOSYS services) eg listen, usersubs, sendmail, openfile, select, sort, list,.&lt;br /&gt;
&lt;br /&gt;
    Extra info:    &lt;br /&gt;
    sql directory contains basic dictiorary files converted to sql instructions used when creating a EXODUS psql database&lt;br /&gt;
    e.g dict_voc.sql is a file that describes what to expect in certain fields of the voc file.&lt;br /&gt;
    TODO: compall currently throws few warnings. Read them and familiarise. In case new warnings appear, notify Steve.    &lt;br /&gt;
        &lt;br /&gt;
6: /root/neosys&lt;br /&gt;
    NEOSYS specific client installation management scripts e.g .doall, import_db and import_files (from AREV), ./run ./test (see below for these two commands)&lt;br /&gt;
    &lt;br /&gt;
7: /root/neosys/src&lt;br /&gt;
    NEOSYS Agency programs (see section How AREV programs are distributed in EXODUS src/*.cpp&lt;br /&gt;
    ../ has .git&lt;br /&gt;
&lt;br /&gt;
8: /root/hosts&lt;br /&gt;
    client specific files  e.g logs, images, (shared ./www -&amp;gt; root/exodus/service/www&lt;br /&gt;
&lt;br /&gt;
9: /root/exodus/test/src&lt;br /&gt;
    series of programs that test whether subroutines (specifically Exodus core libraries) work as they should eg for the var lib - &amp;quot;assert( var(&amp;quot;11111&amp;quot;).isnum());&amp;quot;&lt;br /&gt;
&lt;br /&gt;
10: bash /bin/top&lt;br /&gt;
    Monitor for NEOSYS client processes&lt;br /&gt;
    Displays customised format: sorted by total time spend and by processor time.&lt;br /&gt;
     Press &amp;quot;=&amp;quot; : to change to standard top format&lt;br /&gt;
     Press shift + w : to save format settings, replacing the old customised top format&lt;br /&gt;
     To go back to the customised format do:&lt;br /&gt;
        Press &amp;quot;o&amp;quot;&lt;br /&gt;
        Type &amp;quot;COMMAND=serve_agy&amp;quot;&lt;br /&gt;
        shift + t : this sorts by total time spent&lt;br /&gt;
        shift + p : this sorts by processor time&lt;br /&gt;
        shift + w : to save this setting and enter  &#039;y&#039; to confirm&lt;br /&gt;
&lt;br /&gt;
11: /var/log/syslog&lt;br /&gt;
     Log of NEOSYS client requests&lt;br /&gt;
&lt;br /&gt;
12: /root/exodus/service/quick&lt;br /&gt;
     Displays the last time the svr file (in /root/hosts/&amp;lt;client&amp;gt;/data/&amp;lt;dbname&amp;gt;) was updated.&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Object Code/Libraries==&lt;br /&gt;
LIVE and TEST processes use different sets of object code.&lt;br /&gt;
TEST processes use libraries in ~/lib/, whereas LIVE processes use object code in ~/neo/lib&lt;br /&gt;
&lt;br /&gt;
This means development &amp;amp; testing can be done stress free on TEST database, as opposed to testing on production databases.&lt;br /&gt;
&lt;br /&gt;
When compiling using edic, the TEST object code is updated if the compilation is successful. (~/lib)&lt;br /&gt;
In order to apply a tested patch to LIVE see [[Update LIVE programs]].&lt;br /&gt;
&lt;br /&gt;
==Dictionaries &amp;amp; Psql Functions==&lt;br /&gt;
&lt;br /&gt;
Dictionaries, data used to describe other data; specifically the fields of other files. &lt;br /&gt;
&lt;br /&gt;
There are three types of fields: &amp;lt;pre&amp;gt;&lt;br /&gt;
(F) field for raw data E.g &amp;quot;Office 44 Building Rush&amp;quot;&lt;br /&gt;
(S) symbolic or calculated E.g for total ans=field1+field2&lt;br /&gt;
(G) General, pending &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Show dictionary using &amp;quot;EXO_DATA=test list dict.clients&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
===Development and deployment using &#039;dat&#039; files===&lt;br /&gt;
&lt;br /&gt;
====Rationale====&lt;br /&gt;
&lt;br /&gt;
Part of system development is the creation of various data that is neither programs nor layout i.e. not cpp, h, html, js, php files etc.&lt;br /&gt;
&lt;br /&gt;
For example:&lt;br /&gt;
&lt;br /&gt;
*Dictionaries are data about data.&lt;br /&gt;
*Language files are data about text to use for various languages.&lt;br /&gt;
*“Change logs” are data about changes in the system.&lt;br /&gt;
&lt;br /&gt;
Historically, in EXODUS and NEOSYS, the above data has been deployed in exodus database files using SQL text files. However SQL files are not convenient for development.&lt;br /&gt;
&lt;br /&gt;
Therefore, &#039;dat&#039; text files will be used now so that standard development tools including editors and git can be fully exploited.&lt;br /&gt;
&lt;br /&gt;
====&#039;dat&#039; files====&lt;br /&gt;
&lt;br /&gt;
Each database file is represented by an os directory of the same name.&lt;br /&gt;
&lt;br /&gt;
Each record in the database file is represented by an os text file where filename is the primary key.&lt;br /&gt;
&lt;br /&gt;
For example a record with key &#039;&#039;&#039;DEADLINE&#039;&#039;&#039; in a dat file &#039;&#039;&#039;dict.materials&#039;&#039;&#039; would be represented as an os text file &#039;&#039;&#039;dat/dict.materials/DEADLINE&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Each line in the os text file represents one field in the db record. In other words, db record FM characters are represented by new line characters in &#039;dat&#039; files. Any actual new line characters required in the record, and any backslashes, are escaped and appear as &#039;\n&#039; and &#039;\\&#039; in &#039;dat&#039; files. Other database field separator characters such as VM, SM, TM and STM are stored without any conversion.&lt;br /&gt;
&lt;br /&gt;
====Location of dat files====&lt;br /&gt;
&lt;br /&gt;
The development versions are stored in exodus and neosys src/dat dirs. They form part of the standard git repositories in parallel with cpp files.&lt;br /&gt;
&lt;br /&gt;
The operational versions are stored in ~/dat and ~/live/dat alongside bin and lib dirs and are automatically installed into databases as database files on service startup. Any database functions embedded in the text files (pgsql) are also automatically installed at the same time.&lt;br /&gt;
&lt;br /&gt;
====Editing and deploying a &#039;dat&#039; file====&lt;br /&gt;
&lt;br /&gt;
It is currently a three step process to edit and deploy such &#039;dat&#039; files. &lt;br /&gt;
&lt;br /&gt;
=====Edit the &#039;dat&#039; file=====&lt;br /&gt;
&lt;br /&gt;
Note that EXODUS service and NEOSYS service have different src/dat folders.&lt;br /&gt;
&lt;br /&gt;
Editing language items:&lt;br /&gt;
&lt;br /&gt;
 edir dat/alanguage/SCHEDULES*ARABIC&lt;br /&gt;
&lt;br /&gt;
Editing a dictionary item:&lt;br /&gt;
&lt;br /&gt;
 edir dat/dict.materials/DEADLINE&lt;br /&gt;
&lt;br /&gt;
Editing a pgsql function in a dictionary:&lt;br /&gt;
&lt;br /&gt;
 edir dat/dict.materials/DEADLINE 8&lt;br /&gt;
&lt;br /&gt;
=====Copy all &#039;dat&#039; files to ~/dat =====&lt;br /&gt;
&lt;br /&gt;
This step might be removed at a later date.&lt;br /&gt;
&lt;br /&gt;
This will cause all test databases to immediately restart and load any &#039;dat&#039; file changes into dictionaries and data files and also create any new or modified pgsql functions.&lt;br /&gt;
&lt;br /&gt;
If any ~/neosys/src/dat files were edited:&lt;br /&gt;
&lt;br /&gt;
 cd ~/neosys/src&lt;br /&gt;
 &lt;br /&gt;
 ./compall dat&lt;br /&gt;
&lt;br /&gt;
and/or, if exodus/service/dat files were edited&lt;br /&gt;
&lt;br /&gt;
 cd ~/exodus/service/src&lt;br /&gt;
 &lt;br /&gt;
 ./compall dat&lt;br /&gt;
&lt;br /&gt;
=====Copy all programs and &#039;dat&#039; files to ~/live/bin|lib|dat=====&lt;br /&gt;
&lt;br /&gt;
This should only be run after testing. It will cause all live databases to automatically restart and do the same as the test databases mentioned above.&lt;br /&gt;
&lt;br /&gt;
 cd ~/exodus/service&lt;br /&gt;
 &lt;br /&gt;
 ./copyall CONFIRM&lt;br /&gt;
​&lt;br /&gt;
&lt;br /&gt;
===Psql unaccent extension===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The unaccent extension and the immutable_unaccent function are created in the db ‘template1’ during exodus installation while user is postgres which is a superuser.&lt;br /&gt;
&lt;br /&gt;
Thereafter all new databases are created as copies of template1 so they contain the extension and function&lt;br /&gt;
&lt;br /&gt;
====Error====&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
MVDBException:ERROR: function immutable_unaccent(text) does not exist&lt;br /&gt;
ERROR:  permission denied to create extension &amp;quot;unaccent&amp;quot;&lt;br /&gt;
HINT:  Must be superuser to create this extension. &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====Solution====&lt;br /&gt;
sudo -u postgres psql -c &#039;ALTER USER exodus WITH SUPERUSER;&#039;&lt;br /&gt;
&lt;br /&gt;
==Processes==&lt;br /&gt;
The TEST process for all database use the same object code stored in /root/lib, whereas all LIVE process use the object code in /root/neo/.&lt;br /&gt;
&lt;br /&gt;
==Postgres==&lt;br /&gt;
Connect into postgres shell:&lt;br /&gt;
 alias psql=&#039;sudo -u postgres psql&#039;&lt;br /&gt;
&lt;br /&gt;
Delete a database:&lt;br /&gt;
 sudo -u postgres dropdb &amp;lt;dbcode&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Debugging Exodus==&lt;br /&gt;
&lt;br /&gt;
===Debugging Live/Test services===&lt;br /&gt;
&lt;br /&gt;
./test &amp;lt;dbname&amp;gt; - execute test programs on _test database.&lt;br /&gt;
&lt;br /&gt;
./run &amp;lt;dbname&amp;gt;  - execute test programs on live database.&lt;br /&gt;
&lt;br /&gt;
===Debugging var values===&lt;br /&gt;
&lt;br /&gt;
Explanation of var flag value in gdb debug mode.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
(gdb) p varx                                                           &lt;br /&gt;
$2 = {var_str = &amp;quot;&amp;quot;, var_int = 0, var_dbl = 0, var_typ = {flags_ = 2}}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Each exodus var object contains 3 variables of type string, int and double.&lt;br /&gt;
&lt;br /&gt;
All 3 may be unassigned or only the string be assigned or just the int and double e.t.&lt;br /&gt;
&lt;br /&gt;
You can tell which variable type of a var object are set based on the var&#039;s flag value.&lt;br /&gt;
&lt;br /&gt;
1 = Means the string is assigned&lt;br /&gt;
2 = Means the int is assigned&lt;br /&gt;
4 = Means the double is assigned&lt;br /&gt;
&lt;br /&gt;
Example: If the flag is 7 (1+2+4), then all types are assigned.&lt;br /&gt;
&lt;br /&gt;
===Process Hung or consuming +100% CPU===&lt;br /&gt;
If process is consuming +100% CPU then it is likely stuck in an infinite loop.&lt;br /&gt;
&lt;br /&gt;
 ./doall &amp;lt;CLIENT&amp;gt; stop&lt;br /&gt;
&lt;br /&gt;
 ./run &amp;lt;CLIENT&amp;gt; &lt;br /&gt;
&lt;br /&gt;
 ./test &amp;lt;CLIENT&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Search through recent logs for &amp;lt;CLIENT&amp;gt; looking for requests that didn&#039;t return OK at the time nagios alerted of Hung process.&lt;br /&gt;
&lt;br /&gt;
A user may also instigate the error again, so monitor the CLIENT&#039;s service CPU usage.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
If cause found recreate it in test and once test process hit +100% break in test debugger.&lt;br /&gt;
&lt;br /&gt;
If cause not found, you will have to continue checking logs for the request that caused it or hope a user recreates the issue in live debugged service.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Once you&#039;ve broken in the debugged with the error, enter &amp;quot;n&amp;quot; and hold the enter key until you just seeing line repeat.&lt;br /&gt;
&lt;br /&gt;
Pay attention to start of loops code. E.g WHILE or FOR. (there is likely an error is there)&lt;br /&gt;
&lt;br /&gt;
==./doall==&lt;br /&gt;
====General====&lt;br /&gt;
&lt;br /&gt;
~/neosys/doall [LIVE|TEST] &amp;lt;DBCODE|ALL&amp;gt; &amp;lt; ACTION [OPTIONS,..]  | bash -- COMMAND ]&lt;br /&gt;
&lt;br /&gt;
Example: &lt;br /&gt;
 ./doall TEST ALL create_site t-&lt;br /&gt;
Result:&lt;br /&gt;
Create site for ALL TEST databases, using domain name prefix option &amp;quot;t-&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Screen 6: ./doall script contains all the necessary information(codes) to setup an installation.&lt;br /&gt;
It includes scripts to backup, restore, create an Apache site, create/start/stop/status a service, import an AREV database into postgres and more.&lt;br /&gt;
&lt;br /&gt;
====backup_db====&lt;br /&gt;
&lt;br /&gt;
*Does a backup &amp;amp; restore of a LIVE database into the corresponding TEST database.&lt;br /&gt;
*Backup &amp;lt;dbcode&amp;gt;.sql file is written to /root/backups/sql; which is rsynced to nl19:/backups/current/exodus/&lt;br /&gt;
*Unlike AREV, postgres can perform a &amp;quot;backup&amp;quot; of a database whilst the system is in use.&lt;br /&gt;
&lt;br /&gt;
==Git==&lt;br /&gt;
&lt;br /&gt;
There are two repositories, one for EXODUS and the other for NEOSYS.&lt;br /&gt;
&lt;br /&gt;
===Using git to make changes===&lt;br /&gt;
&lt;br /&gt;
Before following steps you must have a tested updated to a program/file/script. Do not commit untested changes to avoid a messy git history of reverts.&lt;br /&gt;
&lt;br /&gt;
Update your local repo before committing to local repo using the g alias for &amp;quot;git pull --ff-only ; git push &amp;amp;&amp;amp; git status&#039;&amp;quot;:&lt;br /&gt;
&amp;lt;pre&amp;gt;g&amp;lt;/pre&amp;gt;&lt;br /&gt;
Check which updates/files have not yet been staged and/or committed:&lt;br /&gt;
Add your updates to the staged area:&lt;br /&gt;
&amp;lt;pre&amp;gt;git add &amp;lt;filename&amp;gt;&amp;lt;/pre&amp;gt;&lt;br /&gt;
or if all the changes made need to be staged:&lt;br /&gt;
&amp;lt;pre&amp;gt;git add -a&amp;lt;/pre&amp;gt;&lt;br /&gt;
Make a commit with a descriptive message on purpose of updates:&lt;br /&gt;
&amp;lt;pre&amp;gt;git commit -m &amp;lt;description n purpose of changes&amp;gt;&amp;lt;/pre&amp;gt;&lt;br /&gt;
Again use g alias:&lt;br /&gt;
&amp;lt;pre&amp;gt;g&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Other useful git cmds===&lt;br /&gt;
&lt;br /&gt;
Do not use this commands unless you know what WILL happen. &lt;br /&gt;
*git pull - Instead use the safe &amp;quot;git pull --ff-only&amp;quot;&lt;br /&gt;
Stick to the alias &amp;quot;g&amp;quot; which does &amp;quot;git pull --ff-only ; git push &amp;amp;&amp;amp; git status&#039;&amp;quot;&lt;br /&gt;
&lt;br /&gt;
*git log - display history of commits to master branch&lt;br /&gt;
*git diff - display the differences in files between working files and files in local repo.&lt;br /&gt;
*git status - display: which updated files are staged/not staged(tracked)&lt;br /&gt;
*git stash - &lt;br /&gt;
*git branch - switch to a new branch&lt;br /&gt;
*git branch &amp;lt;branchname&amp;gt; - will switch to this branch only if it exists&lt;br /&gt;
*git checkout - DESTROYS/Updates the state of local working directory with the state of the files in the local repo. (YOU WILL LOSE non staged updates)&lt;br /&gt;
*git restore &amp;lt;filename&amp;gt; - DESTROYS/Updates the file with the version in the local repo. (like with git checkout but for a specific file)&lt;br /&gt;
*git checkin - &lt;br /&gt;
*git revert &amp;lt;commitHash&amp;gt; - reverses a specific commit (use git log to get the chosen commit hash)&lt;br /&gt;
*git ..&lt;br /&gt;
&lt;br /&gt;
==Converting AREV programs to EXODUS==&lt;br /&gt;
===Decompile AREV to C++===&lt;br /&gt;
&lt;br /&gt;
Do in Master AREV Installation Maintenance mode: (win7)&lt;br /&gt;
&lt;br /&gt;
#ATTACH ADECOMC &lt;br /&gt;
#*ADECOM &amp;lt;programname&amp;gt;   *single program&lt;br /&gt;
#*ADECOM &amp;lt;prog1&amp;gt; &amp;lt;prog2&amp;gt; &lt;br /&gt;
#*ADECOMALL              *all programs   (CHECK FIRST)&lt;br /&gt;
&lt;br /&gt;
Include the option &amp;quot;(V)&amp;quot; in the command to print the C++ to a notepad, which can easily be copy and pasted.&lt;br /&gt;
&lt;br /&gt;
===Getting C++ program to Exodus Installation===&lt;br /&gt;
&lt;br /&gt;
Two methods: (use the first for one off programs)&lt;br /&gt;
&lt;br /&gt;
====Copy &amp;amp; Paste====&lt;br /&gt;
&lt;br /&gt;
Compile program and open source code in notepad&lt;br /&gt;
&lt;br /&gt;
 ADECOM &amp;lt;programname&amp;gt; (V)&lt;br /&gt;
&lt;br /&gt;
Find which directory the program belongs. e.g fin/med/job/sys e.t&lt;br /&gt;
&lt;br /&gt;
 find /cygdrive/d/exodus/pickos | grep &amp;lt;program name&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If cpp in SYS, the program belongs in ~/exodus/service/src OR if in MED JOB FIN GEN AGY the program belongs in ~/neosys/src&lt;br /&gt;
&lt;br /&gt;
Copy the source code in the text file from the first command.&lt;br /&gt;
&lt;br /&gt;
In Exodus, create a new .cpp (in correct directory) and paste the source code.&lt;br /&gt;
&lt;br /&gt;
Compile &amp;amp; Test&lt;br /&gt;
&lt;br /&gt;
====Rsync====&lt;br /&gt;
&lt;br /&gt;
 /d/exodus/arev/syncup.sh&lt;br /&gt;
&lt;br /&gt;
If cpp in SYS then: ~/exodus/service/src ./getpickos&lt;br /&gt;
&lt;br /&gt;
If cpp in MED JOB FIN GEN AGY then: *~/neosys/src&lt;br /&gt;
&lt;br /&gt;
===Compile C++ files to TEST system===&lt;br /&gt;
&lt;br /&gt;
#*./test &amp;lt;DBNAME&amp;gt;&lt;br /&gt;
#*~/neosys ./doall TEST &amp;lt;DBNAME&amp;gt; restart    #to get one service to start start using the new lib files&lt;br /&gt;
#*~/neosys ./doall TEST all restart         #to get all the services to start start using the new lib files&lt;br /&gt;
&lt;br /&gt;
===Install C++ files to LIVE System===&lt;br /&gt;
&lt;br /&gt;
#~/exodus/service/ ./copyall            #to copy all the ~/lib and bin files to ~/live/lib and bin ... which is used by all exodus/live services&lt;br /&gt;
&lt;br /&gt;
==Writing Standard Exodus Core Function/Method Testing==&lt;br /&gt;
Screen 9: ~/exodus/test/src/&lt;br /&gt;
There are a series of test programs that check whether methods/functions behave as intended.&lt;br /&gt;
They do this using the function, assert.. a 1 or more argument values produce one and only one output)&lt;br /&gt;
&lt;br /&gt;
e.g test_multilang.cpp or test_sort.cpp&lt;br /&gt;
&lt;br /&gt;
Two methods of running test programs:&lt;br /&gt;
*Screen 9: make test&lt;br /&gt;
*after compiling using edic/compile/c, enter test_prog_name. (Since compile has moved it to ~/bin)&lt;br /&gt;
&lt;br /&gt;
Difference between the two methods is make calls gdb directly;&lt;br /&gt;
whereas ~/bin/test_prog_name uses exodus compile program&lt;br /&gt;
#~/neosys ./doall LIVE all restart&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Upgrading Exodus==&lt;br /&gt;
&lt;br /&gt;
#Develop patch in Dev system &lt;br /&gt;
&lt;br /&gt;
===Patching neosys/src or exodus/service/src===&lt;br /&gt;
&lt;br /&gt;
#Manually insert patches and compile into test programs.&lt;br /&gt;
#If patch dat files then run neosys/compall to get dat files into ~/dat&lt;br /&gt;
*If Patsalides:&lt;br /&gt;
*#SITE_DIR=ptcy ./test basic &lt;br /&gt;
*#login to BASIC_TEST and test&lt;br /&gt;
*Other clients:&lt;br /&gt;
*#./test DBCODE&lt;br /&gt;
*#login to DBCODE and test patches works&lt;br /&gt;
#run exodus/service/copyall and check only the patched programs are listed. (if not, see Troubleshoot below)&lt;br /&gt;
#Inform users to log off for 10mins. As a rule of thumb, live services must be stopped before copying test programs to live.&lt;br /&gt;
#exodus/service/copyall CONFIRM&lt;br /&gt;
&lt;br /&gt;
====Troubleshoot====&lt;br /&gt;
&lt;br /&gt;
=====./copyall lists programs you have not patched=====&lt;br /&gt;
Use exodus/service/copyone to copy only your patched programs one by one. (./copyone will not copy dat files)&lt;br /&gt;
&lt;br /&gt;
===Upgrading to new version===&lt;br /&gt;
&lt;br /&gt;
Use when there are too many changes to do individually patches.&lt;br /&gt;
&lt;br /&gt;
#Inform clients.&lt;br /&gt;
#*Client hosted - Schedule a planned upgrade with client.&lt;br /&gt;
#*NEOSYS hosted - Inform all clients/users of planned morning upgrade, 24hours in advanced.      (TODO: &#039;What&#039;s New in NEOSYS&#039;) AND (emailallusers.cpp)&lt;br /&gt;
#If the morning&#039;s USB backup failed, do NOT continue upgrade procedure because if upgrade fails, we need a way to roll back system to last working state.&lt;br /&gt;
#Check upgrade works on test service using:/root/neosys/upgrade.all.sh test&lt;br /&gt;
#Check the latest patch is working.&lt;br /&gt;
#Run/root/neosys/upgrade.all.sh live&lt;br /&gt;
#Inform users their system has been upgraded and they can login.&lt;br /&gt;
&lt;br /&gt;
===Roll Back Upgrade===&lt;br /&gt;
&lt;br /&gt;
If for any reason the entire upgrade needs to be reverted (excludes clients database), follow steps below:&lt;br /&gt;
&lt;br /&gt;
#Inform users that there is a problem and services need to be stopped.&lt;br /&gt;
#Stop all exodus processes.&lt;br /&gt;
#Restore the morning&#039;s USB backup by: (Note this backup contains:  source/obj code, /etc, neosys scripts but not client data)&lt;br /&gt;
##Login into container&#039;s host and rsync the morning&#039;s usb backup to the container&#039;s /:&lt;br /&gt;
#*&amp;lt;pre&amp;gt;rsync --dry-run -avz -e &#039;ssh -p &amp;lt;C_SSHPORT&amp;gt;&#039; /backups/usb/&amp;lt;C_CODE&amp;gt; &amp;lt;C_CODE&amp;gt;:/      (Example: rsync --dry-run -avz -e &#039;ssh -p 19582&#039; /backups/usb/ad1 ad1:/&amp;lt;/pre&amp;gt;)&lt;br /&gt;
#Quick sane check, the latest git commit is not the latest git commit in the remote repo.&lt;br /&gt;
#Inform users they can login.&lt;br /&gt;
&lt;br /&gt;
==Configuring services to autostart during login==&lt;br /&gt;
For Ptcy.&lt;br /&gt;
&lt;br /&gt;
#Create a file &#039;autostart.cfg&#039; in the data folder &lt;br /&gt;
&lt;br /&gt;
 touch /root/hosts/&amp;lt;dbname&amp;gt;/data/autostart.cfg&lt;br /&gt;
&lt;br /&gt;
This will autostart a database service as long as at least one database service in that directory is running.&lt;br /&gt;
&lt;br /&gt;
For example, demo service will autostart during login if,&lt;br /&gt;
#/root/hosts/demo/data/autostart.cfg exists and&lt;br /&gt;
#demo_test service is running&lt;br /&gt;
&lt;br /&gt;
==Speedup postgresql importing databases==&lt;br /&gt;
&lt;br /&gt;
Can be sped up by a factor of 10 BUT may result in corrupt files in case of hard OS crash where the dirty memory is not flushed to storage.&lt;br /&gt;
&lt;br /&gt;
Therefore it is advisable to use this feature only briefly and REMEMBER TO REMOVE IT! &lt;br /&gt;
&lt;br /&gt;
Email to support@neosys.com whenever using it or use personal notes not memory.&lt;br /&gt;
&lt;br /&gt;
nano /etc/postgresql/12/main/postgresql.conf&lt;br /&gt;
&lt;br /&gt;
Uncomment or add a line&lt;br /&gt;
 fsync = off&lt;br /&gt;
Restart postgres … will break any neosys/exodus running processes.&lt;br /&gt;
 r postgresql&lt;br /&gt;
or reload postgres may also work&lt;br /&gt;
&lt;br /&gt;
==Database Attach==&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
root@exodus:~/exodus/cli/src# dbattach&lt;br /&gt;
dbattach - Attach foreign database files to the current default database&lt;br /&gt;
&lt;br /&gt;
Syntax is dbattach TARGETDB [FILENAME,...] {OPTION...}&lt;br /&gt;
&lt;br /&gt;
Options:&lt;br /&gt;
&lt;br /&gt;
  F   Forcibly delete any normal files in the current default database.&lt;br /&gt;
&lt;br /&gt;
  R   Detach foreign files&lt;br /&gt;
  RR  Remove foreign database connection.&lt;br /&gt;
  RRR Remove all foreign database connections and attachments.&lt;br /&gt;
&lt;br /&gt;
  L   List attached foreign files in the current default database&lt;br /&gt;
&lt;br /&gt;
If no filenames are provided then a database connection is created.&lt;br /&gt;
This is *required* before filenames can be provided and attached.&lt;br /&gt;
&lt;br /&gt;
Notes:&lt;br /&gt;
&lt;br /&gt;
Attachments are permanent until re-attached or removed.&lt;br /&gt;
&lt;br /&gt;
Indexes on attached files behave strangely.&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Issues:&lt;br /&gt;
&lt;br /&gt;
TARGETDB must be on the same connection as the current default database.&lt;br /&gt;
&lt;br /&gt;
Current user must have access to the foreign database.&lt;br /&gt;
&lt;br /&gt;
If EXO_USER and EXO_PASS are not set then exodus defaults are used.&lt;br /&gt;
&lt;br /&gt;
exodus .config file is not used currently.&lt;/div&gt;</summary>
		<author><name>Gregory</name></author>
	</entry>
	<entry>
		<id>https://techwiki.neosys.com/index.php?title=EXODUS_Knowledge&amp;diff=3979</id>
		<title>EXODUS Knowledge</title>
		<link rel="alternate" type="text/html" href="https://techwiki.neosys.com/index.php?title=EXODUS_Knowledge&amp;diff=3979"/>
		<updated>2022-06-02T07:06:27Z</updated>

		<summary type="html">&lt;p&gt;Gregory: /* =Troubleshoot */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==TMUX Screens==&lt;br /&gt;
&lt;br /&gt;
To create the EXODUS maintenance/programming environment&lt;br /&gt;
 exodus#: ./tmux.exodus&lt;br /&gt;
&lt;br /&gt;
===Screens===&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
0: /&lt;br /&gt;
    Work regarding exodus server. i.e /etc/nagios or general networking or /var/log/mail.log&lt;br /&gt;
&lt;br /&gt;
1: /root/exodus/&lt;br /&gt;
    Exodus core is installed Contains build and make libraries here ./libexodus&lt;br /&gt;
&lt;br /&gt;
2: /root/exodus/libexodus/exodus&lt;br /&gt;
    Core exodus (libraries that emulate the AREV system e.g mv.h )&lt;br /&gt;
    &lt;br /&gt;
3: /root/exodus/cli/src&lt;br /&gt;
    Exodus Command Line Interface e.g edir, edic, list, listfiles, delete, createdb&lt;br /&gt;
    &lt;br /&gt;
4: root/exodus/service&lt;br /&gt;
    EXODUS core default host directory but also contains scripts that create/manage requirements of a service (create_service, create_db, create_site, backup_db, restore_db, start, stop, status)&lt;br /&gt;
    One exception is NEOSYS www files are in ./www, which pulled from NEOSYS www git.&lt;br /&gt;
&lt;br /&gt;
5: /root/exodus/service/src&lt;br /&gt;
    Exodus core service programs (programs that are not related to NEOSYS agency operations and can be used to support other non-NEOSYS services) eg listen, usersubs, sendmail, openfile, select, sort, list,.&lt;br /&gt;
&lt;br /&gt;
    Extra info:    &lt;br /&gt;
    sql directory contains basic dictiorary files converted to sql instructions used when creating a EXODUS psql database&lt;br /&gt;
    e.g dict_voc.sql is a file that describes what to expect in certain fields of the voc file.&lt;br /&gt;
    TODO: compall currently throws few warnings. Read them and familiarise. In case new warnings appear, notify Steve.    &lt;br /&gt;
        &lt;br /&gt;
6: /root/neosys&lt;br /&gt;
    NEOSYS specific client installation management scripts e.g .doall, import_db and import_files (from AREV), ./run ./test (see below for these two commands)&lt;br /&gt;
    &lt;br /&gt;
7: /root/neosys/src&lt;br /&gt;
    NEOSYS Agency programs (see section How AREV programs are distributed in EXODUS src/*.cpp&lt;br /&gt;
    ../ has .git&lt;br /&gt;
&lt;br /&gt;
8: /root/hosts&lt;br /&gt;
    client specific files  e.g logs, images, (shared ./www -&amp;gt; root/exodus/service/www&lt;br /&gt;
&lt;br /&gt;
9: /root/exodus/test/src&lt;br /&gt;
    series of programs that test whether subroutines (specifically Exodus core libraries) work as they should eg for the var lib - &amp;quot;assert( var(&amp;quot;11111&amp;quot;).isnum());&amp;quot;&lt;br /&gt;
&lt;br /&gt;
10: bash /bin/top&lt;br /&gt;
    Monitor for NEOSYS client processes&lt;br /&gt;
    Displays customised format: sorted by total time spend and by processor time.&lt;br /&gt;
     Press &amp;quot;=&amp;quot; : to change to standard top format&lt;br /&gt;
     Press shift + w : to save format settings, replacing the old customised top format&lt;br /&gt;
     To go back to the customised format do:&lt;br /&gt;
        Press &amp;quot;o&amp;quot;&lt;br /&gt;
        Type &amp;quot;COMMAND=serve_agy&amp;quot;&lt;br /&gt;
        shift + t : this sorts by total time spent&lt;br /&gt;
        shift + p : this sorts by processor time&lt;br /&gt;
        shift + w : to save this setting and enter  &#039;y&#039; to confirm&lt;br /&gt;
&lt;br /&gt;
11: /var/log/syslog&lt;br /&gt;
     Log of NEOSYS client requests&lt;br /&gt;
&lt;br /&gt;
12: /root/exodus/service/quick&lt;br /&gt;
     Displays the last time the svr file (in /root/hosts/&amp;lt;client&amp;gt;/data/&amp;lt;dbname&amp;gt;) was updated.&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Object Code/Libraries==&lt;br /&gt;
LIVE and TEST processes use different sets of object code.&lt;br /&gt;
TEST processes use libraries in ~/lib/, whereas LIVE processes use object code in ~/neo/lib&lt;br /&gt;
&lt;br /&gt;
This means development &amp;amp; testing can be done stress free on TEST database, as opposed to testing on production databases.&lt;br /&gt;
&lt;br /&gt;
When compiling using edic, the TEST object code is updated if the compilation is successful. (~/lib)&lt;br /&gt;
In order to apply a tested patch to LIVE see [[Update LIVE programs]].&lt;br /&gt;
&lt;br /&gt;
==Dictionaries &amp;amp; Psql Functions==&lt;br /&gt;
&lt;br /&gt;
Dictionaries, data used to describe other data; specifically the fields of other files. &lt;br /&gt;
&lt;br /&gt;
There are three types of fields: &amp;lt;pre&amp;gt;&lt;br /&gt;
(F) field for raw data E.g &amp;quot;Office 44 Building Rush&amp;quot;&lt;br /&gt;
(S) symbolic or calculated E.g for total ans=field1+field2&lt;br /&gt;
(G) General, pending &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Show dictionary using &amp;quot;EXO_DATA=test list dict.clients&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
===Development and deployment using &#039;dat&#039; files===&lt;br /&gt;
&lt;br /&gt;
====Rationale====&lt;br /&gt;
&lt;br /&gt;
Part of system development is the creation of various data that is neither programs nor layout i.e. not cpp, h, html, js, php files etc.&lt;br /&gt;
&lt;br /&gt;
For example:&lt;br /&gt;
&lt;br /&gt;
*Dictionaries are data about data.&lt;br /&gt;
*Language files are data about text to use for various languages.&lt;br /&gt;
*“Change logs” are data about changes in the system.&lt;br /&gt;
&lt;br /&gt;
Historically, in EXODUS and NEOSYS, the above data has been deployed in exodus database files using SQL text files. However SQL files are not convenient for development.&lt;br /&gt;
&lt;br /&gt;
Therefore, &#039;dat&#039; text files will be used now so that standard development tools including editors and git can be fully exploited.&lt;br /&gt;
&lt;br /&gt;
====&#039;dat&#039; files====&lt;br /&gt;
&lt;br /&gt;
Each database file is represented by an os directory of the same name.&lt;br /&gt;
&lt;br /&gt;
Each record in the database file is represented by an os text file where filename is the primary key.&lt;br /&gt;
&lt;br /&gt;
For example a record with key &#039;&#039;&#039;DEADLINE&#039;&#039;&#039; in a dat file &#039;&#039;&#039;dict.materials&#039;&#039;&#039; would be represented as an os text file &#039;&#039;&#039;dat/dict.materials/DEADLINE&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Each line in the os text file represents one field in the db record. In other words, db record FM characters are represented by new line characters in &#039;dat&#039; files. Any actual new line characters required in the record, and any backslashes, are escaped and appear as &#039;\n&#039; and &#039;\\&#039; in &#039;dat&#039; files. Other database field separator characters such as VM, SM, TM and STM are stored without any conversion.&lt;br /&gt;
&lt;br /&gt;
====Location of dat files====&lt;br /&gt;
&lt;br /&gt;
The development versions are stored in exodus and neosys src/dat dirs. They form part of the standard git repositories in parallel with cpp files.&lt;br /&gt;
&lt;br /&gt;
The operational versions are stored in ~/dat and ~/live/dat alongside bin and lib dirs and are automatically installed into databases as database files on service startup. Any database functions embedded in the text files (pgsql) are also automatically installed at the same time.&lt;br /&gt;
&lt;br /&gt;
====Editing and deploying a &#039;dat&#039; file====&lt;br /&gt;
&lt;br /&gt;
It is currently a three step process to edit and deploy such &#039;dat&#039; files. &lt;br /&gt;
&lt;br /&gt;
=====Edit the &#039;dat&#039; file=====&lt;br /&gt;
&lt;br /&gt;
Note that EXODUS service and NEOSYS service have different src/dat folders.&lt;br /&gt;
&lt;br /&gt;
Editing language items:&lt;br /&gt;
&lt;br /&gt;
 edir dat/alanguage/SCHEDULES*ARABIC&lt;br /&gt;
&lt;br /&gt;
Editing a dictionary item:&lt;br /&gt;
&lt;br /&gt;
 edir dat/dict.materials/DEADLINE&lt;br /&gt;
&lt;br /&gt;
Editing a pgsql function in a dictionary:&lt;br /&gt;
&lt;br /&gt;
 edir dat/dict.materials/DEADLINE 8&lt;br /&gt;
&lt;br /&gt;
=====Copy all &#039;dat&#039; files to ~/dat =====&lt;br /&gt;
&lt;br /&gt;
This step might be removed at a later date.&lt;br /&gt;
&lt;br /&gt;
This will cause all test databases to immediately restart and load any &#039;dat&#039; file changes into dictionaries and data files and also create any new or modified pgsql functions.&lt;br /&gt;
&lt;br /&gt;
If any ~/neosys/src/dat files were edited:&lt;br /&gt;
&lt;br /&gt;
 cd ~/neosys/src&lt;br /&gt;
 &lt;br /&gt;
 ./compall dat&lt;br /&gt;
&lt;br /&gt;
and/or, if exodus/service/dat files were edited&lt;br /&gt;
&lt;br /&gt;
 cd ~/exodus/service/src&lt;br /&gt;
 &lt;br /&gt;
 ./compall dat&lt;br /&gt;
&lt;br /&gt;
=====Copy all programs and &#039;dat&#039; files to ~/live/bin|lib|dat=====&lt;br /&gt;
&lt;br /&gt;
This should only be run after testing. It will cause all live databases to automatically restart and do the same as the test databases mentioned above.&lt;br /&gt;
&lt;br /&gt;
 cd ~/exodus/service&lt;br /&gt;
 &lt;br /&gt;
 ./copyall CONFIRM&lt;br /&gt;
​&lt;br /&gt;
&lt;br /&gt;
===Psql unaccent extension===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The unaccent extension and the immutable_unaccent function are created in the db ‘template1’ during exodus installation while user is postgres which is a superuser.&lt;br /&gt;
&lt;br /&gt;
Thereafter all new databases are created as copies of template1 so they contain the extension and function&lt;br /&gt;
&lt;br /&gt;
====Error====&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
MVDBException:ERROR: function immutable_unaccent(text) does not exist&lt;br /&gt;
ERROR:  permission denied to create extension &amp;quot;unaccent&amp;quot;&lt;br /&gt;
HINT:  Must be superuser to create this extension. &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====Solution====&lt;br /&gt;
sudo -u postgres psql -c &#039;ALTER USER exodus WITH SUPERUSER;&#039;&lt;br /&gt;
&lt;br /&gt;
==Processes==&lt;br /&gt;
The TEST process for all database use the same object code stored in /root/lib, whereas all LIVE process use the object code in /root/neo/.&lt;br /&gt;
&lt;br /&gt;
==Postgres==&lt;br /&gt;
Connect into postgres shell:&lt;br /&gt;
 alias psql=&#039;sudo -u postgres psql&#039;&lt;br /&gt;
&lt;br /&gt;
Delete a database:&lt;br /&gt;
 sudo -u postgres dropdb &amp;lt;dbcode&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Debugging Exodus==&lt;br /&gt;
&lt;br /&gt;
===Debugging Live/Test services===&lt;br /&gt;
&lt;br /&gt;
./test &amp;lt;dbname&amp;gt; - execute test programs on _test database.&lt;br /&gt;
&lt;br /&gt;
./run &amp;lt;dbname&amp;gt;  - execute test programs on live database.&lt;br /&gt;
&lt;br /&gt;
===Debugging var values===&lt;br /&gt;
&lt;br /&gt;
Explanation of var flag value in gdb debug mode.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
(gdb) p varx                                                           &lt;br /&gt;
$2 = {var_str = &amp;quot;&amp;quot;, var_int = 0, var_dbl = 0, var_typ = {flags_ = 2}}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Each exodus var object contains 3 variables of type string, int and double.&lt;br /&gt;
&lt;br /&gt;
All 3 may be unassigned or only the string be assigned or just the int and double e.t.&lt;br /&gt;
&lt;br /&gt;
You can tell which variable type of a var object are set based on the var&#039;s flag value.&lt;br /&gt;
&lt;br /&gt;
1 = Means the string is assigned&lt;br /&gt;
2 = Means the int is assigned&lt;br /&gt;
4 = Means the double is assigned&lt;br /&gt;
&lt;br /&gt;
Example: If the flag is 7 (1+2+4), then all types are assigned.&lt;br /&gt;
&lt;br /&gt;
===Process Hung or consuming +100% CPU===&lt;br /&gt;
If process is consuming +100% CPU then it is likely stuck in an infinite loop.&lt;br /&gt;
&lt;br /&gt;
 ./doall &amp;lt;CLIENT&amp;gt; stop&lt;br /&gt;
&lt;br /&gt;
 ./run &amp;lt;CLIENT&amp;gt; &lt;br /&gt;
&lt;br /&gt;
 ./test &amp;lt;CLIENT&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Search through recent logs for &amp;lt;CLIENT&amp;gt; looking for requests that didn&#039;t return OK at the time nagios alerted of Hung process.&lt;br /&gt;
&lt;br /&gt;
A user may also instigate the error again, so monitor the CLIENT&#039;s service CPU usage.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
If cause found recreate it in test and once test process hit +100% break in test debugger.&lt;br /&gt;
&lt;br /&gt;
If cause not found, you will have to continue checking logs for the request that caused it or hope a user recreates the issue in live debugged service.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Once you&#039;ve broken in the debugged with the error, enter &amp;quot;n&amp;quot; and hold the enter key until you just seeing line repeat.&lt;br /&gt;
&lt;br /&gt;
Pay attention to start of loops code. E.g WHILE or FOR. (there is likely an error is there)&lt;br /&gt;
&lt;br /&gt;
==./doall==&lt;br /&gt;
====General====&lt;br /&gt;
&lt;br /&gt;
~/neosys/doall [LIVE|TEST] &amp;lt;DBCODE|ALL&amp;gt; &amp;lt; ACTION [OPTIONS,..]  | bash -- COMMAND ]&lt;br /&gt;
&lt;br /&gt;
Example: &lt;br /&gt;
 ./doall TEST ALL create_site t-&lt;br /&gt;
Result:&lt;br /&gt;
Create site for ALL TEST databases, using domain name prefix option &amp;quot;t-&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Screen 6: ./doall script contains all the necessary information(codes) to setup an installation.&lt;br /&gt;
It includes scripts to backup, restore, create an Apache site, create/start/stop/status a service, import an AREV database into postgres and more.&lt;br /&gt;
&lt;br /&gt;
====backup_db====&lt;br /&gt;
&lt;br /&gt;
*Does a backup &amp;amp; restore of a LIVE database into the corresponding TEST database.&lt;br /&gt;
*Backup &amp;lt;dbcode&amp;gt;.sql file is written to /root/backups/sql; which is rsynced to nl19:/backups/current/exodus/&lt;br /&gt;
*Unlike AREV, postgres can perform a &amp;quot;backup&amp;quot; of a database whilst the system is in use.&lt;br /&gt;
&lt;br /&gt;
==Git==&lt;br /&gt;
&lt;br /&gt;
There are two repositories, one for EXODUS and the other for NEOSYS.&lt;br /&gt;
&lt;br /&gt;
===Using git to make changes===&lt;br /&gt;
&lt;br /&gt;
Before following steps you must have a tested updated to a program/file/script. Do not commit untested changes to avoid a messy git history of reverts.&lt;br /&gt;
&lt;br /&gt;
Update your local repo before committing to local repo using the g alias for &amp;quot;git pull --ff-only ; git push &amp;amp;&amp;amp; git status&#039;&amp;quot;:&lt;br /&gt;
&amp;lt;pre&amp;gt;g&amp;lt;/pre&amp;gt;&lt;br /&gt;
Check which updates/files have not yet been staged and/or committed:&lt;br /&gt;
Add your updates to the staged area:&lt;br /&gt;
&amp;lt;pre&amp;gt;git add &amp;lt;filename&amp;gt;&amp;lt;/pre&amp;gt;&lt;br /&gt;
or if all the changes made need to be staged:&lt;br /&gt;
&amp;lt;pre&amp;gt;git add -a&amp;lt;/pre&amp;gt;&lt;br /&gt;
Make a commit with a descriptive message on purpose of updates:&lt;br /&gt;
&amp;lt;pre&amp;gt;git commit -m &amp;lt;description n purpose of changes&amp;gt;&amp;lt;/pre&amp;gt;&lt;br /&gt;
Again use g alias:&lt;br /&gt;
&amp;lt;pre&amp;gt;g&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Other useful git cmds===&lt;br /&gt;
&lt;br /&gt;
Do not use this commands unless you know what WILL happen. &lt;br /&gt;
*git pull - Instead use the safe &amp;quot;git pull --ff-only&amp;quot;&lt;br /&gt;
Stick to the alias &amp;quot;g&amp;quot; which does &amp;quot;git pull --ff-only ; git push &amp;amp;&amp;amp; git status&#039;&amp;quot;&lt;br /&gt;
&lt;br /&gt;
*git log - display history of commits to master branch&lt;br /&gt;
*git diff - display the differences in files between working files and files in local repo.&lt;br /&gt;
*git status - display: which updated files are staged/not staged(tracked)&lt;br /&gt;
*git stash - &lt;br /&gt;
*git branch - switch to a new branch&lt;br /&gt;
*git branch &amp;lt;branchname&amp;gt; - will switch to this branch only if it exists&lt;br /&gt;
*git checkout - DESTROYS/Updates the state of local working directory with the state of the files in the local repo. (YOU WILL LOSE non staged updates)&lt;br /&gt;
*git restore &amp;lt;filename&amp;gt; - DESTROYS/Updates the file with the version in the local repo. (like with git checkout but for a specific file)&lt;br /&gt;
*git checkin - &lt;br /&gt;
*git revert &amp;lt;commitHash&amp;gt; - reverses a specific commit (use git log to get the chosen commit hash)&lt;br /&gt;
*git ..&lt;br /&gt;
&lt;br /&gt;
==Converting AREV programs to EXODUS==&lt;br /&gt;
===Decompile AREV to C++===&lt;br /&gt;
&lt;br /&gt;
Do in Master AREV Installation Maintenance mode: (win7)&lt;br /&gt;
&lt;br /&gt;
#ATTACH ADECOMC &lt;br /&gt;
#*ADECOM &amp;lt;programname&amp;gt;   *single program&lt;br /&gt;
#*ADECOM &amp;lt;prog1&amp;gt; &amp;lt;prog2&amp;gt; &lt;br /&gt;
#*ADECOMALL              *all programs   (CHECK FIRST)&lt;br /&gt;
&lt;br /&gt;
Include the option &amp;quot;(V)&amp;quot; in the command to print the C++ to a notepad, which can easily be copy and pasted.&lt;br /&gt;
&lt;br /&gt;
===Getting C++ program to Exodus Installation===&lt;br /&gt;
&lt;br /&gt;
Two methods: (use the first for one off programs)&lt;br /&gt;
&lt;br /&gt;
====Copy &amp;amp; Paste====&lt;br /&gt;
&lt;br /&gt;
Compile program and open source code in notepad&lt;br /&gt;
&lt;br /&gt;
 ADECOM &amp;lt;programname&amp;gt; (V)&lt;br /&gt;
&lt;br /&gt;
Find which directory the program belongs. e.g fin/med/job/sys e.t&lt;br /&gt;
&lt;br /&gt;
 find /cygdrive/d/exodus/pickos | grep &amp;lt;program name&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If cpp in SYS, the program belongs in ~/exodus/service/src OR if in MED JOB FIN GEN AGY the program belongs in ~/neosys/src&lt;br /&gt;
&lt;br /&gt;
Copy the source code in the text file from the first command.&lt;br /&gt;
&lt;br /&gt;
In Exodus, create a new .cpp (in correct directory) and paste the source code.&lt;br /&gt;
&lt;br /&gt;
Compile &amp;amp; Test&lt;br /&gt;
&lt;br /&gt;
====Rsync====&lt;br /&gt;
&lt;br /&gt;
 /d/exodus/arev/syncup.sh&lt;br /&gt;
&lt;br /&gt;
If cpp in SYS then: ~/exodus/service/src ./getpickos&lt;br /&gt;
&lt;br /&gt;
If cpp in MED JOB FIN GEN AGY then: *~/neosys/src&lt;br /&gt;
&lt;br /&gt;
===Compile C++ files to TEST system===&lt;br /&gt;
&lt;br /&gt;
#*./test &amp;lt;DBNAME&amp;gt;&lt;br /&gt;
#*~/neosys ./doall TEST &amp;lt;DBNAME&amp;gt; restart    #to get one service to start start using the new lib files&lt;br /&gt;
#*~/neosys ./doall TEST all restart         #to get all the services to start start using the new lib files&lt;br /&gt;
&lt;br /&gt;
===Install C++ files to LIVE System===&lt;br /&gt;
&lt;br /&gt;
#~/exodus/service/ ./copyall            #to copy all the ~/lib and bin files to ~/live/lib and bin ... which is used by all exodus/live services&lt;br /&gt;
&lt;br /&gt;
==Writing Standard Exodus Core Function/Method Testing==&lt;br /&gt;
Screen 9: ~/exodus/test/src/&lt;br /&gt;
There are a series of test programs that check whether methods/functions behave as intended.&lt;br /&gt;
They do this using the function, assert.. a 1 or more argument values produce one and only one output)&lt;br /&gt;
&lt;br /&gt;
e.g test_multilang.cpp or test_sort.cpp&lt;br /&gt;
&lt;br /&gt;
Two methods of running test programs:&lt;br /&gt;
*Screen 9: make test&lt;br /&gt;
*after compiling using edic/compile/c, enter test_prog_name. (Since compile has moved it to ~/bin)&lt;br /&gt;
&lt;br /&gt;
Difference between the two methods is make calls gdb directly;&lt;br /&gt;
whereas ~/bin/test_prog_name uses exodus compile program&lt;br /&gt;
#~/neosys ./doall LIVE all restart&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Upgrading Exodus==&lt;br /&gt;
&lt;br /&gt;
#Develop patch in Dev system &lt;br /&gt;
&lt;br /&gt;
===Patching neosys/src or exodus/service/src===&lt;br /&gt;
&lt;br /&gt;
#Manually insert patches and compile into test programs.&lt;br /&gt;
#If patch dat files then run neosys/compall to get dat files into ~/dat&lt;br /&gt;
*If Patsalides:&lt;br /&gt;
*#SITE_DIR=ptcy ./test basic &lt;br /&gt;
*#login to BASIC_TEST and test&lt;br /&gt;
*Other clients:&lt;br /&gt;
*#./test DBCODE&lt;br /&gt;
*#login to DBCODE and test patches works&lt;br /&gt;
#run exodus/service/copyall and check only the patched programs are listed. (if not, see Troubleshoot below)&lt;br /&gt;
#Inform users to log off for 10mins. As a rule of thumb, live services must be stopped before copying test programs to live.&lt;br /&gt;
#exodus/service/copyall CONFIRM&lt;br /&gt;
&lt;br /&gt;
====Troubleshoot====&lt;br /&gt;
&lt;br /&gt;
=====./copyall lists programs you have not patched===&lt;br /&gt;
Use exodus/service/copyone to copy only your patched programs one by one. (./copyone will not copy dat files)&lt;br /&gt;
&lt;br /&gt;
===Upgrading to new version===&lt;br /&gt;
&lt;br /&gt;
Use when there are too many changes to do individually patches.&lt;br /&gt;
&lt;br /&gt;
#Inform clients.&lt;br /&gt;
#*Client hosted - Schedule a planned upgrade with client.&lt;br /&gt;
#*NEOSYS hosted - Inform all clients/users of planned morning upgrade, 24hours in advanced.      (TODO: &#039;What&#039;s New in NEOSYS&#039;) AND (emailallusers.cpp)&lt;br /&gt;
#If the morning&#039;s USB backup failed, do NOT continue upgrade procedure because if upgrade fails, we need a way to roll back system to last working state.&lt;br /&gt;
#Check upgrade works on test service using:/root/neosys/upgrade.all.sh test&lt;br /&gt;
#Check the latest patch is working.&lt;br /&gt;
#Run/root/neosys/upgrade.all.sh live&lt;br /&gt;
#Inform users their system has been upgraded and they can login.&lt;br /&gt;
&lt;br /&gt;
===Roll Back Upgrade===&lt;br /&gt;
&lt;br /&gt;
If for any reason the entire upgrade needs to be reverted (excludes clients database), follow steps below:&lt;br /&gt;
&lt;br /&gt;
#Inform users that there is a problem and services need to be stopped.&lt;br /&gt;
#Stop all exodus processes.&lt;br /&gt;
#Restore the morning&#039;s USB backup by: (Note this backup contains:  source/obj code, /etc, neosys scripts but not client data)&lt;br /&gt;
##Login into container&#039;s host and rsync the morning&#039;s usb backup to the container&#039;s /:&lt;br /&gt;
#*&amp;lt;pre&amp;gt;rsync --dry-run -avz -e &#039;ssh -p &amp;lt;C_SSHPORT&amp;gt;&#039; /backups/usb/&amp;lt;C_CODE&amp;gt; &amp;lt;C_CODE&amp;gt;:/      (Example: rsync --dry-run -avz -e &#039;ssh -p 19582&#039; /backups/usb/ad1 ad1:/&amp;lt;/pre&amp;gt;)&lt;br /&gt;
#Quick sane check, the latest git commit is not the latest git commit in the remote repo.&lt;br /&gt;
#Inform users they can login.&lt;br /&gt;
&lt;br /&gt;
==Configuring services to autostart during login==&lt;br /&gt;
For Ptcy.&lt;br /&gt;
&lt;br /&gt;
#Create a file &#039;autostart.cfg&#039; in the data folder &lt;br /&gt;
&lt;br /&gt;
 touch /root/hosts/&amp;lt;dbname&amp;gt;/data/autostart.cfg&lt;br /&gt;
&lt;br /&gt;
This will autostart a database service as long as at least one database service in that directory is running.&lt;br /&gt;
&lt;br /&gt;
For example, demo service will autostart during login if,&lt;br /&gt;
#/root/hosts/demo/data/autostart.cfg exists and&lt;br /&gt;
#demo_test service is running&lt;br /&gt;
&lt;br /&gt;
==Speedup postgresql importing databases==&lt;br /&gt;
&lt;br /&gt;
Can be sped up by a factor of 10 BUT may result in corrupt files in case of hard OS crash where the dirty memory is not flushed to storage.&lt;br /&gt;
&lt;br /&gt;
Therefore it is advisable to use this feature only briefly and REMEMBER TO REMOVE IT! &lt;br /&gt;
&lt;br /&gt;
Email to support@neosys.com whenever using it or use personal notes not memory.&lt;br /&gt;
&lt;br /&gt;
nano /etc/postgresql/12/main/postgresql.conf&lt;br /&gt;
&lt;br /&gt;
Uncomment or add a line&lt;br /&gt;
 fsync = off&lt;br /&gt;
Restart postgres … will break any neosys/exodus running processes.&lt;br /&gt;
 r postgresql&lt;br /&gt;
or reload postgres may also work&lt;br /&gt;
&lt;br /&gt;
==Database Attach==&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
root@exodus:~/exodus/cli/src# dbattach&lt;br /&gt;
dbattach - Attach foreign database files to the current default database&lt;br /&gt;
&lt;br /&gt;
Syntax is dbattach TARGETDB [FILENAME,...] {OPTION...}&lt;br /&gt;
&lt;br /&gt;
Options:&lt;br /&gt;
&lt;br /&gt;
  F   Forcibly delete any normal files in the current default database.&lt;br /&gt;
&lt;br /&gt;
  R   Detach foreign files&lt;br /&gt;
  RR  Remove foreign database connection.&lt;br /&gt;
  RRR Remove all foreign database connections and attachments.&lt;br /&gt;
&lt;br /&gt;
  L   List attached foreign files in the current default database&lt;br /&gt;
&lt;br /&gt;
If no filenames are provided then a database connection is created.&lt;br /&gt;
This is *required* before filenames can be provided and attached.&lt;br /&gt;
&lt;br /&gt;
Notes:&lt;br /&gt;
&lt;br /&gt;
Attachments are permanent until re-attached or removed.&lt;br /&gt;
&lt;br /&gt;
Indexes on attached files behave strangely.&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Issues:&lt;br /&gt;
&lt;br /&gt;
TARGETDB must be on the same connection as the current default database.&lt;br /&gt;
&lt;br /&gt;
Current user must have access to the foreign database.&lt;br /&gt;
&lt;br /&gt;
If EXO_USER and EXO_PASS are not set then exodus defaults are used.&lt;br /&gt;
&lt;br /&gt;
exodus .config file is not used currently.&lt;/div&gt;</summary>
		<author><name>Gregory</name></author>
	</entry>
	<entry>
		<id>https://techwiki.neosys.com/index.php?title=EXODUS_Knowledge&amp;diff=3978</id>
		<title>EXODUS Knowledge</title>
		<link rel="alternate" type="text/html" href="https://techwiki.neosys.com/index.php?title=EXODUS_Knowledge&amp;diff=3978"/>
		<updated>2022-06-02T07:06:02Z</updated>

		<summary type="html">&lt;p&gt;Gregory: /* Single Patches */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==TMUX Screens==&lt;br /&gt;
&lt;br /&gt;
To create the EXODUS maintenance/programming environment&lt;br /&gt;
 exodus#: ./tmux.exodus&lt;br /&gt;
&lt;br /&gt;
===Screens===&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
0: /&lt;br /&gt;
    Work regarding exodus server. i.e /etc/nagios or general networking or /var/log/mail.log&lt;br /&gt;
&lt;br /&gt;
1: /root/exodus/&lt;br /&gt;
    Exodus core is installed Contains build and make libraries here ./libexodus&lt;br /&gt;
&lt;br /&gt;
2: /root/exodus/libexodus/exodus&lt;br /&gt;
    Core exodus (libraries that emulate the AREV system e.g mv.h )&lt;br /&gt;
    &lt;br /&gt;
3: /root/exodus/cli/src&lt;br /&gt;
    Exodus Command Line Interface e.g edir, edic, list, listfiles, delete, createdb&lt;br /&gt;
    &lt;br /&gt;
4: root/exodus/service&lt;br /&gt;
    EXODUS core default host directory but also contains scripts that create/manage requirements of a service (create_service, create_db, create_site, backup_db, restore_db, start, stop, status)&lt;br /&gt;
    One exception is NEOSYS www files are in ./www, which pulled from NEOSYS www git.&lt;br /&gt;
&lt;br /&gt;
5: /root/exodus/service/src&lt;br /&gt;
    Exodus core service programs (programs that are not related to NEOSYS agency operations and can be used to support other non-NEOSYS services) eg listen, usersubs, sendmail, openfile, select, sort, list,.&lt;br /&gt;
&lt;br /&gt;
    Extra info:    &lt;br /&gt;
    sql directory contains basic dictiorary files converted to sql instructions used when creating a EXODUS psql database&lt;br /&gt;
    e.g dict_voc.sql is a file that describes what to expect in certain fields of the voc file.&lt;br /&gt;
    TODO: compall currently throws few warnings. Read them and familiarise. In case new warnings appear, notify Steve.    &lt;br /&gt;
        &lt;br /&gt;
6: /root/neosys&lt;br /&gt;
    NEOSYS specific client installation management scripts e.g .doall, import_db and import_files (from AREV), ./run ./test (see below for these two commands)&lt;br /&gt;
    &lt;br /&gt;
7: /root/neosys/src&lt;br /&gt;
    NEOSYS Agency programs (see section How AREV programs are distributed in EXODUS src/*.cpp&lt;br /&gt;
    ../ has .git&lt;br /&gt;
&lt;br /&gt;
8: /root/hosts&lt;br /&gt;
    client specific files  e.g logs, images, (shared ./www -&amp;gt; root/exodus/service/www&lt;br /&gt;
&lt;br /&gt;
9: /root/exodus/test/src&lt;br /&gt;
    series of programs that test whether subroutines (specifically Exodus core libraries) work as they should eg for the var lib - &amp;quot;assert( var(&amp;quot;11111&amp;quot;).isnum());&amp;quot;&lt;br /&gt;
&lt;br /&gt;
10: bash /bin/top&lt;br /&gt;
    Monitor for NEOSYS client processes&lt;br /&gt;
    Displays customised format: sorted by total time spend and by processor time.&lt;br /&gt;
     Press &amp;quot;=&amp;quot; : to change to standard top format&lt;br /&gt;
     Press shift + w : to save format settings, replacing the old customised top format&lt;br /&gt;
     To go back to the customised format do:&lt;br /&gt;
        Press &amp;quot;o&amp;quot;&lt;br /&gt;
        Type &amp;quot;COMMAND=serve_agy&amp;quot;&lt;br /&gt;
        shift + t : this sorts by total time spent&lt;br /&gt;
        shift + p : this sorts by processor time&lt;br /&gt;
        shift + w : to save this setting and enter  &#039;y&#039; to confirm&lt;br /&gt;
&lt;br /&gt;
11: /var/log/syslog&lt;br /&gt;
     Log of NEOSYS client requests&lt;br /&gt;
&lt;br /&gt;
12: /root/exodus/service/quick&lt;br /&gt;
     Displays the last time the svr file (in /root/hosts/&amp;lt;client&amp;gt;/data/&amp;lt;dbname&amp;gt;) was updated.&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Object Code/Libraries==&lt;br /&gt;
LIVE and TEST processes use different sets of object code.&lt;br /&gt;
TEST processes use libraries in ~/lib/, whereas LIVE processes use object code in ~/neo/lib&lt;br /&gt;
&lt;br /&gt;
This means development &amp;amp; testing can be done stress free on TEST database, as opposed to testing on production databases.&lt;br /&gt;
&lt;br /&gt;
When compiling using edic, the TEST object code is updated if the compilation is successful. (~/lib)&lt;br /&gt;
In order to apply a tested patch to LIVE see [[Update LIVE programs]].&lt;br /&gt;
&lt;br /&gt;
==Dictionaries &amp;amp; Psql Functions==&lt;br /&gt;
&lt;br /&gt;
Dictionaries, data used to describe other data; specifically the fields of other files. &lt;br /&gt;
&lt;br /&gt;
There are three types of fields: &amp;lt;pre&amp;gt;&lt;br /&gt;
(F) field for raw data E.g &amp;quot;Office 44 Building Rush&amp;quot;&lt;br /&gt;
(S) symbolic or calculated E.g for total ans=field1+field2&lt;br /&gt;
(G) General, pending &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Show dictionary using &amp;quot;EXO_DATA=test list dict.clients&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
===Development and deployment using &#039;dat&#039; files===&lt;br /&gt;
&lt;br /&gt;
====Rationale====&lt;br /&gt;
&lt;br /&gt;
Part of system development is the creation of various data that is neither programs nor layout i.e. not cpp, h, html, js, php files etc.&lt;br /&gt;
&lt;br /&gt;
For example:&lt;br /&gt;
&lt;br /&gt;
*Dictionaries are data about data.&lt;br /&gt;
*Language files are data about text to use for various languages.&lt;br /&gt;
*“Change logs” are data about changes in the system.&lt;br /&gt;
&lt;br /&gt;
Historically, in EXODUS and NEOSYS, the above data has been deployed in exodus database files using SQL text files. However SQL files are not convenient for development.&lt;br /&gt;
&lt;br /&gt;
Therefore, &#039;dat&#039; text files will be used now so that standard development tools including editors and git can be fully exploited.&lt;br /&gt;
&lt;br /&gt;
====&#039;dat&#039; files====&lt;br /&gt;
&lt;br /&gt;
Each database file is represented by an os directory of the same name.&lt;br /&gt;
&lt;br /&gt;
Each record in the database file is represented by an os text file where filename is the primary key.&lt;br /&gt;
&lt;br /&gt;
For example a record with key &#039;&#039;&#039;DEADLINE&#039;&#039;&#039; in a dat file &#039;&#039;&#039;dict.materials&#039;&#039;&#039; would be represented as an os text file &#039;&#039;&#039;dat/dict.materials/DEADLINE&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Each line in the os text file represents one field in the db record. In other words, db record FM characters are represented by new line characters in &#039;dat&#039; files. Any actual new line characters required in the record, and any backslashes, are escaped and appear as &#039;\n&#039; and &#039;\\&#039; in &#039;dat&#039; files. Other database field separator characters such as VM, SM, TM and STM are stored without any conversion.&lt;br /&gt;
&lt;br /&gt;
====Location of dat files====&lt;br /&gt;
&lt;br /&gt;
The development versions are stored in exodus and neosys src/dat dirs. They form part of the standard git repositories in parallel with cpp files.&lt;br /&gt;
&lt;br /&gt;
The operational versions are stored in ~/dat and ~/live/dat alongside bin and lib dirs and are automatically installed into databases as database files on service startup. Any database functions embedded in the text files (pgsql) are also automatically installed at the same time.&lt;br /&gt;
&lt;br /&gt;
====Editing and deploying a &#039;dat&#039; file====&lt;br /&gt;
&lt;br /&gt;
It is currently a three step process to edit and deploy such &#039;dat&#039; files. &lt;br /&gt;
&lt;br /&gt;
=====Edit the &#039;dat&#039; file=====&lt;br /&gt;
&lt;br /&gt;
Note that EXODUS service and NEOSYS service have different src/dat folders.&lt;br /&gt;
&lt;br /&gt;
Editing language items:&lt;br /&gt;
&lt;br /&gt;
 edir dat/alanguage/SCHEDULES*ARABIC&lt;br /&gt;
&lt;br /&gt;
Editing a dictionary item:&lt;br /&gt;
&lt;br /&gt;
 edir dat/dict.materials/DEADLINE&lt;br /&gt;
&lt;br /&gt;
Editing a pgsql function in a dictionary:&lt;br /&gt;
&lt;br /&gt;
 edir dat/dict.materials/DEADLINE 8&lt;br /&gt;
&lt;br /&gt;
=====Copy all &#039;dat&#039; files to ~/dat =====&lt;br /&gt;
&lt;br /&gt;
This step might be removed at a later date.&lt;br /&gt;
&lt;br /&gt;
This will cause all test databases to immediately restart and load any &#039;dat&#039; file changes into dictionaries and data files and also create any new or modified pgsql functions.&lt;br /&gt;
&lt;br /&gt;
If any ~/neosys/src/dat files were edited:&lt;br /&gt;
&lt;br /&gt;
 cd ~/neosys/src&lt;br /&gt;
 &lt;br /&gt;
 ./compall dat&lt;br /&gt;
&lt;br /&gt;
and/or, if exodus/service/dat files were edited&lt;br /&gt;
&lt;br /&gt;
 cd ~/exodus/service/src&lt;br /&gt;
 &lt;br /&gt;
 ./compall dat&lt;br /&gt;
&lt;br /&gt;
=====Copy all programs and &#039;dat&#039; files to ~/live/bin|lib|dat=====&lt;br /&gt;
&lt;br /&gt;
This should only be run after testing. It will cause all live databases to automatically restart and do the same as the test databases mentioned above.&lt;br /&gt;
&lt;br /&gt;
 cd ~/exodus/service&lt;br /&gt;
 &lt;br /&gt;
 ./copyall CONFIRM&lt;br /&gt;
​&lt;br /&gt;
&lt;br /&gt;
===Psql unaccent extension===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The unaccent extension and the immutable_unaccent function are created in the db ‘template1’ during exodus installation while user is postgres which is a superuser.&lt;br /&gt;
&lt;br /&gt;
Thereafter all new databases are created as copies of template1 so they contain the extension and function&lt;br /&gt;
&lt;br /&gt;
====Error====&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
MVDBException:ERROR: function immutable_unaccent(text) does not exist&lt;br /&gt;
ERROR:  permission denied to create extension &amp;quot;unaccent&amp;quot;&lt;br /&gt;
HINT:  Must be superuser to create this extension. &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====Solution====&lt;br /&gt;
sudo -u postgres psql -c &#039;ALTER USER exodus WITH SUPERUSER;&#039;&lt;br /&gt;
&lt;br /&gt;
==Processes==&lt;br /&gt;
The TEST process for all database use the same object code stored in /root/lib, whereas all LIVE process use the object code in /root/neo/.&lt;br /&gt;
&lt;br /&gt;
==Postgres==&lt;br /&gt;
Connect into postgres shell:&lt;br /&gt;
 alias psql=&#039;sudo -u postgres psql&#039;&lt;br /&gt;
&lt;br /&gt;
Delete a database:&lt;br /&gt;
 sudo -u postgres dropdb &amp;lt;dbcode&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Debugging Exodus==&lt;br /&gt;
&lt;br /&gt;
===Debugging Live/Test services===&lt;br /&gt;
&lt;br /&gt;
./test &amp;lt;dbname&amp;gt; - execute test programs on _test database.&lt;br /&gt;
&lt;br /&gt;
./run &amp;lt;dbname&amp;gt;  - execute test programs on live database.&lt;br /&gt;
&lt;br /&gt;
===Debugging var values===&lt;br /&gt;
&lt;br /&gt;
Explanation of var flag value in gdb debug mode.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
(gdb) p varx                                                           &lt;br /&gt;
$2 = {var_str = &amp;quot;&amp;quot;, var_int = 0, var_dbl = 0, var_typ = {flags_ = 2}}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Each exodus var object contains 3 variables of type string, int and double.&lt;br /&gt;
&lt;br /&gt;
All 3 may be unassigned or only the string be assigned or just the int and double e.t.&lt;br /&gt;
&lt;br /&gt;
You can tell which variable type of a var object are set based on the var&#039;s flag value.&lt;br /&gt;
&lt;br /&gt;
1 = Means the string is assigned&lt;br /&gt;
2 = Means the int is assigned&lt;br /&gt;
4 = Means the double is assigned&lt;br /&gt;
&lt;br /&gt;
Example: If the flag is 7 (1+2+4), then all types are assigned.&lt;br /&gt;
&lt;br /&gt;
===Process Hung or consuming +100% CPU===&lt;br /&gt;
If process is consuming +100% CPU then it is likely stuck in an infinite loop.&lt;br /&gt;
&lt;br /&gt;
 ./doall &amp;lt;CLIENT&amp;gt; stop&lt;br /&gt;
&lt;br /&gt;
 ./run &amp;lt;CLIENT&amp;gt; &lt;br /&gt;
&lt;br /&gt;
 ./test &amp;lt;CLIENT&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Search through recent logs for &amp;lt;CLIENT&amp;gt; looking for requests that didn&#039;t return OK at the time nagios alerted of Hung process.&lt;br /&gt;
&lt;br /&gt;
A user may also instigate the error again, so monitor the CLIENT&#039;s service CPU usage.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
If cause found recreate it in test and once test process hit +100% break in test debugger.&lt;br /&gt;
&lt;br /&gt;
If cause not found, you will have to continue checking logs for the request that caused it or hope a user recreates the issue in live debugged service.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Once you&#039;ve broken in the debugged with the error, enter &amp;quot;n&amp;quot; and hold the enter key until you just seeing line repeat.&lt;br /&gt;
&lt;br /&gt;
Pay attention to start of loops code. E.g WHILE or FOR. (there is likely an error is there)&lt;br /&gt;
&lt;br /&gt;
==./doall==&lt;br /&gt;
====General====&lt;br /&gt;
&lt;br /&gt;
~/neosys/doall [LIVE|TEST] &amp;lt;DBCODE|ALL&amp;gt; &amp;lt; ACTION [OPTIONS,..]  | bash -- COMMAND ]&lt;br /&gt;
&lt;br /&gt;
Example: &lt;br /&gt;
 ./doall TEST ALL create_site t-&lt;br /&gt;
Result:&lt;br /&gt;
Create site for ALL TEST databases, using domain name prefix option &amp;quot;t-&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Screen 6: ./doall script contains all the necessary information(codes) to setup an installation.&lt;br /&gt;
It includes scripts to backup, restore, create an Apache site, create/start/stop/status a service, import an AREV database into postgres and more.&lt;br /&gt;
&lt;br /&gt;
====backup_db====&lt;br /&gt;
&lt;br /&gt;
*Does a backup &amp;amp; restore of a LIVE database into the corresponding TEST database.&lt;br /&gt;
*Backup &amp;lt;dbcode&amp;gt;.sql file is written to /root/backups/sql; which is rsynced to nl19:/backups/current/exodus/&lt;br /&gt;
*Unlike AREV, postgres can perform a &amp;quot;backup&amp;quot; of a database whilst the system is in use.&lt;br /&gt;
&lt;br /&gt;
==Git==&lt;br /&gt;
&lt;br /&gt;
There are two repositories, one for EXODUS and the other for NEOSYS.&lt;br /&gt;
&lt;br /&gt;
===Using git to make changes===&lt;br /&gt;
&lt;br /&gt;
Before following steps you must have a tested updated to a program/file/script. Do not commit untested changes to avoid a messy git history of reverts.&lt;br /&gt;
&lt;br /&gt;
Update your local repo before committing to local repo using the g alias for &amp;quot;git pull --ff-only ; git push &amp;amp;&amp;amp; git status&#039;&amp;quot;:&lt;br /&gt;
&amp;lt;pre&amp;gt;g&amp;lt;/pre&amp;gt;&lt;br /&gt;
Check which updates/files have not yet been staged and/or committed:&lt;br /&gt;
Add your updates to the staged area:&lt;br /&gt;
&amp;lt;pre&amp;gt;git add &amp;lt;filename&amp;gt;&amp;lt;/pre&amp;gt;&lt;br /&gt;
or if all the changes made need to be staged:&lt;br /&gt;
&amp;lt;pre&amp;gt;git add -a&amp;lt;/pre&amp;gt;&lt;br /&gt;
Make a commit with a descriptive message on purpose of updates:&lt;br /&gt;
&amp;lt;pre&amp;gt;git commit -m &amp;lt;description n purpose of changes&amp;gt;&amp;lt;/pre&amp;gt;&lt;br /&gt;
Again use g alias:&lt;br /&gt;
&amp;lt;pre&amp;gt;g&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Other useful git cmds===&lt;br /&gt;
&lt;br /&gt;
Do not use this commands unless you know what WILL happen. &lt;br /&gt;
*git pull - Instead use the safe &amp;quot;git pull --ff-only&amp;quot;&lt;br /&gt;
Stick to the alias &amp;quot;g&amp;quot; which does &amp;quot;git pull --ff-only ; git push &amp;amp;&amp;amp; git status&#039;&amp;quot;&lt;br /&gt;
&lt;br /&gt;
*git log - display history of commits to master branch&lt;br /&gt;
*git diff - display the differences in files between working files and files in local repo.&lt;br /&gt;
*git status - display: which updated files are staged/not staged(tracked)&lt;br /&gt;
*git stash - &lt;br /&gt;
*git branch - switch to a new branch&lt;br /&gt;
*git branch &amp;lt;branchname&amp;gt; - will switch to this branch only if it exists&lt;br /&gt;
*git checkout - DESTROYS/Updates the state of local working directory with the state of the files in the local repo. (YOU WILL LOSE non staged updates)&lt;br /&gt;
*git restore &amp;lt;filename&amp;gt; - DESTROYS/Updates the file with the version in the local repo. (like with git checkout but for a specific file)&lt;br /&gt;
*git checkin - &lt;br /&gt;
*git revert &amp;lt;commitHash&amp;gt; - reverses a specific commit (use git log to get the chosen commit hash)&lt;br /&gt;
*git ..&lt;br /&gt;
&lt;br /&gt;
==Converting AREV programs to EXODUS==&lt;br /&gt;
===Decompile AREV to C++===&lt;br /&gt;
&lt;br /&gt;
Do in Master AREV Installation Maintenance mode: (win7)&lt;br /&gt;
&lt;br /&gt;
#ATTACH ADECOMC &lt;br /&gt;
#*ADECOM &amp;lt;programname&amp;gt;   *single program&lt;br /&gt;
#*ADECOM &amp;lt;prog1&amp;gt; &amp;lt;prog2&amp;gt; &lt;br /&gt;
#*ADECOMALL              *all programs   (CHECK FIRST)&lt;br /&gt;
&lt;br /&gt;
Include the option &amp;quot;(V)&amp;quot; in the command to print the C++ to a notepad, which can easily be copy and pasted.&lt;br /&gt;
&lt;br /&gt;
===Getting C++ program to Exodus Installation===&lt;br /&gt;
&lt;br /&gt;
Two methods: (use the first for one off programs)&lt;br /&gt;
&lt;br /&gt;
====Copy &amp;amp; Paste====&lt;br /&gt;
&lt;br /&gt;
Compile program and open source code in notepad&lt;br /&gt;
&lt;br /&gt;
 ADECOM &amp;lt;programname&amp;gt; (V)&lt;br /&gt;
&lt;br /&gt;
Find which directory the program belongs. e.g fin/med/job/sys e.t&lt;br /&gt;
&lt;br /&gt;
 find /cygdrive/d/exodus/pickos | grep &amp;lt;program name&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If cpp in SYS, the program belongs in ~/exodus/service/src OR if in MED JOB FIN GEN AGY the program belongs in ~/neosys/src&lt;br /&gt;
&lt;br /&gt;
Copy the source code in the text file from the first command.&lt;br /&gt;
&lt;br /&gt;
In Exodus, create a new .cpp (in correct directory) and paste the source code.&lt;br /&gt;
&lt;br /&gt;
Compile &amp;amp; Test&lt;br /&gt;
&lt;br /&gt;
====Rsync====&lt;br /&gt;
&lt;br /&gt;
 /d/exodus/arev/syncup.sh&lt;br /&gt;
&lt;br /&gt;
If cpp in SYS then: ~/exodus/service/src ./getpickos&lt;br /&gt;
&lt;br /&gt;
If cpp in MED JOB FIN GEN AGY then: *~/neosys/src&lt;br /&gt;
&lt;br /&gt;
===Compile C++ files to TEST system===&lt;br /&gt;
&lt;br /&gt;
#*./test &amp;lt;DBNAME&amp;gt;&lt;br /&gt;
#*~/neosys ./doall TEST &amp;lt;DBNAME&amp;gt; restart    #to get one service to start start using the new lib files&lt;br /&gt;
#*~/neosys ./doall TEST all restart         #to get all the services to start start using the new lib files&lt;br /&gt;
&lt;br /&gt;
===Install C++ files to LIVE System===&lt;br /&gt;
&lt;br /&gt;
#~/exodus/service/ ./copyall            #to copy all the ~/lib and bin files to ~/live/lib and bin ... which is used by all exodus/live services&lt;br /&gt;
&lt;br /&gt;
==Writing Standard Exodus Core Function/Method Testing==&lt;br /&gt;
Screen 9: ~/exodus/test/src/&lt;br /&gt;
There are a series of test programs that check whether methods/functions behave as intended.&lt;br /&gt;
They do this using the function, assert.. a 1 or more argument values produce one and only one output)&lt;br /&gt;
&lt;br /&gt;
e.g test_multilang.cpp or test_sort.cpp&lt;br /&gt;
&lt;br /&gt;
Two methods of running test programs:&lt;br /&gt;
*Screen 9: make test&lt;br /&gt;
*after compiling using edic/compile/c, enter test_prog_name. (Since compile has moved it to ~/bin)&lt;br /&gt;
&lt;br /&gt;
Difference between the two methods is make calls gdb directly;&lt;br /&gt;
whereas ~/bin/test_prog_name uses exodus compile program&lt;br /&gt;
#~/neosys ./doall LIVE all restart&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Upgrading Exodus==&lt;br /&gt;
&lt;br /&gt;
#Develop patch in Dev system &lt;br /&gt;
&lt;br /&gt;
===Patching neosys/src or exodus/service/src===&lt;br /&gt;
&lt;br /&gt;
#Manually insert patches and compile into test programs.&lt;br /&gt;
#If patch dat files then run neosys/compall to get dat files into ~/dat&lt;br /&gt;
*If Patsalides:&lt;br /&gt;
*#SITE_DIR=ptcy ./test basic &lt;br /&gt;
*#login to BASIC_TEST and test&lt;br /&gt;
*Other clients:&lt;br /&gt;
*#./test DBCODE&lt;br /&gt;
*#login to DBCODE and test patches works&lt;br /&gt;
#run exodus/service/copyall and check only the patched programs are listed. (if not, see Troubleshoot below)&lt;br /&gt;
#Inform users to log off for 10mins. As a rule of thumb, live services must be stopped before copying test programs to live.&lt;br /&gt;
#exodus/service/copyall CONFIRM&lt;br /&gt;
&lt;br /&gt;
====Troubleshoot===&lt;br /&gt;
=====./copyall lists programs you have not patched===&lt;br /&gt;
Use exodus/service/copyone to copy only your patched programs one by one. (./copyone will not copy dat files)&lt;br /&gt;
&lt;br /&gt;
===Upgrading to new version===&lt;br /&gt;
&lt;br /&gt;
Use when there are too many changes to do individually patches.&lt;br /&gt;
&lt;br /&gt;
#Inform clients.&lt;br /&gt;
#*Client hosted - Schedule a planned upgrade with client.&lt;br /&gt;
#*NEOSYS hosted - Inform all clients/users of planned morning upgrade, 24hours in advanced.      (TODO: &#039;What&#039;s New in NEOSYS&#039;) AND (emailallusers.cpp)&lt;br /&gt;
#If the morning&#039;s USB backup failed, do NOT continue upgrade procedure because if upgrade fails, we need a way to roll back system to last working state.&lt;br /&gt;
#Check upgrade works on test service using:/root/neosys/upgrade.all.sh test&lt;br /&gt;
#Check the latest patch is working.&lt;br /&gt;
#Run/root/neosys/upgrade.all.sh live&lt;br /&gt;
#Inform users their system has been upgraded and they can login.&lt;br /&gt;
&lt;br /&gt;
===Roll Back Upgrade===&lt;br /&gt;
&lt;br /&gt;
If for any reason the entire upgrade needs to be reverted (excludes clients database), follow steps below:&lt;br /&gt;
&lt;br /&gt;
#Inform users that there is a problem and services need to be stopped.&lt;br /&gt;
#Stop all exodus processes.&lt;br /&gt;
#Restore the morning&#039;s USB backup by: (Note this backup contains:  source/obj code, /etc, neosys scripts but not client data)&lt;br /&gt;
##Login into container&#039;s host and rsync the morning&#039;s usb backup to the container&#039;s /:&lt;br /&gt;
#*&amp;lt;pre&amp;gt;rsync --dry-run -avz -e &#039;ssh -p &amp;lt;C_SSHPORT&amp;gt;&#039; /backups/usb/&amp;lt;C_CODE&amp;gt; &amp;lt;C_CODE&amp;gt;:/      (Example: rsync --dry-run -avz -e &#039;ssh -p 19582&#039; /backups/usb/ad1 ad1:/&amp;lt;/pre&amp;gt;)&lt;br /&gt;
#Quick sane check, the latest git commit is not the latest git commit in the remote repo.&lt;br /&gt;
#Inform users they can login.&lt;br /&gt;
&lt;br /&gt;
==Configuring services to autostart during login==&lt;br /&gt;
For Ptcy.&lt;br /&gt;
&lt;br /&gt;
#Create a file &#039;autostart.cfg&#039; in the data folder &lt;br /&gt;
&lt;br /&gt;
 touch /root/hosts/&amp;lt;dbname&amp;gt;/data/autostart.cfg&lt;br /&gt;
&lt;br /&gt;
This will autostart a database service as long as at least one database service in that directory is running.&lt;br /&gt;
&lt;br /&gt;
For example, demo service will autostart during login if,&lt;br /&gt;
#/root/hosts/demo/data/autostart.cfg exists and&lt;br /&gt;
#demo_test service is running&lt;br /&gt;
&lt;br /&gt;
==Speedup postgresql importing databases==&lt;br /&gt;
&lt;br /&gt;
Can be sped up by a factor of 10 BUT may result in corrupt files in case of hard OS crash where the dirty memory is not flushed to storage.&lt;br /&gt;
&lt;br /&gt;
Therefore it is advisable to use this feature only briefly and REMEMBER TO REMOVE IT! &lt;br /&gt;
&lt;br /&gt;
Email to support@neosys.com whenever using it or use personal notes not memory.&lt;br /&gt;
&lt;br /&gt;
nano /etc/postgresql/12/main/postgresql.conf&lt;br /&gt;
&lt;br /&gt;
Uncomment or add a line&lt;br /&gt;
 fsync = off&lt;br /&gt;
Restart postgres … will break any neosys/exodus running processes.&lt;br /&gt;
 r postgresql&lt;br /&gt;
or reload postgres may also work&lt;br /&gt;
&lt;br /&gt;
==Database Attach==&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
root@exodus:~/exodus/cli/src# dbattach&lt;br /&gt;
dbattach - Attach foreign database files to the current default database&lt;br /&gt;
&lt;br /&gt;
Syntax is dbattach TARGETDB [FILENAME,...] {OPTION...}&lt;br /&gt;
&lt;br /&gt;
Options:&lt;br /&gt;
&lt;br /&gt;
  F   Forcibly delete any normal files in the current default database.&lt;br /&gt;
&lt;br /&gt;
  R   Detach foreign files&lt;br /&gt;
  RR  Remove foreign database connection.&lt;br /&gt;
  RRR Remove all foreign database connections and attachments.&lt;br /&gt;
&lt;br /&gt;
  L   List attached foreign files in the current default database&lt;br /&gt;
&lt;br /&gt;
If no filenames are provided then a database connection is created.&lt;br /&gt;
This is *required* before filenames can be provided and attached.&lt;br /&gt;
&lt;br /&gt;
Notes:&lt;br /&gt;
&lt;br /&gt;
Attachments are permanent until re-attached or removed.&lt;br /&gt;
&lt;br /&gt;
Indexes on attached files behave strangely.&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Issues:&lt;br /&gt;
&lt;br /&gt;
TARGETDB must be on the same connection as the current default database.&lt;br /&gt;
&lt;br /&gt;
Current user must have access to the foreign database.&lt;br /&gt;
&lt;br /&gt;
If EXO_USER and EXO_PASS are not set then exodus defaults are used.&lt;br /&gt;
&lt;br /&gt;
exodus .config file is not used currently.&lt;/div&gt;</summary>
		<author><name>Gregory</name></author>
	</entry>
	<entry>
		<id>https://techwiki.neosys.com/index.php?title=Configuring_NEOSYS_Generally&amp;diff=3977</id>
		<title>Configuring NEOSYS Generally</title>
		<link rel="alternate" type="text/html" href="https://techwiki.neosys.com/index.php?title=Configuring_NEOSYS_Generally&amp;diff=3977"/>
		<updated>2022-05-20T08:20:42Z</updated>

		<summary type="html">&lt;p&gt;Gregory: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==System Configuration File==&lt;br /&gt;
&lt;br /&gt;
See [http://userwiki.neosys.com/index.php/System_Configuration_File System Configuration File]&lt;br /&gt;
&lt;br /&gt;
==Clearing files in database==&lt;br /&gt;
&lt;br /&gt;
This is to be done if you want to clean an old database or clean a training database so that a client can enter fresh data.&lt;br /&gt;
&lt;br /&gt;
These commands DO NOT reset the data to &amp;quot;factory settings&amp;quot; so for new installations you need to download a fresh BACKUP.ZIP file from the NEOSYS website.&lt;br /&gt;
&lt;br /&gt;
*Clear transactions F5 - CLEAROP (only clears transactions not reference files)&lt;br /&gt;
&lt;br /&gt;
*Clear all F5 - CLEARALL (rather nasty command because it clears all reference files as well)&lt;br /&gt;
&lt;br /&gt;
*Clear finance transactions F5 - CLEARACC&lt;br /&gt;
&lt;br /&gt;
REINDEXALL SHOULD be done after CLEAROP or CLEARACC in order to reduce the size of the index files to reflect the reduction in size of data, by rebuilding them from scratch, since index files don&#039;t reduce in size automatically when the data is cleared or reduced.&lt;br /&gt;
&lt;br /&gt;
==Clearing selected files in database==&lt;br /&gt;
&lt;br /&gt;
This can be done if you want to reimport selected files.&lt;br /&gt;
&lt;br /&gt;
WARNING This procedure must not be used if there are any transaction in the system that might use the files being cleared.&lt;br /&gt;
&lt;br /&gt;
WARNING Clearing individual files is error prone because other files might refer to the records you are clearing (referential integrity is not applied so dangling references may be created). For example, clearing suppliers without clearing vehicles in advance results in vehicles which have supplier codes that do not exist. Even if you reimport the suppliers, some supplier codes in the vehicles file may not be reimported leaving vehicles with problems.&lt;br /&gt;
&lt;br /&gt;
WARNING The opportunity to create problems that have no solution and that may only surface when the system is in operation is endless unless you think through the implications very very very carefully.&lt;br /&gt;
&lt;br /&gt;
*Flush Index		F5	FLUSH.INDEX (this command MUST be performed immediately after any data clearing, because CLEARFILE does not clear the related indexes immediately and it will be done later on access, causing random stopping later on)&lt;br /&gt;
&lt;br /&gt;
*Clear suppliers		F5	CLEARFILE SUPPLIERS&lt;br /&gt;
&lt;br /&gt;
*Clear vehicles		F5	CLEARFILE VEHICLES&lt;br /&gt;
&lt;br /&gt;
If a particular field needs to be cleared from a file then get the exact field name defined in the file.&lt;br /&gt;
&lt;br /&gt;
To list the various fields in a file   F5 LD CLIENTS  (for Client and Brand file)&lt;br /&gt;
&lt;br /&gt;
*Clear Payment Instruction from Client and Brand file F5    CLEARFIELD CLIENTS PAYMENT_INSTRUCTIONS (only clears the payment instruction defined in all the Client &amp;amp; Brand file)&lt;br /&gt;
&lt;br /&gt;
*Clear Agency fee % from Client &amp;amp; Brand file F5 CLEARFIELD CLIENTS FEE (only clears the agency fee defined for all Client &amp;amp; Brand flies)&lt;br /&gt;
&lt;br /&gt;
==Mass updating database without data entry==&lt;br /&gt;
&lt;br /&gt;
Warning: It is advisable that you take the approval of NEOSYS DBA or programmers before doing any of the following procedures. There is no protection whatsoever from damaging the database if you do not appreciate all the implications of any particular update. Common sense and caution must be used. If you damage a database then it may be, or with operation become, irretrievably damaged and require reconstruction from a backup causing possibly extreme finance damages to the owner of the data and consequences for yourself. You have been warned.&lt;br /&gt;
&lt;br /&gt;
There are many commands in maintenance mode that allow you to amend the database directly and without any record and without any ability to reverse changes.&lt;br /&gt;
&lt;br /&gt;
Normally, no record of the changes is made. All changes will appear to have been done by the last user at the time and date of the last normal user interface amendments.&lt;br /&gt;
&lt;br /&gt;
===Available fields to clear or set===&lt;br /&gt;
&lt;br /&gt;
#Client &amp;amp; Brand File: CLIENTS MARKET_CODE&lt;br /&gt;
#Client &amp;amp; Brand File: BRANDS MARKET_CODE&lt;br /&gt;
&lt;br /&gt;
===How to clear a database field===&lt;br /&gt;
&lt;br /&gt;
Assuming that a particular database field may be blank (i.e. not required for data entry) then you may clear a field as follows.&lt;br /&gt;
&lt;br /&gt;
Warning: There is nothing to stop you clearing a field that is mandatory and doing this may cause irrecoverable damage to the database.&lt;br /&gt;
&lt;br /&gt;
In the following example we wish to change all clients with market code “UAE to have market code blank.&lt;br /&gt;
&lt;br /&gt;
First, if you don’t want to clear all records, “select” the required records.&lt;br /&gt;
&lt;br /&gt;
 SELECT CLIENTS WITH MARKET_CODE “UAE”&lt;br /&gt;
&lt;br /&gt;
After a period of time, depending on the number of records in the file, it should briefly state the number of records selected and then return to the command prompt.&lt;br /&gt;
&lt;br /&gt;
WARNING: If no records have been selected then ALL records will be updated by the following command!&lt;br /&gt;
&lt;br /&gt;
 CLEARFIELD CLIENTS MARKET_CODE&lt;br /&gt;
&lt;br /&gt;
===How to set a database field===&lt;br /&gt;
&lt;br /&gt;
In the following example we change all the clients where the market code is blank (has not been entered) to become “UAE”.&lt;br /&gt;
&lt;br /&gt;
Warning: You can set the market code to a market code that does not exist. This will cause various problems in the operation of the system but is probably not irrecoverable.&lt;br /&gt;
&lt;br /&gt;
First, if you don’t want to set all records, “select” the required records.&lt;br /&gt;
&lt;br /&gt;
 SELECT CLIENTS WITH MARKET_CODE “”&lt;br /&gt;
&lt;br /&gt;
After a period of time, depending on the number of records in the file, it should briefly state the number of records selected and then return to the command prompt.&lt;br /&gt;
&lt;br /&gt;
WARNING: If no records have been selected then ALL records will be updated by the following command!&lt;br /&gt;
 &lt;br /&gt;
 CLEARFIELD CLIENTS MARKET_CODE/UAE&lt;br /&gt;
&lt;br /&gt;
==Backup to other media (i.e. not to USB)==&lt;br /&gt;
&lt;br /&gt;
[[Backup and Restore#Backup to other media (i.e. not to USB)|Backup to other media]]&lt;br /&gt;
&lt;br /&gt;
==Reordering databases in maintenance mode==&lt;br /&gt;
&lt;br /&gt;
#Open NEOSYS in maintenance mode&lt;br /&gt;
#General &amp;gt; Backup &amp;amp; data management &amp;gt; Reorder databases&lt;br /&gt;
#Press the Enter key to select/deselect the databases in the required order.&lt;br /&gt;
#Press F9 once and confirm that the databases are in the required order, if not go back to Step 3.&lt;br /&gt;
#Press F9 again and select Yes to save the reordered list.&lt;br /&gt;
&lt;br /&gt;
==Copying a single record from one database to another==&lt;br /&gt;
 &lt;br /&gt;
You need to know the file name and record key of the record to be copied.&lt;br /&gt;
 &lt;br /&gt;
In this case the file is DEFINITIONS and the key is AGENCY.PARAMS&lt;br /&gt;
 &lt;br /&gt;
You can invent any old style 8.3 filename instead of C:\AGP.DAT in the following example&lt;br /&gt;
 &lt;br /&gt;
On the source computer:&lt;br /&gt;
 &lt;br /&gt;
 F5&lt;br /&gt;
 COPY DEFINITIONS AGENCY.PARAMS TO: (DOS C:\AGP.DAT)&lt;br /&gt;
&lt;br /&gt;
On the target computer:&lt;br /&gt;
 &lt;br /&gt;
 F5&lt;br /&gt;
 COPY DOS C:\AGP.DAT (ON) TO: (DEFINITIONS AGENCY.PARAMS)&lt;br /&gt;
&lt;br /&gt;
The (O) option is required to force overwrite of the existing &lt;br /&gt;
 &lt;br /&gt;
The (N) option means only copy if the target already exists. It is advisable to use it when you know that the target already exists to avoid misspellings in the command. It must be omitted if the target doesnt exist.&lt;br /&gt;
&lt;br /&gt;
==Allowing users temporary login as NEOSYS in maintenance mode==&lt;br /&gt;
 &lt;br /&gt;
#Get them to login with any name even NEOSYS&lt;br /&gt;
#Get them to enter &amp;quot;?&amp;quot; for the pass without the quotes&lt;br /&gt;
#NEOSYS will give them a lock like &amp;quot;NEOSYS 123456&amp;quot; which they must give you. You should not log out until the next step is completed&lt;br /&gt;
#Follow the NEOSYS lock/key procedure using the full contents of the lock including the user name&lt;br /&gt;
&lt;br /&gt;
(to allow access EXCEPT access to authorisation screen use a special number (not documented here) as the last number of the initial command)&lt;br /&gt;
&lt;br /&gt;
#Give them the key and get them to enter and proceed&lt;br /&gt;
&lt;br /&gt;
==Configuring upload of photoshop &amp;quot;cs2&amp;quot; jpg files==&lt;br /&gt;
&lt;br /&gt;
Photoshop version &amp;quot;cs2&amp;quot; produces jpg files that cannot be viewed in Internet Explorer.&lt;br /&gt;
&lt;br /&gt;
A solution is to rename the files extension from .jpg to .psjpg before uploading.&lt;br /&gt;
&lt;br /&gt;
&amp;quot;psjpg&amp;quot; files are an invention of NEOSYS and IIS must be configured to handle .psjpg files as follows:&lt;br /&gt;
&lt;br /&gt;
Windows Server 2003 (doesnt work on XP)&lt;br /&gt;
&lt;br /&gt;
#Computer Management, Internet Information Server, Properties&lt;br /&gt;
#Click MIME Types&lt;br /&gt;
#Click New&lt;br /&gt;
#Extension: psjpg&lt;br /&gt;
#MIME Type: application/photoshop&lt;br /&gt;
#Click OK,OK,OK&lt;br /&gt;
#Restart IIS (Right click, All Tasks, Restart)&lt;br /&gt;
&lt;br /&gt;
==Configuring next Media Booking Order No.==&lt;br /&gt;
&lt;br /&gt;
It is not possible to edit the next booking order number, as done with other document sequences, within the Invoice Number screen.&lt;br /&gt;
&lt;br /&gt;
The CURRENT booking order number is defined in the below definitions record.&lt;br /&gt;
&lt;br /&gt;
 EXO_DATA=&amp;lt;dbcode&amp;gt; edir definitions BOOKING_ORDERS.SK&lt;/div&gt;</summary>
		<author><name>Gregory</name></author>
	</entry>
	<entry>
		<id>https://techwiki.neosys.com/index.php?title=EXODUS_Knowledge&amp;diff=3975</id>
		<title>EXODUS Knowledge</title>
		<link rel="alternate" type="text/html" href="https://techwiki.neosys.com/index.php?title=EXODUS_Knowledge&amp;diff=3975"/>
		<updated>2022-04-11T06:35:44Z</updated>

		<summary type="html">&lt;p&gt;Gregory: /* Psql unaccent extension */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==TMUX Screens==&lt;br /&gt;
&lt;br /&gt;
To create the EXODUS maintenance/programming environment&lt;br /&gt;
 exodus#: ./tmux.exodus&lt;br /&gt;
&lt;br /&gt;
===Screens===&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
0: /&lt;br /&gt;
    Work regarding exodus server. i.e /etc/nagios or general networking or /var/log/mail.log&lt;br /&gt;
&lt;br /&gt;
1: /root/exodus/&lt;br /&gt;
    Exodus core is installed Contains build and make libraries here ./libexodus&lt;br /&gt;
&lt;br /&gt;
2: /root/exodus/libexodus/exodus&lt;br /&gt;
    Core exodus (libraries that emulate the AREV system e.g mv.h )&lt;br /&gt;
    &lt;br /&gt;
3: /root/exodus/cli/src&lt;br /&gt;
    Exodus Command Line Interface e.g edir, edic, list, listfiles, delete, createdb&lt;br /&gt;
    &lt;br /&gt;
4: root/exodus/service&lt;br /&gt;
    EXODUS core default host directory but also contains scripts that create/manage requirements of a service (create_service, create_db, create_site, backup_db, restore_db, start, stop, status)&lt;br /&gt;
    One exception is NEOSYS www files are in ./www, which pulled from NEOSYS www git.&lt;br /&gt;
&lt;br /&gt;
5: /root/exodus/service/src&lt;br /&gt;
    Exodus core service programs (programs that are not related to NEOSYS agency operations and can be used to support other non-NEOSYS services) eg listen, usersubs, sendmail, openfile, select, sort, list,.&lt;br /&gt;
&lt;br /&gt;
    Extra info:    &lt;br /&gt;
    sql directory contains basic dictiorary files converted to sql instructions used when creating a EXODUS psql database&lt;br /&gt;
    e.g dict_voc.sql is a file that describes what to expect in certain fields of the voc file.&lt;br /&gt;
    TODO: compall currently throws few warnings. Read them and familiarise. In case new warnings appear, notify Steve.    &lt;br /&gt;
        &lt;br /&gt;
6: /root/neosys&lt;br /&gt;
    NEOSYS specific client installation management scripts e.g .doall, import_db and import_files (from AREV), ./run ./test (see below for these two commands)&lt;br /&gt;
    &lt;br /&gt;
7: /root/neosys/src&lt;br /&gt;
    NEOSYS Agency programs (see section How AREV programs are distributed in EXODUS src/*.cpp&lt;br /&gt;
    ../ has .git&lt;br /&gt;
&lt;br /&gt;
8: /root/hosts&lt;br /&gt;
    client specific files  e.g logs, images, (shared ./www -&amp;gt; root/exodus/service/www&lt;br /&gt;
&lt;br /&gt;
9: /root/exodus/test/src&lt;br /&gt;
    series of programs that test whether subroutines (specifically Exodus core libraries) work as they should eg for the var lib - &amp;quot;assert( var(&amp;quot;11111&amp;quot;).isnum());&amp;quot;&lt;br /&gt;
&lt;br /&gt;
10: bash /bin/top&lt;br /&gt;
    Monitor for NEOSYS client processes&lt;br /&gt;
    Displays customised format: sorted by total time spend and by processor time.&lt;br /&gt;
     Press &amp;quot;=&amp;quot; : to change to standard top format&lt;br /&gt;
     Press shift + w : to save format settings, replacing the old customised top format&lt;br /&gt;
     To go back to the customised format do:&lt;br /&gt;
        Press &amp;quot;o&amp;quot;&lt;br /&gt;
        Type &amp;quot;COMMAND=serve_agy&amp;quot;&lt;br /&gt;
        shift + t : this sorts by total time spent&lt;br /&gt;
        shift + p : this sorts by processor time&lt;br /&gt;
        shift + w : to save this setting and enter  &#039;y&#039; to confirm&lt;br /&gt;
&lt;br /&gt;
11: /var/log/syslog&lt;br /&gt;
     Log of NEOSYS client requests&lt;br /&gt;
&lt;br /&gt;
12: /root/exodus/service/quick&lt;br /&gt;
     Displays the last time the svr file (in /root/hosts/&amp;lt;client&amp;gt;/data/&amp;lt;dbname&amp;gt;) was updated.&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Object Code/Libraries==&lt;br /&gt;
LIVE and TEST processes use different sets of object code.&lt;br /&gt;
TEST processes use libraries in ~/lib/, whereas LIVE processes use object code in ~/neo/lib&lt;br /&gt;
&lt;br /&gt;
This means development &amp;amp; testing can be done stress free on TEST database, as opposed to testing on production databases.&lt;br /&gt;
&lt;br /&gt;
When compiling using edic, the TEST object code is updated if the compilation is successful. (~/lib)&lt;br /&gt;
In order to apply a tested patch to LIVE see [[Update LIVE programs]].&lt;br /&gt;
&lt;br /&gt;
==Dictionaries &amp;amp; Psql Functions==&lt;br /&gt;
&lt;br /&gt;
Dictionaries, data used to describe other data; specifically the fields of other files. &lt;br /&gt;
&lt;br /&gt;
There are three types of fields: &amp;lt;pre&amp;gt;&lt;br /&gt;
(F) field for raw data E.g &amp;quot;Office 44 Building Rush&amp;quot;&lt;br /&gt;
(S) symbolic or calculated E.g for total ans=field1+field2&lt;br /&gt;
(G) General, pending &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Show dictionary using &amp;quot;EXO_DATA=test list dict.clients&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
===Development and deployment using &#039;dat&#039; files===&lt;br /&gt;
&lt;br /&gt;
====Rationale====&lt;br /&gt;
&lt;br /&gt;
Part of system development is the creation of various data that is neither programs nor layout i.e. not cpp, h, html, js, php files etc.&lt;br /&gt;
&lt;br /&gt;
For example:&lt;br /&gt;
&lt;br /&gt;
*Dictionaries are data about data.&lt;br /&gt;
*Language files are data about text to use for various languages.&lt;br /&gt;
*“Change logs” are data about changes in the system.&lt;br /&gt;
&lt;br /&gt;
Historically, in EXODUS and NEOSYS, the above data has been deployed in exodus database files using SQL text files. However SQL files are not convenient for development.&lt;br /&gt;
&lt;br /&gt;
Therefore, &#039;dat&#039; text files will be used now so that standard development tools including editors and git can be fully exploited.&lt;br /&gt;
&lt;br /&gt;
====&#039;dat&#039; files====&lt;br /&gt;
&lt;br /&gt;
Each database file is represented by an os directory of the same name.&lt;br /&gt;
&lt;br /&gt;
Each record in the database file is represented by an os text file where filename is the primary key.&lt;br /&gt;
&lt;br /&gt;
For example a record with key &#039;&#039;&#039;DEADLINE&#039;&#039;&#039; in a dat file &#039;&#039;&#039;dict.materials&#039;&#039;&#039; would be represented as an os text file &#039;&#039;&#039;dat/dict.materials/DEADLINE&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Each line in the os text file represents one field in the db record. In other words, db record FM characters are represented by new line characters in &#039;dat&#039; files. Any actual new line characters required in the record, and any backslashes, are escaped and appear as &#039;\n&#039; and &#039;\\&#039; in &#039;dat&#039; files. Other database field separator characters such as VM, SM, TM and STM are stored without any conversion.&lt;br /&gt;
&lt;br /&gt;
====Location of dat files====&lt;br /&gt;
&lt;br /&gt;
The development versions are stored in exodus and neosys src/dat dirs. They form part of the standard git repositories in parallel with cpp files.&lt;br /&gt;
&lt;br /&gt;
The operational versions are stored in ~/dat and ~/live/dat alongside bin and lib dirs and are automatically installed into databases as database files on service startup. Any database functions embedded in the text files (pgsql) are also automatically installed at the same time.&lt;br /&gt;
&lt;br /&gt;
====Editing and deploying a &#039;dat&#039; file====&lt;br /&gt;
&lt;br /&gt;
It is currently a three step process to edit and deploy such &#039;dat&#039; files. &lt;br /&gt;
&lt;br /&gt;
=====Edit the &#039;dat&#039; file=====&lt;br /&gt;
&lt;br /&gt;
Note that EXODUS service and NEOSYS service have different src/dat folders.&lt;br /&gt;
&lt;br /&gt;
Editing language items:&lt;br /&gt;
&lt;br /&gt;
 edir dat/alanguage/SCHEDULES*ARABIC&lt;br /&gt;
&lt;br /&gt;
Editing a dictionary item:&lt;br /&gt;
&lt;br /&gt;
 edir dat/dict.materials/DEADLINE&lt;br /&gt;
&lt;br /&gt;
Editing a pgsql function in a dictionary:&lt;br /&gt;
&lt;br /&gt;
 edir dat/dict.materials/DEADLINE 8&lt;br /&gt;
&lt;br /&gt;
=====Copy all &#039;dat&#039; files to ~/dat =====&lt;br /&gt;
&lt;br /&gt;
This step might be removed at a later date.&lt;br /&gt;
&lt;br /&gt;
This will cause all test databases to immediately restart and load any &#039;dat&#039; file changes into dictionaries and data files and also create any new or modified pgsql functions.&lt;br /&gt;
&lt;br /&gt;
If any ~/neosys/src/dat files were edited:&lt;br /&gt;
&lt;br /&gt;
 cd ~/neosys/src&lt;br /&gt;
 &lt;br /&gt;
 ./compall dat&lt;br /&gt;
&lt;br /&gt;
and/or, if exodus/service/dat files were edited&lt;br /&gt;
&lt;br /&gt;
 cd ~/exodus/service/src&lt;br /&gt;
 &lt;br /&gt;
 ./compall dat&lt;br /&gt;
&lt;br /&gt;
=====Copy all programs and &#039;dat&#039; files to ~/live/bin|lib|dat=====&lt;br /&gt;
&lt;br /&gt;
This should only be run after testing. It will cause all live databases to automatically restart and do the same as the test databases mentioned above.&lt;br /&gt;
&lt;br /&gt;
 cd ~/exodus/service&lt;br /&gt;
 &lt;br /&gt;
 ./copyall CONFIRM&lt;br /&gt;
​&lt;br /&gt;
&lt;br /&gt;
===Psql unaccent extension===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The unaccent extension and the immutable_unaccent function are created in the db ‘template1’ during exodus installation while user is postgres which is a superuser.&lt;br /&gt;
&lt;br /&gt;
Thereafter all new databases are created as copies of template1 so they contain the extension and function&lt;br /&gt;
&lt;br /&gt;
====Error====&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
MVDBException:ERROR: function immutable_unaccent(text) does not exist&lt;br /&gt;
ERROR:  permission denied to create extension &amp;quot;unaccent&amp;quot;&lt;br /&gt;
HINT:  Must be superuser to create this extension. &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====Solution====&lt;br /&gt;
sudo -u postgres psql -c &#039;ALTER USER exodus WITH SUPERUSER;&#039;&lt;br /&gt;
&lt;br /&gt;
==Processes==&lt;br /&gt;
The TEST process for all database use the same object code stored in /root/lib, whereas all LIVE process use the object code in /root/neo/.&lt;br /&gt;
&lt;br /&gt;
==Postgres==&lt;br /&gt;
Connect into postgres shell:&lt;br /&gt;
 alias psql=&#039;sudo -u postgres psql&#039;&lt;br /&gt;
&lt;br /&gt;
Delete a database:&lt;br /&gt;
 sudo -u postgres dropdb &amp;lt;dbcode&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Debugging Exodus==&lt;br /&gt;
&lt;br /&gt;
===Debugging Live/Test services===&lt;br /&gt;
&lt;br /&gt;
./test &amp;lt;dbname&amp;gt; - execute test programs on _test database.&lt;br /&gt;
&lt;br /&gt;
./run &amp;lt;dbname&amp;gt;  - execute test programs on live database.&lt;br /&gt;
&lt;br /&gt;
===Debugging var values===&lt;br /&gt;
&lt;br /&gt;
Explanation of var flag value in gdb debug mode.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
(gdb) p varx                                                           &lt;br /&gt;
$2 = {var_str = &amp;quot;&amp;quot;, var_int = 0, var_dbl = 0, var_typ = {flags_ = 2}}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Each exodus var object contains 3 variables of type string, int and double.&lt;br /&gt;
&lt;br /&gt;
All 3 may be unassigned or only the string be assigned or just the int and double e.t.&lt;br /&gt;
&lt;br /&gt;
You can tell which variable type of a var object are set based on the var&#039;s flag value.&lt;br /&gt;
&lt;br /&gt;
1 = Means the string is assigned&lt;br /&gt;
2 = Means the int is assigned&lt;br /&gt;
4 = Means the double is assigned&lt;br /&gt;
&lt;br /&gt;
Example: If the flag is 7 (1+2+4), then all types are assigned.&lt;br /&gt;
&lt;br /&gt;
===Process Hung or consuming +100% CPU===&lt;br /&gt;
If process is consuming +100% CPU then it is likely stuck in an infinite loop.&lt;br /&gt;
&lt;br /&gt;
 ./doall &amp;lt;CLIENT&amp;gt; stop&lt;br /&gt;
&lt;br /&gt;
 ./run &amp;lt;CLIENT&amp;gt; &lt;br /&gt;
&lt;br /&gt;
 ./test &amp;lt;CLIENT&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Search through recent logs for &amp;lt;CLIENT&amp;gt; looking for requests that didn&#039;t return OK at the time nagios alerted of Hung process.&lt;br /&gt;
&lt;br /&gt;
A user may also instigate the error again, so monitor the CLIENT&#039;s service CPU usage.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
If cause found recreate it in test and once test process hit +100% break in test debugger.&lt;br /&gt;
&lt;br /&gt;
If cause not found, you will have to continue checking logs for the request that caused it or hope a user recreates the issue in live debugged service.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Once you&#039;ve broken in the debugged with the error, enter &amp;quot;n&amp;quot; and hold the enter key until you just seeing line repeat.&lt;br /&gt;
&lt;br /&gt;
Pay attention to start of loops code. E.g WHILE or FOR. (there is likely an error is there)&lt;br /&gt;
&lt;br /&gt;
==./doall==&lt;br /&gt;
====General====&lt;br /&gt;
&lt;br /&gt;
~/neosys/doall [LIVE|TEST] &amp;lt;DBCODE|ALL&amp;gt; &amp;lt; ACTION [OPTIONS,..]  | bash -- COMMAND ]&lt;br /&gt;
&lt;br /&gt;
Example: &lt;br /&gt;
 ./doall TEST ALL create_site t-&lt;br /&gt;
Result:&lt;br /&gt;
Create site for ALL TEST databases, using domain name prefix option &amp;quot;t-&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Screen 6: ./doall script contains all the necessary information(codes) to setup an installation.&lt;br /&gt;
It includes scripts to backup, restore, create an Apache site, create/start/stop/status a service, import an AREV database into postgres and more.&lt;br /&gt;
&lt;br /&gt;
====backup_db====&lt;br /&gt;
&lt;br /&gt;
*Does a backup &amp;amp; restore of a LIVE database into the corresponding TEST database.&lt;br /&gt;
*Backup &amp;lt;dbcode&amp;gt;.sql file is written to /root/backups/sql; which is rsynced to nl19:/backups/current/exodus/&lt;br /&gt;
*Unlike AREV, postgres can perform a &amp;quot;backup&amp;quot; of a database whilst the system is in use.&lt;br /&gt;
&lt;br /&gt;
==Git==&lt;br /&gt;
&lt;br /&gt;
There are two repositories, one for EXODUS and the other for NEOSYS.&lt;br /&gt;
&lt;br /&gt;
===Using git to make changes===&lt;br /&gt;
&lt;br /&gt;
Before following steps you must have a tested updated to a program/file/script. Do not commit untested changes to avoid a messy git history of reverts.&lt;br /&gt;
&lt;br /&gt;
Update your local repo before committing to local repo using the g alias for &amp;quot;git pull --ff-only ; git push &amp;amp;&amp;amp; git status&#039;&amp;quot;:&lt;br /&gt;
&amp;lt;pre&amp;gt;g&amp;lt;/pre&amp;gt;&lt;br /&gt;
Check which updates/files have not yet been staged and/or committed:&lt;br /&gt;
Add your updates to the staged area:&lt;br /&gt;
&amp;lt;pre&amp;gt;git add &amp;lt;filename&amp;gt;&amp;lt;/pre&amp;gt;&lt;br /&gt;
or if all the changes made need to be staged:&lt;br /&gt;
&amp;lt;pre&amp;gt;git add -a&amp;lt;/pre&amp;gt;&lt;br /&gt;
Make a commit with a descriptive message on purpose of updates:&lt;br /&gt;
&amp;lt;pre&amp;gt;git commit -m &amp;lt;description n purpose of changes&amp;gt;&amp;lt;/pre&amp;gt;&lt;br /&gt;
Again use g alias:&lt;br /&gt;
&amp;lt;pre&amp;gt;g&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Other useful git cmds===&lt;br /&gt;
&lt;br /&gt;
Do not use this commands unless you know what WILL happen. &lt;br /&gt;
*git pull - Instead use the safe &amp;quot;git pull --ff-only&amp;quot;&lt;br /&gt;
Stick to the alias &amp;quot;g&amp;quot; which does &amp;quot;git pull --ff-only ; git push &amp;amp;&amp;amp; git status&#039;&amp;quot;&lt;br /&gt;
&lt;br /&gt;
*git log - display history of commits to master branch&lt;br /&gt;
*git diff - display the differences in files between working files and files in local repo.&lt;br /&gt;
*git status - display: which updated files are staged/not staged(tracked)&lt;br /&gt;
*git stash - &lt;br /&gt;
*git branch - switch to a new branch&lt;br /&gt;
*git branch &amp;lt;branchname&amp;gt; - will switch to this branch only if it exists&lt;br /&gt;
*git checkout - DESTROYS/Updates the state of local working directory with the state of the files in the local repo. (YOU WILL LOSE non staged updates)&lt;br /&gt;
*git restore &amp;lt;filename&amp;gt; - DESTROYS/Updates the file with the version in the local repo. (like with git checkout but for a specific file)&lt;br /&gt;
*git checkin - &lt;br /&gt;
*git revert &amp;lt;commitHash&amp;gt; - reverses a specific commit (use git log to get the chosen commit hash)&lt;br /&gt;
*git ..&lt;br /&gt;
&lt;br /&gt;
==Converting AREV programs to EXODUS==&lt;br /&gt;
===Decompile AREV to C++===&lt;br /&gt;
&lt;br /&gt;
Do in Master AREV Installation Maintenance mode: (win7)&lt;br /&gt;
&lt;br /&gt;
#ATTACH ADECOMC &lt;br /&gt;
#*ADECOM &amp;lt;programname&amp;gt;   *single program&lt;br /&gt;
#*ADECOM &amp;lt;prog1&amp;gt; &amp;lt;prog2&amp;gt; &lt;br /&gt;
#*ADECOMALL              *all programs   (CHECK FIRST)&lt;br /&gt;
&lt;br /&gt;
Include the option &amp;quot;(V)&amp;quot; in the command to print the C++ to a notepad, which can easily be copy and pasted.&lt;br /&gt;
&lt;br /&gt;
===Getting C++ program to Exodus Installation===&lt;br /&gt;
&lt;br /&gt;
Two methods: (use the first for one off programs)&lt;br /&gt;
&lt;br /&gt;
====Copy &amp;amp; Paste====&lt;br /&gt;
&lt;br /&gt;
Compile program and open source code in notepad&lt;br /&gt;
&lt;br /&gt;
 ADECOM &amp;lt;programname&amp;gt; (V)&lt;br /&gt;
&lt;br /&gt;
Find which directory the program belongs. e.g fin/med/job/sys e.t&lt;br /&gt;
&lt;br /&gt;
 find /cygdrive/d/exodus/pickos | grep &amp;lt;program name&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If cpp in SYS, the program belongs in ~/exodus/service/src OR if in MED JOB FIN GEN AGY the program belongs in ~/neosys/src&lt;br /&gt;
&lt;br /&gt;
Copy the source code in the text file from the first command.&lt;br /&gt;
&lt;br /&gt;
In Exodus, create a new .cpp (in correct directory) and paste the source code.&lt;br /&gt;
&lt;br /&gt;
Compile &amp;amp; Test&lt;br /&gt;
&lt;br /&gt;
====Rsync====&lt;br /&gt;
&lt;br /&gt;
 /d/exodus/arev/syncup.sh&lt;br /&gt;
&lt;br /&gt;
If cpp in SYS then: ~/exodus/service/src ./getpickos&lt;br /&gt;
&lt;br /&gt;
If cpp in MED JOB FIN GEN AGY then: *~/neosys/src&lt;br /&gt;
&lt;br /&gt;
===Compile C++ files to TEST system===&lt;br /&gt;
&lt;br /&gt;
#*./test &amp;lt;DBNAME&amp;gt;&lt;br /&gt;
#*~/neosys ./doall TEST &amp;lt;DBNAME&amp;gt; restart    #to get one service to start start using the new lib files&lt;br /&gt;
#*~/neosys ./doall TEST all restart         #to get all the services to start start using the new lib files&lt;br /&gt;
&lt;br /&gt;
===Install C++ files to LIVE System===&lt;br /&gt;
&lt;br /&gt;
#~/exodus/service/ ./copyall            #to copy all the ~/lib and bin files to ~/live/lib and bin ... which is used by all exodus/live services&lt;br /&gt;
&lt;br /&gt;
==Writing Standard Exodus Core Function/Method Testing==&lt;br /&gt;
Screen 9: ~/exodus/test/src/&lt;br /&gt;
There are a series of test programs that check whether methods/functions behave as intended.&lt;br /&gt;
They do this using the function, assert.. a 1 or more argument values produce one and only one output)&lt;br /&gt;
&lt;br /&gt;
e.g test_multilang.cpp or test_sort.cpp&lt;br /&gt;
&lt;br /&gt;
Two methods of running test programs:&lt;br /&gt;
*Screen 9: make test&lt;br /&gt;
*after compiling using edic/compile/c, enter test_prog_name. (Since compile has moved it to ~/bin)&lt;br /&gt;
&lt;br /&gt;
Difference between the two methods is make calls gdb directly;&lt;br /&gt;
whereas ~/bin/test_prog_name uses exodus compile program&lt;br /&gt;
#~/neosys ./doall LIVE all restart&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Upgrading Exodus==&lt;br /&gt;
&lt;br /&gt;
#Develop patch in Dev system &lt;br /&gt;
&lt;br /&gt;
===Single Patches===&lt;br /&gt;
&lt;br /&gt;
#Insert patches into various files and compile if necessary&lt;br /&gt;
#If patch dat files then run neosys compall to get dat files into ~/dat&lt;br /&gt;
*If Patsalides:&lt;br /&gt;
*#SITE_DIR=ptcy ./test basic  #requires /etc/systemd/system/agy_test@.service to have been patched like agy_live@.service&lt;br /&gt;
*#web login to BASIC_TEST to test&lt;br /&gt;
*If not patsalides&lt;br /&gt;
*#./test DBCODE&lt;br /&gt;
*#login to DBCODE and test&lt;br /&gt;
#If all ok&lt;br /&gt;
#./copyall &lt;br /&gt;
#CHECK what WILL be copied!&lt;br /&gt;
#Judge if really need to get people off (unlikely for typical patch) and request users to logout for 10 mins&lt;br /&gt;
#./copyall CONFIRM and CHECK what was copied is as per exceptions same as previous step&lt;br /&gt;
#./copyone could be used instead of copyall but it has no test mode and does not copy dat files&lt;br /&gt;
&lt;br /&gt;
===Upgrading to new version===&lt;br /&gt;
&lt;br /&gt;
Use when there are too many changes to do individually patches.&lt;br /&gt;
&lt;br /&gt;
#Inform clients.&lt;br /&gt;
#*Client hosted - Schedule a planned upgrade with client.&lt;br /&gt;
#*NEOSYS hosted - Inform all clients/users of planned morning upgrade, 24hours in advanced.      (TODO: &#039;What&#039;s New in NEOSYS&#039;) AND (emailallusers.cpp)&lt;br /&gt;
#If the morning&#039;s USB backup failed, do NOT continue upgrade procedure because if upgrade fails, we need a way to roll back system to last working state.&lt;br /&gt;
#Check upgrade works on test service using:/root/neosys/upgrade.all.sh test&lt;br /&gt;
#Check the latest patch is working.&lt;br /&gt;
#Run/root/neosys/upgrade.all.sh live&lt;br /&gt;
#Inform users their system has been upgraded and they can login.&lt;br /&gt;
&lt;br /&gt;
===Roll Back Upgrade===&lt;br /&gt;
&lt;br /&gt;
If for any reason the entire upgrade needs to be reverted (excludes clients database), follow steps below:&lt;br /&gt;
&lt;br /&gt;
#Inform users that there is a problem and services need to be stopped.&lt;br /&gt;
#Stop all exodus processes.&lt;br /&gt;
#Restore the morning&#039;s USB backup by: (Note this backup contains:  source/obj code, /etc, neosys scripts but not client data)&lt;br /&gt;
##Login into container&#039;s host and rsync the morning&#039;s usb backup to the container&#039;s /:&lt;br /&gt;
#*&amp;lt;pre&amp;gt;rsync --dry-run -avz -e &#039;ssh -p &amp;lt;C_SSHPORT&amp;gt;&#039; /backups/usb/&amp;lt;C_CODE&amp;gt; &amp;lt;C_CODE&amp;gt;:/      (Example: rsync --dry-run -avz -e &#039;ssh -p 19582&#039; /backups/usb/ad1 ad1:/&amp;lt;/pre&amp;gt;)&lt;br /&gt;
#Quick sane check, the latest git commit is not the latest git commit in the remote repo.&lt;br /&gt;
#Inform users they can login.&lt;br /&gt;
&lt;br /&gt;
==Configuring services to autostart during login==&lt;br /&gt;
For Ptcy.&lt;br /&gt;
&lt;br /&gt;
#Create a file &#039;autostart.cfg&#039; in the data folder &lt;br /&gt;
&lt;br /&gt;
 touch /root/hosts/&amp;lt;dbname&amp;gt;/data/autostart.cfg&lt;br /&gt;
&lt;br /&gt;
This will autostart a database service as long as at least one database service in that directory is running.&lt;br /&gt;
&lt;br /&gt;
For example, demo service will autostart during login if,&lt;br /&gt;
#/root/hosts/demo/data/autostart.cfg exists and&lt;br /&gt;
#demo_test service is running&lt;br /&gt;
&lt;br /&gt;
==Speedup postgresql importing databases==&lt;br /&gt;
&lt;br /&gt;
Can be sped up by a factor of 10 BUT may result in corrupt files in case of hard OS crash where the dirty memory is not flushed to storage.&lt;br /&gt;
&lt;br /&gt;
Therefore it is advisable to use this feature only briefly and REMEMBER TO REMOVE IT! &lt;br /&gt;
&lt;br /&gt;
Email to support@neosys.com whenever using it or use personal notes not memory.&lt;br /&gt;
&lt;br /&gt;
nano /etc/postgresql/12/main/postgresql.conf&lt;br /&gt;
&lt;br /&gt;
Uncomment or add a line&lt;br /&gt;
 fsync = off&lt;br /&gt;
Restart postgres … will break any neosys/exodus running processes.&lt;br /&gt;
 r postgresql&lt;br /&gt;
or reload postgres may also work&lt;br /&gt;
&lt;br /&gt;
==Database Attach==&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
root@exodus:~/exodus/cli/src# dbattach&lt;br /&gt;
dbattach - Attach foreign database files to the current default database&lt;br /&gt;
&lt;br /&gt;
Syntax is dbattach TARGETDB [FILENAME,...] {OPTION...}&lt;br /&gt;
&lt;br /&gt;
Options:&lt;br /&gt;
&lt;br /&gt;
  F   Forcibly delete any normal files in the current default database.&lt;br /&gt;
&lt;br /&gt;
  R   Detach foreign files&lt;br /&gt;
  RR  Remove foreign database connection.&lt;br /&gt;
  RRR Remove all foreign database connections and attachments.&lt;br /&gt;
&lt;br /&gt;
  L   List attached foreign files in the current default database&lt;br /&gt;
&lt;br /&gt;
If no filenames are provided then a database connection is created.&lt;br /&gt;
This is *required* before filenames can be provided and attached.&lt;br /&gt;
&lt;br /&gt;
Notes:&lt;br /&gt;
&lt;br /&gt;
Attachments are permanent until re-attached or removed.&lt;br /&gt;
&lt;br /&gt;
Indexes on attached files behave strangely.&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Issues:&lt;br /&gt;
&lt;br /&gt;
TARGETDB must be on the same connection as the current default database.&lt;br /&gt;
&lt;br /&gt;
Current user must have access to the foreign database.&lt;br /&gt;
&lt;br /&gt;
If EXO_USER and EXO_PASS are not set then exodus defaults are used.&lt;br /&gt;
&lt;br /&gt;
exodus .config file is not used currently.&lt;/div&gt;</summary>
		<author><name>Gregory</name></author>
	</entry>
	<entry>
		<id>https://techwiki.neosys.com/index.php?title=EXODUS_Knowledge&amp;diff=3974</id>
		<title>EXODUS Knowledge</title>
		<link rel="alternate" type="text/html" href="https://techwiki.neosys.com/index.php?title=EXODUS_Knowledge&amp;diff=3974"/>
		<updated>2022-04-11T06:01:06Z</updated>

		<summary type="html">&lt;p&gt;Gregory: /* Dictionaries &amp;amp; Psql Functions */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==TMUX Screens==&lt;br /&gt;
&lt;br /&gt;
To create the EXODUS maintenance/programming environment&lt;br /&gt;
 exodus#: ./tmux.exodus&lt;br /&gt;
&lt;br /&gt;
===Screens===&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
0: /&lt;br /&gt;
    Work regarding exodus server. i.e /etc/nagios or general networking or /var/log/mail.log&lt;br /&gt;
&lt;br /&gt;
1: /root/exodus/&lt;br /&gt;
    Exodus core is installed Contains build and make libraries here ./libexodus&lt;br /&gt;
&lt;br /&gt;
2: /root/exodus/libexodus/exodus&lt;br /&gt;
    Core exodus (libraries that emulate the AREV system e.g mv.h )&lt;br /&gt;
    &lt;br /&gt;
3: /root/exodus/cli/src&lt;br /&gt;
    Exodus Command Line Interface e.g edir, edic, list, listfiles, delete, createdb&lt;br /&gt;
    &lt;br /&gt;
4: root/exodus/service&lt;br /&gt;
    EXODUS core default host directory but also contains scripts that create/manage requirements of a service (create_service, create_db, create_site, backup_db, restore_db, start, stop, status)&lt;br /&gt;
    One exception is NEOSYS www files are in ./www, which pulled from NEOSYS www git.&lt;br /&gt;
&lt;br /&gt;
5: /root/exodus/service/src&lt;br /&gt;
    Exodus core service programs (programs that are not related to NEOSYS agency operations and can be used to support other non-NEOSYS services) eg listen, usersubs, sendmail, openfile, select, sort, list,.&lt;br /&gt;
&lt;br /&gt;
    Extra info:    &lt;br /&gt;
    sql directory contains basic dictiorary files converted to sql instructions used when creating a EXODUS psql database&lt;br /&gt;
    e.g dict_voc.sql is a file that describes what to expect in certain fields of the voc file.&lt;br /&gt;
    TODO: compall currently throws few warnings. Read them and familiarise. In case new warnings appear, notify Steve.    &lt;br /&gt;
        &lt;br /&gt;
6: /root/neosys&lt;br /&gt;
    NEOSYS specific client installation management scripts e.g .doall, import_db and import_files (from AREV), ./run ./test (see below for these two commands)&lt;br /&gt;
    &lt;br /&gt;
7: /root/neosys/src&lt;br /&gt;
    NEOSYS Agency programs (see section How AREV programs are distributed in EXODUS src/*.cpp&lt;br /&gt;
    ../ has .git&lt;br /&gt;
&lt;br /&gt;
8: /root/hosts&lt;br /&gt;
    client specific files  e.g logs, images, (shared ./www -&amp;gt; root/exodus/service/www&lt;br /&gt;
&lt;br /&gt;
9: /root/exodus/test/src&lt;br /&gt;
    series of programs that test whether subroutines (specifically Exodus core libraries) work as they should eg for the var lib - &amp;quot;assert( var(&amp;quot;11111&amp;quot;).isnum());&amp;quot;&lt;br /&gt;
&lt;br /&gt;
10: bash /bin/top&lt;br /&gt;
    Monitor for NEOSYS client processes&lt;br /&gt;
    Displays customised format: sorted by total time spend and by processor time.&lt;br /&gt;
     Press &amp;quot;=&amp;quot; : to change to standard top format&lt;br /&gt;
     Press shift + w : to save format settings, replacing the old customised top format&lt;br /&gt;
     To go back to the customised format do:&lt;br /&gt;
        Press &amp;quot;o&amp;quot;&lt;br /&gt;
        Type &amp;quot;COMMAND=serve_agy&amp;quot;&lt;br /&gt;
        shift + t : this sorts by total time spent&lt;br /&gt;
        shift + p : this sorts by processor time&lt;br /&gt;
        shift + w : to save this setting and enter  &#039;y&#039; to confirm&lt;br /&gt;
&lt;br /&gt;
11: /var/log/syslog&lt;br /&gt;
     Log of NEOSYS client requests&lt;br /&gt;
&lt;br /&gt;
12: /root/exodus/service/quick&lt;br /&gt;
     Displays the last time the svr file (in /root/hosts/&amp;lt;client&amp;gt;/data/&amp;lt;dbname&amp;gt;) was updated.&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Object Code/Libraries==&lt;br /&gt;
LIVE and TEST processes use different sets of object code.&lt;br /&gt;
TEST processes use libraries in ~/lib/, whereas LIVE processes use object code in ~/neo/lib&lt;br /&gt;
&lt;br /&gt;
This means development &amp;amp; testing can be done stress free on TEST database, as opposed to testing on production databases.&lt;br /&gt;
&lt;br /&gt;
When compiling using edic, the TEST object code is updated if the compilation is successful. (~/lib)&lt;br /&gt;
In order to apply a tested patch to LIVE see [[Update LIVE programs]].&lt;br /&gt;
&lt;br /&gt;
==Dictionaries &amp;amp; Psql Functions==&lt;br /&gt;
&lt;br /&gt;
Dictionaries, data used to describe other data; specifically the fields of other files. &lt;br /&gt;
&lt;br /&gt;
There are three types of fields: &amp;lt;pre&amp;gt;&lt;br /&gt;
(F) field for raw data E.g &amp;quot;Office 44 Building Rush&amp;quot;&lt;br /&gt;
(S) symbolic or calculated E.g for total ans=field1+field2&lt;br /&gt;
(G) General, pending &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Show dictionary using &amp;quot;EXO_DATA=test list dict.clients&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
===Development and deployment using &#039;dat&#039; files===&lt;br /&gt;
&lt;br /&gt;
====Rationale====&lt;br /&gt;
&lt;br /&gt;
Part of system development is the creation of various data that is neither programs nor layout i.e. not cpp, h, html, js, php files etc.&lt;br /&gt;
&lt;br /&gt;
For example:&lt;br /&gt;
&lt;br /&gt;
*Dictionaries are data about data.&lt;br /&gt;
*Language files are data about text to use for various languages.&lt;br /&gt;
*“Change logs” are data about changes in the system.&lt;br /&gt;
&lt;br /&gt;
Historically, in EXODUS and NEOSYS, the above data has been deployed in exodus database files using SQL text files. However SQL files are not convenient for development.&lt;br /&gt;
&lt;br /&gt;
Therefore, &#039;dat&#039; text files will be used now so that standard development tools including editors and git can be fully exploited.&lt;br /&gt;
&lt;br /&gt;
====&#039;dat&#039; files====&lt;br /&gt;
&lt;br /&gt;
Each database file is represented by an os directory of the same name.&lt;br /&gt;
&lt;br /&gt;
Each record in the database file is represented by an os text file where filename is the primary key.&lt;br /&gt;
&lt;br /&gt;
For example a record with key &#039;&#039;&#039;DEADLINE&#039;&#039;&#039; in a dat file &#039;&#039;&#039;dict.materials&#039;&#039;&#039; would be represented as an os text file &#039;&#039;&#039;dat/dict.materials/DEADLINE&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Each line in the os text file represents one field in the db record. In other words, db record FM characters are represented by new line characters in &#039;dat&#039; files. Any actual new line characters required in the record, and any backslashes, are escaped and appear as &#039;\n&#039; and &#039;\\&#039; in &#039;dat&#039; files. Other database field separator characters such as VM, SM, TM and STM are stored without any conversion.&lt;br /&gt;
&lt;br /&gt;
====Location of dat files====&lt;br /&gt;
&lt;br /&gt;
The development versions are stored in exodus and neosys src/dat dirs. They form part of the standard git repositories in parallel with cpp files.&lt;br /&gt;
&lt;br /&gt;
The operational versions are stored in ~/dat and ~/live/dat alongside bin and lib dirs and are automatically installed into databases as database files on service startup. Any database functions embedded in the text files (pgsql) are also automatically installed at the same time.&lt;br /&gt;
&lt;br /&gt;
====Editing and deploying a &#039;dat&#039; file====&lt;br /&gt;
&lt;br /&gt;
It is currently a three step process to edit and deploy such &#039;dat&#039; files. &lt;br /&gt;
&lt;br /&gt;
=====Edit the &#039;dat&#039; file=====&lt;br /&gt;
&lt;br /&gt;
Note that EXODUS service and NEOSYS service have different src/dat folders.&lt;br /&gt;
&lt;br /&gt;
Editing language items:&lt;br /&gt;
&lt;br /&gt;
 edir dat/alanguage/SCHEDULES*ARABIC&lt;br /&gt;
&lt;br /&gt;
Editing a dictionary item:&lt;br /&gt;
&lt;br /&gt;
 edir dat/dict.materials/DEADLINE&lt;br /&gt;
&lt;br /&gt;
Editing a pgsql function in a dictionary:&lt;br /&gt;
&lt;br /&gt;
 edir dat/dict.materials/DEADLINE 8&lt;br /&gt;
&lt;br /&gt;
=====Copy all &#039;dat&#039; files to ~/dat =====&lt;br /&gt;
&lt;br /&gt;
This step might be removed at a later date.&lt;br /&gt;
&lt;br /&gt;
This will cause all test databases to immediately restart and load any &#039;dat&#039; file changes into dictionaries and data files and also create any new or modified pgsql functions.&lt;br /&gt;
&lt;br /&gt;
If any ~/neosys/src/dat files were edited:&lt;br /&gt;
&lt;br /&gt;
 cd ~/neosys/src&lt;br /&gt;
 &lt;br /&gt;
 ./compall dat&lt;br /&gt;
&lt;br /&gt;
and/or, if exodus/service/dat files were edited&lt;br /&gt;
&lt;br /&gt;
 cd ~/exodus/service/src&lt;br /&gt;
 &lt;br /&gt;
 ./compall dat&lt;br /&gt;
&lt;br /&gt;
=====Copy all programs and &#039;dat&#039; files to ~/live/bin|lib|dat=====&lt;br /&gt;
&lt;br /&gt;
This should only be run after testing. It will cause all live databases to automatically restart and do the same as the test databases mentioned above.&lt;br /&gt;
&lt;br /&gt;
 cd ~/exodus/service&lt;br /&gt;
 &lt;br /&gt;
 ./copyall CONFIRM&lt;br /&gt;
​&lt;br /&gt;
&lt;br /&gt;
===Psql unaccent extension===&lt;br /&gt;
The unaccent extension and the immutable_unaccent function are created in the db ‘template1’ during exodus installation while user is postgres which is a superuser.&lt;br /&gt;
&lt;br /&gt;
Thereafter all new databases are created as copies of template1 so they contain the extension and function&lt;br /&gt;
&lt;br /&gt;
==Processes==&lt;br /&gt;
The TEST process for all database use the same object code stored in /root/lib, whereas all LIVE process use the object code in /root/neo/.&lt;br /&gt;
&lt;br /&gt;
==Postgres==&lt;br /&gt;
Connect into postgres shell:&lt;br /&gt;
 alias psql=&#039;sudo -u postgres psql&#039;&lt;br /&gt;
&lt;br /&gt;
Delete a database:&lt;br /&gt;
 sudo -u postgres dropdb &amp;lt;dbcode&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Debugging Exodus==&lt;br /&gt;
&lt;br /&gt;
===Debugging Live/Test services===&lt;br /&gt;
&lt;br /&gt;
./test &amp;lt;dbname&amp;gt; - execute test programs on _test database.&lt;br /&gt;
&lt;br /&gt;
./run &amp;lt;dbname&amp;gt;  - execute test programs on live database.&lt;br /&gt;
&lt;br /&gt;
===Debugging var values===&lt;br /&gt;
&lt;br /&gt;
Explanation of var flag value in gdb debug mode.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
(gdb) p varx                                                           &lt;br /&gt;
$2 = {var_str = &amp;quot;&amp;quot;, var_int = 0, var_dbl = 0, var_typ = {flags_ = 2}}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Each exodus var object contains 3 variables of type string, int and double.&lt;br /&gt;
&lt;br /&gt;
All 3 may be unassigned or only the string be assigned or just the int and double e.t.&lt;br /&gt;
&lt;br /&gt;
You can tell which variable type of a var object are set based on the var&#039;s flag value.&lt;br /&gt;
&lt;br /&gt;
1 = Means the string is assigned&lt;br /&gt;
2 = Means the int is assigned&lt;br /&gt;
4 = Means the double is assigned&lt;br /&gt;
&lt;br /&gt;
Example: If the flag is 7 (1+2+4), then all types are assigned.&lt;br /&gt;
&lt;br /&gt;
===Process Hung or consuming +100% CPU===&lt;br /&gt;
If process is consuming +100% CPU then it is likely stuck in an infinite loop.&lt;br /&gt;
&lt;br /&gt;
 ./doall &amp;lt;CLIENT&amp;gt; stop&lt;br /&gt;
&lt;br /&gt;
 ./run &amp;lt;CLIENT&amp;gt; &lt;br /&gt;
&lt;br /&gt;
 ./test &amp;lt;CLIENT&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Search through recent logs for &amp;lt;CLIENT&amp;gt; looking for requests that didn&#039;t return OK at the time nagios alerted of Hung process.&lt;br /&gt;
&lt;br /&gt;
A user may also instigate the error again, so monitor the CLIENT&#039;s service CPU usage.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
If cause found recreate it in test and once test process hit +100% break in test debugger.&lt;br /&gt;
&lt;br /&gt;
If cause not found, you will have to continue checking logs for the request that caused it or hope a user recreates the issue in live debugged service.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Once you&#039;ve broken in the debugged with the error, enter &amp;quot;n&amp;quot; and hold the enter key until you just seeing line repeat.&lt;br /&gt;
&lt;br /&gt;
Pay attention to start of loops code. E.g WHILE or FOR. (there is likely an error is there)&lt;br /&gt;
&lt;br /&gt;
==./doall==&lt;br /&gt;
====General====&lt;br /&gt;
&lt;br /&gt;
~/neosys/doall [LIVE|TEST] &amp;lt;DBCODE|ALL&amp;gt; &amp;lt; ACTION [OPTIONS,..]  | bash -- COMMAND ]&lt;br /&gt;
&lt;br /&gt;
Example: &lt;br /&gt;
 ./doall TEST ALL create_site t-&lt;br /&gt;
Result:&lt;br /&gt;
Create site for ALL TEST databases, using domain name prefix option &amp;quot;t-&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Screen 6: ./doall script contains all the necessary information(codes) to setup an installation.&lt;br /&gt;
It includes scripts to backup, restore, create an Apache site, create/start/stop/status a service, import an AREV database into postgres and more.&lt;br /&gt;
&lt;br /&gt;
====backup_db====&lt;br /&gt;
&lt;br /&gt;
*Does a backup &amp;amp; restore of a LIVE database into the corresponding TEST database.&lt;br /&gt;
*Backup &amp;lt;dbcode&amp;gt;.sql file is written to /root/backups/sql; which is rsynced to nl19:/backups/current/exodus/&lt;br /&gt;
*Unlike AREV, postgres can perform a &amp;quot;backup&amp;quot; of a database whilst the system is in use.&lt;br /&gt;
&lt;br /&gt;
==Git==&lt;br /&gt;
&lt;br /&gt;
There are two repositories, one for EXODUS and the other for NEOSYS.&lt;br /&gt;
&lt;br /&gt;
===Using git to make changes===&lt;br /&gt;
&lt;br /&gt;
Before following steps you must have a tested updated to a program/file/script. Do not commit untested changes to avoid a messy git history of reverts.&lt;br /&gt;
&lt;br /&gt;
Update your local repo before committing to local repo using the g alias for &amp;quot;git pull --ff-only ; git push &amp;amp;&amp;amp; git status&#039;&amp;quot;:&lt;br /&gt;
&amp;lt;pre&amp;gt;g&amp;lt;/pre&amp;gt;&lt;br /&gt;
Check which updates/files have not yet been staged and/or committed:&lt;br /&gt;
Add your updates to the staged area:&lt;br /&gt;
&amp;lt;pre&amp;gt;git add &amp;lt;filename&amp;gt;&amp;lt;/pre&amp;gt;&lt;br /&gt;
or if all the changes made need to be staged:&lt;br /&gt;
&amp;lt;pre&amp;gt;git add -a&amp;lt;/pre&amp;gt;&lt;br /&gt;
Make a commit with a descriptive message on purpose of updates:&lt;br /&gt;
&amp;lt;pre&amp;gt;git commit -m &amp;lt;description n purpose of changes&amp;gt;&amp;lt;/pre&amp;gt;&lt;br /&gt;
Again use g alias:&lt;br /&gt;
&amp;lt;pre&amp;gt;g&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Other useful git cmds===&lt;br /&gt;
&lt;br /&gt;
Do not use this commands unless you know what WILL happen. &lt;br /&gt;
*git pull - Instead use the safe &amp;quot;git pull --ff-only&amp;quot;&lt;br /&gt;
Stick to the alias &amp;quot;g&amp;quot; which does &amp;quot;git pull --ff-only ; git push &amp;amp;&amp;amp; git status&#039;&amp;quot;&lt;br /&gt;
&lt;br /&gt;
*git log - display history of commits to master branch&lt;br /&gt;
*git diff - display the differences in files between working files and files in local repo.&lt;br /&gt;
*git status - display: which updated files are staged/not staged(tracked)&lt;br /&gt;
*git stash - &lt;br /&gt;
*git branch - switch to a new branch&lt;br /&gt;
*git branch &amp;lt;branchname&amp;gt; - will switch to this branch only if it exists&lt;br /&gt;
*git checkout - DESTROYS/Updates the state of local working directory with the state of the files in the local repo. (YOU WILL LOSE non staged updates)&lt;br /&gt;
*git restore &amp;lt;filename&amp;gt; - DESTROYS/Updates the file with the version in the local repo. (like with git checkout but for a specific file)&lt;br /&gt;
*git checkin - &lt;br /&gt;
*git revert &amp;lt;commitHash&amp;gt; - reverses a specific commit (use git log to get the chosen commit hash)&lt;br /&gt;
*git ..&lt;br /&gt;
&lt;br /&gt;
==Converting AREV programs to EXODUS==&lt;br /&gt;
===Decompile AREV to C++===&lt;br /&gt;
&lt;br /&gt;
Do in Master AREV Installation Maintenance mode: (win7)&lt;br /&gt;
&lt;br /&gt;
#ATTACH ADECOMC &lt;br /&gt;
#*ADECOM &amp;lt;programname&amp;gt;   *single program&lt;br /&gt;
#*ADECOM &amp;lt;prog1&amp;gt; &amp;lt;prog2&amp;gt; &lt;br /&gt;
#*ADECOMALL              *all programs   (CHECK FIRST)&lt;br /&gt;
&lt;br /&gt;
Include the option &amp;quot;(V)&amp;quot; in the command to print the C++ to a notepad, which can easily be copy and pasted.&lt;br /&gt;
&lt;br /&gt;
===Getting C++ program to Exodus Installation===&lt;br /&gt;
&lt;br /&gt;
Two methods: (use the first for one off programs)&lt;br /&gt;
&lt;br /&gt;
====Copy &amp;amp; Paste====&lt;br /&gt;
&lt;br /&gt;
Compile program and open source code in notepad&lt;br /&gt;
&lt;br /&gt;
 ADECOM &amp;lt;programname&amp;gt; (V)&lt;br /&gt;
&lt;br /&gt;
Find which directory the program belongs. e.g fin/med/job/sys e.t&lt;br /&gt;
&lt;br /&gt;
 find /cygdrive/d/exodus/pickos | grep &amp;lt;program name&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If cpp in SYS, the program belongs in ~/exodus/service/src OR if in MED JOB FIN GEN AGY the program belongs in ~/neosys/src&lt;br /&gt;
&lt;br /&gt;
Copy the source code in the text file from the first command.&lt;br /&gt;
&lt;br /&gt;
In Exodus, create a new .cpp (in correct directory) and paste the source code.&lt;br /&gt;
&lt;br /&gt;
Compile &amp;amp; Test&lt;br /&gt;
&lt;br /&gt;
====Rsync====&lt;br /&gt;
&lt;br /&gt;
 /d/exodus/arev/syncup.sh&lt;br /&gt;
&lt;br /&gt;
If cpp in SYS then: ~/exodus/service/src ./getpickos&lt;br /&gt;
&lt;br /&gt;
If cpp in MED JOB FIN GEN AGY then: *~/neosys/src&lt;br /&gt;
&lt;br /&gt;
===Compile C++ files to TEST system===&lt;br /&gt;
&lt;br /&gt;
#*./test &amp;lt;DBNAME&amp;gt;&lt;br /&gt;
#*~/neosys ./doall TEST &amp;lt;DBNAME&amp;gt; restart    #to get one service to start start using the new lib files&lt;br /&gt;
#*~/neosys ./doall TEST all restart         #to get all the services to start start using the new lib files&lt;br /&gt;
&lt;br /&gt;
===Install C++ files to LIVE System===&lt;br /&gt;
&lt;br /&gt;
#~/exodus/service/ ./copyall            #to copy all the ~/lib and bin files to ~/live/lib and bin ... which is used by all exodus/live services&lt;br /&gt;
&lt;br /&gt;
==Writing Standard Exodus Core Function/Method Testing==&lt;br /&gt;
Screen 9: ~/exodus/test/src/&lt;br /&gt;
There are a series of test programs that check whether methods/functions behave as intended.&lt;br /&gt;
They do this using the function, assert.. a 1 or more argument values produce one and only one output)&lt;br /&gt;
&lt;br /&gt;
e.g test_multilang.cpp or test_sort.cpp&lt;br /&gt;
&lt;br /&gt;
Two methods of running test programs:&lt;br /&gt;
*Screen 9: make test&lt;br /&gt;
*after compiling using edic/compile/c, enter test_prog_name. (Since compile has moved it to ~/bin)&lt;br /&gt;
&lt;br /&gt;
Difference between the two methods is make calls gdb directly;&lt;br /&gt;
whereas ~/bin/test_prog_name uses exodus compile program&lt;br /&gt;
#~/neosys ./doall LIVE all restart&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Upgrading Exodus==&lt;br /&gt;
&lt;br /&gt;
#Develop patch in Dev system &lt;br /&gt;
&lt;br /&gt;
===Single Patches===&lt;br /&gt;
&lt;br /&gt;
#Insert patches into various files and compile if necessary&lt;br /&gt;
#If patch dat files then run neosys compall to get dat files into ~/dat&lt;br /&gt;
*If Patsalides:&lt;br /&gt;
*#SITE_DIR=ptcy ./test basic  #requires /etc/systemd/system/agy_test@.service to have been patched like agy_live@.service&lt;br /&gt;
*#web login to BASIC_TEST to test&lt;br /&gt;
*If not patsalides&lt;br /&gt;
*#./test DBCODE&lt;br /&gt;
*#login to DBCODE and test&lt;br /&gt;
#If all ok&lt;br /&gt;
#./copyall &lt;br /&gt;
#CHECK what WILL be copied!&lt;br /&gt;
#Judge if really need to get people off (unlikely for typical patch) and request users to logout for 10 mins&lt;br /&gt;
#./copyall CONFIRM and CHECK what was copied is as per exceptions same as previous step&lt;br /&gt;
#./copyone could be used instead of copyall but it has no test mode and does not copy dat files&lt;br /&gt;
&lt;br /&gt;
===Upgrading to new version===&lt;br /&gt;
&lt;br /&gt;
Use when there are too many changes to do individually patches.&lt;br /&gt;
&lt;br /&gt;
#Inform clients.&lt;br /&gt;
#*Client hosted - Schedule a planned upgrade with client.&lt;br /&gt;
#*NEOSYS hosted - Inform all clients/users of planned morning upgrade, 24hours in advanced.      (TODO: &#039;What&#039;s New in NEOSYS&#039;) AND (emailallusers.cpp)&lt;br /&gt;
#If the morning&#039;s USB backup failed, do NOT continue upgrade procedure because if upgrade fails, we need a way to roll back system to last working state.&lt;br /&gt;
#Check upgrade works on test service using:/root/neosys/upgrade.all.sh test&lt;br /&gt;
#Check the latest patch is working.&lt;br /&gt;
#Run/root/neosys/upgrade.all.sh live&lt;br /&gt;
#Inform users their system has been upgraded and they can login.&lt;br /&gt;
&lt;br /&gt;
===Roll Back Upgrade===&lt;br /&gt;
&lt;br /&gt;
If for any reason the entire upgrade needs to be reverted (excludes clients database), follow steps below:&lt;br /&gt;
&lt;br /&gt;
#Inform users that there is a problem and services need to be stopped.&lt;br /&gt;
#Stop all exodus processes.&lt;br /&gt;
#Restore the morning&#039;s USB backup by: (Note this backup contains:  source/obj code, /etc, neosys scripts but not client data)&lt;br /&gt;
##Login into container&#039;s host and rsync the morning&#039;s usb backup to the container&#039;s /:&lt;br /&gt;
#*&amp;lt;pre&amp;gt;rsync --dry-run -avz -e &#039;ssh -p &amp;lt;C_SSHPORT&amp;gt;&#039; /backups/usb/&amp;lt;C_CODE&amp;gt; &amp;lt;C_CODE&amp;gt;:/      (Example: rsync --dry-run -avz -e &#039;ssh -p 19582&#039; /backups/usb/ad1 ad1:/&amp;lt;/pre&amp;gt;)&lt;br /&gt;
#Quick sane check, the latest git commit is not the latest git commit in the remote repo.&lt;br /&gt;
#Inform users they can login.&lt;br /&gt;
&lt;br /&gt;
==Configuring services to autostart during login==&lt;br /&gt;
For Ptcy.&lt;br /&gt;
&lt;br /&gt;
#Create a file &#039;autostart.cfg&#039; in the data folder &lt;br /&gt;
&lt;br /&gt;
 touch /root/hosts/&amp;lt;dbname&amp;gt;/data/autostart.cfg&lt;br /&gt;
&lt;br /&gt;
This will autostart a database service as long as at least one database service in that directory is running.&lt;br /&gt;
&lt;br /&gt;
For example, demo service will autostart during login if,&lt;br /&gt;
#/root/hosts/demo/data/autostart.cfg exists and&lt;br /&gt;
#demo_test service is running&lt;br /&gt;
&lt;br /&gt;
==Speedup postgresql importing databases==&lt;br /&gt;
&lt;br /&gt;
Can be sped up by a factor of 10 BUT may result in corrupt files in case of hard OS crash where the dirty memory is not flushed to storage.&lt;br /&gt;
&lt;br /&gt;
Therefore it is advisable to use this feature only briefly and REMEMBER TO REMOVE IT! &lt;br /&gt;
&lt;br /&gt;
Email to support@neosys.com whenever using it or use personal notes not memory.&lt;br /&gt;
&lt;br /&gt;
nano /etc/postgresql/12/main/postgresql.conf&lt;br /&gt;
&lt;br /&gt;
Uncomment or add a line&lt;br /&gt;
 fsync = off&lt;br /&gt;
Restart postgres … will break any neosys/exodus running processes.&lt;br /&gt;
 r postgresql&lt;br /&gt;
or reload postgres may also work&lt;br /&gt;
&lt;br /&gt;
==Database Attach==&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
root@exodus:~/exodus/cli/src# dbattach&lt;br /&gt;
dbattach - Attach foreign database files to the current default database&lt;br /&gt;
&lt;br /&gt;
Syntax is dbattach TARGETDB [FILENAME,...] {OPTION...}&lt;br /&gt;
&lt;br /&gt;
Options:&lt;br /&gt;
&lt;br /&gt;
  F   Forcibly delete any normal files in the current default database.&lt;br /&gt;
&lt;br /&gt;
  R   Detach foreign files&lt;br /&gt;
  RR  Remove foreign database connection.&lt;br /&gt;
  RRR Remove all foreign database connections and attachments.&lt;br /&gt;
&lt;br /&gt;
  L   List attached foreign files in the current default database&lt;br /&gt;
&lt;br /&gt;
If no filenames are provided then a database connection is created.&lt;br /&gt;
This is *required* before filenames can be provided and attached.&lt;br /&gt;
&lt;br /&gt;
Notes:&lt;br /&gt;
&lt;br /&gt;
Attachments are permanent until re-attached or removed.&lt;br /&gt;
&lt;br /&gt;
Indexes on attached files behave strangely.&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Issues:&lt;br /&gt;
&lt;br /&gt;
TARGETDB must be on the same connection as the current default database.&lt;br /&gt;
&lt;br /&gt;
Current user must have access to the foreign database.&lt;br /&gt;
&lt;br /&gt;
If EXO_USER and EXO_PASS are not set then exodus defaults are used.&lt;br /&gt;
&lt;br /&gt;
exodus .config file is not used currently.&lt;/div&gt;</summary>
		<author><name>Gregory</name></author>
	</entry>
	<entry>
		<id>https://techwiki.neosys.com/index.php?title=EXODUS_Knowledge&amp;diff=3973</id>
		<title>EXODUS Knowledge</title>
		<link rel="alternate" type="text/html" href="https://techwiki.neosys.com/index.php?title=EXODUS_Knowledge&amp;diff=3973"/>
		<updated>2022-04-11T05:59:03Z</updated>

		<summary type="html">&lt;p&gt;Gregory: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==TMUX Screens==&lt;br /&gt;
&lt;br /&gt;
To create the EXODUS maintenance/programming environment&lt;br /&gt;
 exodus#: ./tmux.exodus&lt;br /&gt;
&lt;br /&gt;
===Screens===&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
0: /&lt;br /&gt;
    Work regarding exodus server. i.e /etc/nagios or general networking or /var/log/mail.log&lt;br /&gt;
&lt;br /&gt;
1: /root/exodus/&lt;br /&gt;
    Exodus core is installed Contains build and make libraries here ./libexodus&lt;br /&gt;
&lt;br /&gt;
2: /root/exodus/libexodus/exodus&lt;br /&gt;
    Core exodus (libraries that emulate the AREV system e.g mv.h )&lt;br /&gt;
    &lt;br /&gt;
3: /root/exodus/cli/src&lt;br /&gt;
    Exodus Command Line Interface e.g edir, edic, list, listfiles, delete, createdb&lt;br /&gt;
    &lt;br /&gt;
4: root/exodus/service&lt;br /&gt;
    EXODUS core default host directory but also contains scripts that create/manage requirements of a service (create_service, create_db, create_site, backup_db, restore_db, start, stop, status)&lt;br /&gt;
    One exception is NEOSYS www files are in ./www, which pulled from NEOSYS www git.&lt;br /&gt;
&lt;br /&gt;
5: /root/exodus/service/src&lt;br /&gt;
    Exodus core service programs (programs that are not related to NEOSYS agency operations and can be used to support other non-NEOSYS services) eg listen, usersubs, sendmail, openfile, select, sort, list,.&lt;br /&gt;
&lt;br /&gt;
    Extra info:    &lt;br /&gt;
    sql directory contains basic dictiorary files converted to sql instructions used when creating a EXODUS psql database&lt;br /&gt;
    e.g dict_voc.sql is a file that describes what to expect in certain fields of the voc file.&lt;br /&gt;
    TODO: compall currently throws few warnings. Read them and familiarise. In case new warnings appear, notify Steve.    &lt;br /&gt;
        &lt;br /&gt;
6: /root/neosys&lt;br /&gt;
    NEOSYS specific client installation management scripts e.g .doall, import_db and import_files (from AREV), ./run ./test (see below for these two commands)&lt;br /&gt;
    &lt;br /&gt;
7: /root/neosys/src&lt;br /&gt;
    NEOSYS Agency programs (see section How AREV programs are distributed in EXODUS src/*.cpp&lt;br /&gt;
    ../ has .git&lt;br /&gt;
&lt;br /&gt;
8: /root/hosts&lt;br /&gt;
    client specific files  e.g logs, images, (shared ./www -&amp;gt; root/exodus/service/www&lt;br /&gt;
&lt;br /&gt;
9: /root/exodus/test/src&lt;br /&gt;
    series of programs that test whether subroutines (specifically Exodus core libraries) work as they should eg for the var lib - &amp;quot;assert( var(&amp;quot;11111&amp;quot;).isnum());&amp;quot;&lt;br /&gt;
&lt;br /&gt;
10: bash /bin/top&lt;br /&gt;
    Monitor for NEOSYS client processes&lt;br /&gt;
    Displays customised format: sorted by total time spend and by processor time.&lt;br /&gt;
     Press &amp;quot;=&amp;quot; : to change to standard top format&lt;br /&gt;
     Press shift + w : to save format settings, replacing the old customised top format&lt;br /&gt;
     To go back to the customised format do:&lt;br /&gt;
        Press &amp;quot;o&amp;quot;&lt;br /&gt;
        Type &amp;quot;COMMAND=serve_agy&amp;quot;&lt;br /&gt;
        shift + t : this sorts by total time spent&lt;br /&gt;
        shift + p : this sorts by processor time&lt;br /&gt;
        shift + w : to save this setting and enter  &#039;y&#039; to confirm&lt;br /&gt;
&lt;br /&gt;
11: /var/log/syslog&lt;br /&gt;
     Log of NEOSYS client requests&lt;br /&gt;
&lt;br /&gt;
12: /root/exodus/service/quick&lt;br /&gt;
     Displays the last time the svr file (in /root/hosts/&amp;lt;client&amp;gt;/data/&amp;lt;dbname&amp;gt;) was updated.&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Object Code/Libraries==&lt;br /&gt;
LIVE and TEST processes use different sets of object code.&lt;br /&gt;
TEST processes use libraries in ~/lib/, whereas LIVE processes use object code in ~/neo/lib&lt;br /&gt;
&lt;br /&gt;
This means development &amp;amp; testing can be done stress free on TEST database, as opposed to testing on production databases.&lt;br /&gt;
&lt;br /&gt;
When compiling using edic, the TEST object code is updated if the compilation is successful. (~/lib)&lt;br /&gt;
In order to apply a tested patch to LIVE see [[Update LIVE programs]].&lt;br /&gt;
&lt;br /&gt;
==Dictionaries &amp;amp; Psql Functions==&lt;br /&gt;
&lt;br /&gt;
Dictionaries, data used to describe other data; specifically the fields of other files. &lt;br /&gt;
&lt;br /&gt;
There are three types of fields:&lt;br /&gt;
(F) field for raw data E.g &amp;quot;Office 44 Building Rush&amp;quot;&lt;br /&gt;
(S) symbolic or calculated E.g for total ans=field1+field2&lt;br /&gt;
(G) General, pending &lt;br /&gt;
&lt;br /&gt;
Dictionary files in Exodus are now stored in dat files.&lt;br /&gt;
&lt;br /&gt;
===Development and deployment using &#039;dat&#039; files===&lt;br /&gt;
&lt;br /&gt;
====Rationale====&lt;br /&gt;
&lt;br /&gt;
Part of system development is the creation of various data that is neither programs nor layout i.e. not cpp, h, html, js, php files etc.&lt;br /&gt;
&lt;br /&gt;
For example:&lt;br /&gt;
&lt;br /&gt;
*Dictionaries are data about data.&lt;br /&gt;
*Language files are data about text to use for various languages.&lt;br /&gt;
*“Change logs” are data about changes in the system.&lt;br /&gt;
&lt;br /&gt;
Historically, in EXODUS and NEOSYS, the above data has been deployed in exodus database files using SQL text files. However SQL files are not convenient for development.&lt;br /&gt;
&lt;br /&gt;
Therefore, &#039;dat&#039; text files will be used now so that standard development tools including editors and git can be fully exploited.&lt;br /&gt;
&lt;br /&gt;
====&#039;dat&#039; files====&lt;br /&gt;
&lt;br /&gt;
Each database file is represented by an os directory of the same name.&lt;br /&gt;
&lt;br /&gt;
Each record in the database file is represented by an os text file where filename is the primary key.&lt;br /&gt;
&lt;br /&gt;
For example a record with key &#039;&#039;&#039;DEADLINE&#039;&#039;&#039; in a dat file &#039;&#039;&#039;dict.materials&#039;&#039;&#039; would be represented as an os text file &#039;&#039;&#039;dat/dict.materials/DEADLINE&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Each line in the os text file represents one field in the db record. In other words, db record FM characters are represented by new line characters in &#039;dat&#039; files. Any actual new line characters required in the record, and any backslashes, are escaped and appear as &#039;\n&#039; and &#039;\\&#039; in &#039;dat&#039; files. Other database field separator characters such as VM, SM, TM and STM are stored without any conversion.&lt;br /&gt;
&lt;br /&gt;
====Location of dat files====&lt;br /&gt;
&lt;br /&gt;
The development versions are stored in exodus and neosys src/dat dirs. They form part of the standard git repositories in parallel with cpp files.&lt;br /&gt;
&lt;br /&gt;
The operational versions are stored in ~/dat and ~/live/dat alongside bin and lib dirs and are automatically installed into databases as database files on service startup. Any database functions embedded in the text files (pgsql) are also automatically installed at the same time.&lt;br /&gt;
&lt;br /&gt;
====Editing and deploying a &#039;dat&#039; file====&lt;br /&gt;
&lt;br /&gt;
It is currently a three step process to edit and deploy such &#039;dat&#039; files. &lt;br /&gt;
&lt;br /&gt;
=====Edit the &#039;dat&#039; file=====&lt;br /&gt;
&lt;br /&gt;
Note that EXODUS service and NEOSYS service have different src/dat folders.&lt;br /&gt;
&lt;br /&gt;
Editing language items:&lt;br /&gt;
&lt;br /&gt;
 edir dat/alanguage/SCHEDULES*ARABIC&lt;br /&gt;
&lt;br /&gt;
Editing a dictionary item:&lt;br /&gt;
&lt;br /&gt;
 edir dat/dict.materials/DEADLINE&lt;br /&gt;
&lt;br /&gt;
Editing a pgsql function in a dictionary:&lt;br /&gt;
&lt;br /&gt;
 edir dat/dict.materials/DEADLINE 8&lt;br /&gt;
&lt;br /&gt;
=====Copy all &#039;dat&#039; files to ~/dat =====&lt;br /&gt;
&lt;br /&gt;
This step might be removed at a later date.&lt;br /&gt;
&lt;br /&gt;
This will cause all test databases to immediately restart and load any &#039;dat&#039; file changes into dictionaries and data files and also create any new or modified pgsql functions.&lt;br /&gt;
&lt;br /&gt;
If any ~/neosys/src/dat files were edited:&lt;br /&gt;
&lt;br /&gt;
 cd ~/neosys/src&lt;br /&gt;
 &lt;br /&gt;
 ./compall dat&lt;br /&gt;
&lt;br /&gt;
and/or, if exodus/service/dat files were edited&lt;br /&gt;
&lt;br /&gt;
 cd ~/exodus/service/src&lt;br /&gt;
 &lt;br /&gt;
 ./compall dat&lt;br /&gt;
&lt;br /&gt;
=====Copy all programs and &#039;dat&#039; files to ~/live/bin|lib|dat=====&lt;br /&gt;
&lt;br /&gt;
This should only be run after testing. It will cause all live databases to automatically restart and do the same as the test databases mentioned above.&lt;br /&gt;
&lt;br /&gt;
 cd ~/exodus/service&lt;br /&gt;
 &lt;br /&gt;
 ./copyall CONFIRM&lt;br /&gt;
​&lt;br /&gt;
&lt;br /&gt;
===Psql unaccent extension===&lt;br /&gt;
The unaccent extension and the immutable_unaccent function are created in the db ‘template1’ during exodus installation while user is postgres which is a superuser.&lt;br /&gt;
&lt;br /&gt;
Thereafter all new databases are created as copies of template1 so they contain the extension and function&lt;br /&gt;
&lt;br /&gt;
==Processes==&lt;br /&gt;
The TEST process for all database use the same object code stored in /root/lib, whereas all LIVE process use the object code in /root/neo/.&lt;br /&gt;
&lt;br /&gt;
==Postgres==&lt;br /&gt;
Connect into postgres shell:&lt;br /&gt;
 alias psql=&#039;sudo -u postgres psql&#039;&lt;br /&gt;
&lt;br /&gt;
Delete a database:&lt;br /&gt;
 sudo -u postgres dropdb &amp;lt;dbcode&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Debugging Exodus==&lt;br /&gt;
&lt;br /&gt;
===Debugging Live/Test services===&lt;br /&gt;
&lt;br /&gt;
./test &amp;lt;dbname&amp;gt; - execute test programs on _test database.&lt;br /&gt;
&lt;br /&gt;
./run &amp;lt;dbname&amp;gt;  - execute test programs on live database.&lt;br /&gt;
&lt;br /&gt;
===Debugging var values===&lt;br /&gt;
&lt;br /&gt;
Explanation of var flag value in gdb debug mode.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
(gdb) p varx                                                           &lt;br /&gt;
$2 = {var_str = &amp;quot;&amp;quot;, var_int = 0, var_dbl = 0, var_typ = {flags_ = 2}}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Each exodus var object contains 3 variables of type string, int and double.&lt;br /&gt;
&lt;br /&gt;
All 3 may be unassigned or only the string be assigned or just the int and double e.t.&lt;br /&gt;
&lt;br /&gt;
You can tell which variable type of a var object are set based on the var&#039;s flag value.&lt;br /&gt;
&lt;br /&gt;
1 = Means the string is assigned&lt;br /&gt;
2 = Means the int is assigned&lt;br /&gt;
4 = Means the double is assigned&lt;br /&gt;
&lt;br /&gt;
Example: If the flag is 7 (1+2+4), then all types are assigned.&lt;br /&gt;
&lt;br /&gt;
===Process Hung or consuming +100% CPU===&lt;br /&gt;
If process is consuming +100% CPU then it is likely stuck in an infinite loop.&lt;br /&gt;
&lt;br /&gt;
 ./doall &amp;lt;CLIENT&amp;gt; stop&lt;br /&gt;
&lt;br /&gt;
 ./run &amp;lt;CLIENT&amp;gt; &lt;br /&gt;
&lt;br /&gt;
 ./test &amp;lt;CLIENT&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Search through recent logs for &amp;lt;CLIENT&amp;gt; looking for requests that didn&#039;t return OK at the time nagios alerted of Hung process.&lt;br /&gt;
&lt;br /&gt;
A user may also instigate the error again, so monitor the CLIENT&#039;s service CPU usage.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
If cause found recreate it in test and once test process hit +100% break in test debugger.&lt;br /&gt;
&lt;br /&gt;
If cause not found, you will have to continue checking logs for the request that caused it or hope a user recreates the issue in live debugged service.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Once you&#039;ve broken in the debugged with the error, enter &amp;quot;n&amp;quot; and hold the enter key until you just seeing line repeat.&lt;br /&gt;
&lt;br /&gt;
Pay attention to start of loops code. E.g WHILE or FOR. (there is likely an error is there)&lt;br /&gt;
&lt;br /&gt;
==./doall==&lt;br /&gt;
====General====&lt;br /&gt;
&lt;br /&gt;
~/neosys/doall [LIVE|TEST] &amp;lt;DBCODE|ALL&amp;gt; &amp;lt; ACTION [OPTIONS,..]  | bash -- COMMAND ]&lt;br /&gt;
&lt;br /&gt;
Example: &lt;br /&gt;
 ./doall TEST ALL create_site t-&lt;br /&gt;
Result:&lt;br /&gt;
Create site for ALL TEST databases, using domain name prefix option &amp;quot;t-&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Screen 6: ./doall script contains all the necessary information(codes) to setup an installation.&lt;br /&gt;
It includes scripts to backup, restore, create an Apache site, create/start/stop/status a service, import an AREV database into postgres and more.&lt;br /&gt;
&lt;br /&gt;
====backup_db====&lt;br /&gt;
&lt;br /&gt;
*Does a backup &amp;amp; restore of a LIVE database into the corresponding TEST database.&lt;br /&gt;
*Backup &amp;lt;dbcode&amp;gt;.sql file is written to /root/backups/sql; which is rsynced to nl19:/backups/current/exodus/&lt;br /&gt;
*Unlike AREV, postgres can perform a &amp;quot;backup&amp;quot; of a database whilst the system is in use.&lt;br /&gt;
&lt;br /&gt;
==Git==&lt;br /&gt;
&lt;br /&gt;
There are two repositories, one for EXODUS and the other for NEOSYS.&lt;br /&gt;
&lt;br /&gt;
===Using git to make changes===&lt;br /&gt;
&lt;br /&gt;
Before following steps you must have a tested updated to a program/file/script. Do not commit untested changes to avoid a messy git history of reverts.&lt;br /&gt;
&lt;br /&gt;
Update your local repo before committing to local repo using the g alias for &amp;quot;git pull --ff-only ; git push &amp;amp;&amp;amp; git status&#039;&amp;quot;:&lt;br /&gt;
&amp;lt;pre&amp;gt;g&amp;lt;/pre&amp;gt;&lt;br /&gt;
Check which updates/files have not yet been staged and/or committed:&lt;br /&gt;
Add your updates to the staged area:&lt;br /&gt;
&amp;lt;pre&amp;gt;git add &amp;lt;filename&amp;gt;&amp;lt;/pre&amp;gt;&lt;br /&gt;
or if all the changes made need to be staged:&lt;br /&gt;
&amp;lt;pre&amp;gt;git add -a&amp;lt;/pre&amp;gt;&lt;br /&gt;
Make a commit with a descriptive message on purpose of updates:&lt;br /&gt;
&amp;lt;pre&amp;gt;git commit -m &amp;lt;description n purpose of changes&amp;gt;&amp;lt;/pre&amp;gt;&lt;br /&gt;
Again use g alias:&lt;br /&gt;
&amp;lt;pre&amp;gt;g&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Other useful git cmds===&lt;br /&gt;
&lt;br /&gt;
Do not use this commands unless you know what WILL happen. &lt;br /&gt;
*git pull - Instead use the safe &amp;quot;git pull --ff-only&amp;quot;&lt;br /&gt;
Stick to the alias &amp;quot;g&amp;quot; which does &amp;quot;git pull --ff-only ; git push &amp;amp;&amp;amp; git status&#039;&amp;quot;&lt;br /&gt;
&lt;br /&gt;
*git log - display history of commits to master branch&lt;br /&gt;
*git diff - display the differences in files between working files and files in local repo.&lt;br /&gt;
*git status - display: which updated files are staged/not staged(tracked)&lt;br /&gt;
*git stash - &lt;br /&gt;
*git branch - switch to a new branch&lt;br /&gt;
*git branch &amp;lt;branchname&amp;gt; - will switch to this branch only if it exists&lt;br /&gt;
*git checkout - DESTROYS/Updates the state of local working directory with the state of the files in the local repo. (YOU WILL LOSE non staged updates)&lt;br /&gt;
*git restore &amp;lt;filename&amp;gt; - DESTROYS/Updates the file with the version in the local repo. (like with git checkout but for a specific file)&lt;br /&gt;
*git checkin - &lt;br /&gt;
*git revert &amp;lt;commitHash&amp;gt; - reverses a specific commit (use git log to get the chosen commit hash)&lt;br /&gt;
*git ..&lt;br /&gt;
&lt;br /&gt;
==Converting AREV programs to EXODUS==&lt;br /&gt;
===Decompile AREV to C++===&lt;br /&gt;
&lt;br /&gt;
Do in Master AREV Installation Maintenance mode: (win7)&lt;br /&gt;
&lt;br /&gt;
#ATTACH ADECOMC &lt;br /&gt;
#*ADECOM &amp;lt;programname&amp;gt;   *single program&lt;br /&gt;
#*ADECOM &amp;lt;prog1&amp;gt; &amp;lt;prog2&amp;gt; &lt;br /&gt;
#*ADECOMALL              *all programs   (CHECK FIRST)&lt;br /&gt;
&lt;br /&gt;
Include the option &amp;quot;(V)&amp;quot; in the command to print the C++ to a notepad, which can easily be copy and pasted.&lt;br /&gt;
&lt;br /&gt;
===Getting C++ program to Exodus Installation===&lt;br /&gt;
&lt;br /&gt;
Two methods: (use the first for one off programs)&lt;br /&gt;
&lt;br /&gt;
====Copy &amp;amp; Paste====&lt;br /&gt;
&lt;br /&gt;
Compile program and open source code in notepad&lt;br /&gt;
&lt;br /&gt;
 ADECOM &amp;lt;programname&amp;gt; (V)&lt;br /&gt;
&lt;br /&gt;
Find which directory the program belongs. e.g fin/med/job/sys e.t&lt;br /&gt;
&lt;br /&gt;
 find /cygdrive/d/exodus/pickos | grep &amp;lt;program name&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If cpp in SYS, the program belongs in ~/exodus/service/src OR if in MED JOB FIN GEN AGY the program belongs in ~/neosys/src&lt;br /&gt;
&lt;br /&gt;
Copy the source code in the text file from the first command.&lt;br /&gt;
&lt;br /&gt;
In Exodus, create a new .cpp (in correct directory) and paste the source code.&lt;br /&gt;
&lt;br /&gt;
Compile &amp;amp; Test&lt;br /&gt;
&lt;br /&gt;
====Rsync====&lt;br /&gt;
&lt;br /&gt;
 /d/exodus/arev/syncup.sh&lt;br /&gt;
&lt;br /&gt;
If cpp in SYS then: ~/exodus/service/src ./getpickos&lt;br /&gt;
&lt;br /&gt;
If cpp in MED JOB FIN GEN AGY then: *~/neosys/src&lt;br /&gt;
&lt;br /&gt;
===Compile C++ files to TEST system===&lt;br /&gt;
&lt;br /&gt;
#*./test &amp;lt;DBNAME&amp;gt;&lt;br /&gt;
#*~/neosys ./doall TEST &amp;lt;DBNAME&amp;gt; restart    #to get one service to start start using the new lib files&lt;br /&gt;
#*~/neosys ./doall TEST all restart         #to get all the services to start start using the new lib files&lt;br /&gt;
&lt;br /&gt;
===Install C++ files to LIVE System===&lt;br /&gt;
&lt;br /&gt;
#~/exodus/service/ ./copyall            #to copy all the ~/lib and bin files to ~/live/lib and bin ... which is used by all exodus/live services&lt;br /&gt;
&lt;br /&gt;
==Writing Standard Exodus Core Function/Method Testing==&lt;br /&gt;
Screen 9: ~/exodus/test/src/&lt;br /&gt;
There are a series of test programs that check whether methods/functions behave as intended.&lt;br /&gt;
They do this using the function, assert.. a 1 or more argument values produce one and only one output)&lt;br /&gt;
&lt;br /&gt;
e.g test_multilang.cpp or test_sort.cpp&lt;br /&gt;
&lt;br /&gt;
Two methods of running test programs:&lt;br /&gt;
*Screen 9: make test&lt;br /&gt;
*after compiling using edic/compile/c, enter test_prog_name. (Since compile has moved it to ~/bin)&lt;br /&gt;
&lt;br /&gt;
Difference between the two methods is make calls gdb directly;&lt;br /&gt;
whereas ~/bin/test_prog_name uses exodus compile program&lt;br /&gt;
#~/neosys ./doall LIVE all restart&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Upgrading Exodus==&lt;br /&gt;
&lt;br /&gt;
#Develop patch in Dev system &lt;br /&gt;
&lt;br /&gt;
===Single Patches===&lt;br /&gt;
&lt;br /&gt;
#Insert patches into various files and compile if necessary&lt;br /&gt;
#If patch dat files then run neosys compall to get dat files into ~/dat&lt;br /&gt;
*If Patsalides:&lt;br /&gt;
*#SITE_DIR=ptcy ./test basic  #requires /etc/systemd/system/agy_test@.service to have been patched like agy_live@.service&lt;br /&gt;
*#web login to BASIC_TEST to test&lt;br /&gt;
*If not patsalides&lt;br /&gt;
*#./test DBCODE&lt;br /&gt;
*#login to DBCODE and test&lt;br /&gt;
#If all ok&lt;br /&gt;
#./copyall &lt;br /&gt;
#CHECK what WILL be copied!&lt;br /&gt;
#Judge if really need to get people off (unlikely for typical patch) and request users to logout for 10 mins&lt;br /&gt;
#./copyall CONFIRM and CHECK what was copied is as per exceptions same as previous step&lt;br /&gt;
#./copyone could be used instead of copyall but it has no test mode and does not copy dat files&lt;br /&gt;
&lt;br /&gt;
===Upgrading to new version===&lt;br /&gt;
&lt;br /&gt;
Use when there are too many changes to do individually patches.&lt;br /&gt;
&lt;br /&gt;
#Inform clients.&lt;br /&gt;
#*Client hosted - Schedule a planned upgrade with client.&lt;br /&gt;
#*NEOSYS hosted - Inform all clients/users of planned morning upgrade, 24hours in advanced.      (TODO: &#039;What&#039;s New in NEOSYS&#039;) AND (emailallusers.cpp)&lt;br /&gt;
#If the morning&#039;s USB backup failed, do NOT continue upgrade procedure because if upgrade fails, we need a way to roll back system to last working state.&lt;br /&gt;
#Check upgrade works on test service using:/root/neosys/upgrade.all.sh test&lt;br /&gt;
#Check the latest patch is working.&lt;br /&gt;
#Run/root/neosys/upgrade.all.sh live&lt;br /&gt;
#Inform users their system has been upgraded and they can login.&lt;br /&gt;
&lt;br /&gt;
===Roll Back Upgrade===&lt;br /&gt;
&lt;br /&gt;
If for any reason the entire upgrade needs to be reverted (excludes clients database), follow steps below:&lt;br /&gt;
&lt;br /&gt;
#Inform users that there is a problem and services need to be stopped.&lt;br /&gt;
#Stop all exodus processes.&lt;br /&gt;
#Restore the morning&#039;s USB backup by: (Note this backup contains:  source/obj code, /etc, neosys scripts but not client data)&lt;br /&gt;
##Login into container&#039;s host and rsync the morning&#039;s usb backup to the container&#039;s /:&lt;br /&gt;
#*&amp;lt;pre&amp;gt;rsync --dry-run -avz -e &#039;ssh -p &amp;lt;C_SSHPORT&amp;gt;&#039; /backups/usb/&amp;lt;C_CODE&amp;gt; &amp;lt;C_CODE&amp;gt;:/      (Example: rsync --dry-run -avz -e &#039;ssh -p 19582&#039; /backups/usb/ad1 ad1:/&amp;lt;/pre&amp;gt;)&lt;br /&gt;
#Quick sane check, the latest git commit is not the latest git commit in the remote repo.&lt;br /&gt;
#Inform users they can login.&lt;br /&gt;
&lt;br /&gt;
==Configuring services to autostart during login==&lt;br /&gt;
For Ptcy.&lt;br /&gt;
&lt;br /&gt;
#Create a file &#039;autostart.cfg&#039; in the data folder &lt;br /&gt;
&lt;br /&gt;
 touch /root/hosts/&amp;lt;dbname&amp;gt;/data/autostart.cfg&lt;br /&gt;
&lt;br /&gt;
This will autostart a database service as long as at least one database service in that directory is running.&lt;br /&gt;
&lt;br /&gt;
For example, demo service will autostart during login if,&lt;br /&gt;
#/root/hosts/demo/data/autostart.cfg exists and&lt;br /&gt;
#demo_test service is running&lt;br /&gt;
&lt;br /&gt;
==Speedup postgresql importing databases==&lt;br /&gt;
&lt;br /&gt;
Can be sped up by a factor of 10 BUT may result in corrupt files in case of hard OS crash where the dirty memory is not flushed to storage.&lt;br /&gt;
&lt;br /&gt;
Therefore it is advisable to use this feature only briefly and REMEMBER TO REMOVE IT! &lt;br /&gt;
&lt;br /&gt;
Email to support@neosys.com whenever using it or use personal notes not memory.&lt;br /&gt;
&lt;br /&gt;
nano /etc/postgresql/12/main/postgresql.conf&lt;br /&gt;
&lt;br /&gt;
Uncomment or add a line&lt;br /&gt;
 fsync = off&lt;br /&gt;
Restart postgres … will break any neosys/exodus running processes.&lt;br /&gt;
 r postgresql&lt;br /&gt;
or reload postgres may also work&lt;br /&gt;
&lt;br /&gt;
==Database Attach==&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
root@exodus:~/exodus/cli/src# dbattach&lt;br /&gt;
dbattach - Attach foreign database files to the current default database&lt;br /&gt;
&lt;br /&gt;
Syntax is dbattach TARGETDB [FILENAME,...] {OPTION...}&lt;br /&gt;
&lt;br /&gt;
Options:&lt;br /&gt;
&lt;br /&gt;
  F   Forcibly delete any normal files in the current default database.&lt;br /&gt;
&lt;br /&gt;
  R   Detach foreign files&lt;br /&gt;
  RR  Remove foreign database connection.&lt;br /&gt;
  RRR Remove all foreign database connections and attachments.&lt;br /&gt;
&lt;br /&gt;
  L   List attached foreign files in the current default database&lt;br /&gt;
&lt;br /&gt;
If no filenames are provided then a database connection is created.&lt;br /&gt;
This is *required* before filenames can be provided and attached.&lt;br /&gt;
&lt;br /&gt;
Notes:&lt;br /&gt;
&lt;br /&gt;
Attachments are permanent until re-attached or removed.&lt;br /&gt;
&lt;br /&gt;
Indexes on attached files behave strangely.&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Issues:&lt;br /&gt;
&lt;br /&gt;
TARGETDB must be on the same connection as the current default database.&lt;br /&gt;
&lt;br /&gt;
Current user must have access to the foreign database.&lt;br /&gt;
&lt;br /&gt;
If EXO_USER and EXO_PASS are not set then exodus defaults are used.&lt;br /&gt;
&lt;br /&gt;
exodus .config file is not used currently.&lt;/div&gt;</summary>
		<author><name>Gregory</name></author>
	</entry>
	<entry>
		<id>https://techwiki.neosys.com/index.php?title=Troubleshooting_NEOSYS_Finance_System&amp;diff=3972</id>
		<title>Troubleshooting NEOSYS Finance System</title>
		<link rel="alternate" type="text/html" href="https://techwiki.neosys.com/index.php?title=Troubleshooting_NEOSYS_Finance_System&amp;diff=3972"/>
		<updated>2022-03-23T09:10:16Z</updated>

		<summary type="html">&lt;p&gt;Gregory: /* Fixing &amp;quot;Cross Check Balance&amp;quot; warnings using CHK.ALLOC */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Using Finance Maintenance Mode fixing tools==&lt;br /&gt;
&amp;lt;div style=&amp;quot;color:red&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Follow the instructions below before you proceed with fixing CCB errors with any check/fix:&lt;br /&gt;
&lt;br /&gt;
Do not do mass fixes eg “Add/Delete ALL xyz” options from a year in the past eg 2007 while only checking accounts for 2009. You must CHECK EVERYTHING THAT YOU REQUEST TO BE FIXED.&lt;br /&gt;
&lt;br /&gt;
The various fixing tools like CHK.ALLOC etc are impossible to make safe in all circumstances so if you don’t really know what you are doing you assume the WORST not the BEST with these fixing tools. &lt;br /&gt;
&lt;br /&gt;
&#039;&#039;CHECK EVERYTHING YOU “FIX”!!!&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Do not go back risking fixes in prior years for which Finance has been closed, unless absolutely necessary.&lt;br /&gt;
&lt;br /&gt;
While checking/fixing a CCB error, check and fix any other errors if present to avoid CCB&#039;s in future.&lt;br /&gt;
&lt;br /&gt;
After doing check/fixes, all accounts should be tested for cross check balance errors. Do this by taking ledger printout for the whole year for all accounts.&lt;br /&gt;
&lt;br /&gt;
IF YOU DO NOT FOLLOW INSTRUCTIONS CAREFULLY YOU CAN END UP MODIFYING AUDITED ACCOUNTS AND IT WILL TAKE DAYS FOR PROGRAMMERS TO TRY AND CORRECT THE DAMAGE YOU CAUSE OR EVEN REQUIRE A RESTORE OF A BACKUP CAUSING LOSS OF MANY DAYS WORK TO THE CLIENT&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Cross-Year Cross Check Balance Warnings==&lt;br /&gt;
&lt;br /&gt;
When you use Opening Balance Journals, NEOSYS does not guarantee that the opening balances of one year match the closing balance of a prior year. This occurs quite normally and commonly occurs in the situations described below.&lt;br /&gt;
&lt;br /&gt;
Regardless of the cause, in such cases, any statement or ledger account of movements (not open items) that crosses the disjoint years will have a &amp;quot;cross check balance&amp;quot; note at the bottom of the account. A cross check balance warning is just a warning that the closing balance of the account (as calculated from a simple total of the opening balance in the old year plus all transactions) does not agree with the actual account balance according to the trial balance in the new year.&lt;br /&gt;
&lt;br /&gt;
If the opening balance of the account in the second year is not equal to the closing balance in the prior year then logically the two years cannot be viewed as a single continuous account and agree with the trial balance.&lt;br /&gt;
&lt;br /&gt;
===Posting into years prior to Opening Balance===&lt;br /&gt;
&lt;br /&gt;
When you start up a company in one year using Opening Balance Journals then the closing balances of the prior years remain zero. If you thereafter start to post into prior years, the closing balances of those years will remain in disagreement with the opening balance of the following years.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Solution&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
If you wish to obtain cross-year accounts between years, and you wish such account&#039;s balances to agree with the later year trial balance, then you must arrange for the closing balances of the prior years to agree with the opening balances of the following years.&lt;br /&gt;
&lt;br /&gt;
To do this, ensure that any Opening Balance Journals that are posted into any particular year are also posted into all prior financial years of interest, or better, post them directly into the earliest year and any following years will automatically be updated as normal.&lt;br /&gt;
&lt;br /&gt;
===Opening Balance Journals===&lt;br /&gt;
&lt;br /&gt;
If you post Opening Balance Journals into one year for any reason, they are not posted into prior years. Therefore the opening balances of the amended year become different from the prior year.&lt;br /&gt;
&lt;br /&gt;
In this respect, auditors amendments to opening balances should be posted as normal journals in the final period of the prior year and not as Opening Balance Journals in the current year.&lt;br /&gt;
&lt;br /&gt;
===Producing Historical Accounts===&lt;br /&gt;
&lt;br /&gt;
As mentioned above, if you post Opening Balance Journals into one year, they are not posted into prior years. For such accounts, NEOSYS will show Cross Check Balance warning if you take a ledger account or statement of account report across multiple years including years prior to the Opening Balance Journal posting. e.g. if an account has opening balance entry in 2011, and no entries in 2010, then ledger account report with period setting 2010 - 2018 will show Cross Check Balance warning.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Solution&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
To avoid this Cross Check Balance warning, in the report period settings exclude years prior to the Opening Balance Journal posting, since the account anyway has no entries in the prior years.&lt;br /&gt;
&lt;br /&gt;
=== Producing P&amp;amp;L and Retained Earnings Accounts ===&lt;br /&gt;
Refer to [https://userwiki.neosys.com/index.php/Troubleshooting_NEOSYS_Finance_System#Cross_Check_Balance_error_on_all_Profit_and_Loss_accounts_and_Retained_Earnings_account CCB on P&amp;amp;L and Retained Earnings accounts]&lt;br /&gt;
&lt;br /&gt;
==Fixing &amp;quot;Cross Check Balance&amp;quot; warnings using CHK.ALLOC==&lt;br /&gt;
&lt;br /&gt;
Cross Check Balance Message on an account means the total of the outstanding items in an account does not match the balance as in the movement - typically the outstanding shows a higher balance than the balance in the movement, but might not always be the case. The reasons why this may happen is because of the following:&lt;br /&gt;
&lt;br /&gt;
*Reposting journals containing allocated items (which NEOSYS doesnt handle in all circumstances)&lt;br /&gt;
*Failing to clear open item accounts on a regular basis where the number of postings is high&lt;br /&gt;
&lt;br /&gt;
This procedure only applies to CCB on the outstanding item type statements which are the more common problem. CCB on movement accounts are rarer, more serious and cannot be fixed by this procedure.&lt;br /&gt;
&lt;br /&gt;
This might not always fix the CCB warnings and hence you will need to escalate to the programmer.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
!!! WARNING !!!&lt;br /&gt;
&lt;br /&gt;
This is a dangerous procedure. &lt;br /&gt;
IF YOU DO NOT FOLLOW INSTRUCTIONS CAREFULLY YOU CAN END UP MODIFYING AUDITED ACCOUNTS AND AUDITORS/ACCOUNTANTS AND IT WILL TAKE DAYS FOR PROGRAMMERS TO TRY AND CORRECT THE DAMAGE YOU CAUSE!&lt;br /&gt;
&lt;br /&gt;
DO THIS ON TESTDATA FIRST&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This can be run while other users are online.&lt;br /&gt;
&lt;br /&gt;
While running the command, monitor the lines coming up on the screen for any warnings. In case you make any changes and select &amp;quot;Yes&amp;quot; or &amp;quot;Yes to all&amp;quot; for any message, you should re run the command again until clean.&lt;br /&gt;
&lt;br /&gt;
This exact procedure restores vouchers missing from open item accounts:&lt;br /&gt;
&lt;br /&gt;
*Exodus TEST Database&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
1. /root/neosys/test &amp;lt;DBCODE&amp;gt;&lt;br /&gt;
2. After startup press &amp;quot;x&amp;quot; key.&lt;br /&gt;
3. Type: &amp;quot;chkalloc&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
*Exodus LIVE Database&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
1. Stop all LIVE processes. (pressing x won&#039;t return prompt to enter check command if other LIVE processes running)&lt;br /&gt;
2. Run /root/neosys/run &amp;lt;DBCODE&amp;gt;&lt;br /&gt;
3. After startup press &amp;quot;x&amp;quot; key.&lt;br /&gt;
4. Type: &amp;quot;chkalloc&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
*AREV Both LIVE and TEST databases&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 F5&lt;br /&gt;
 UTIL (nothing happens at this stage as its a background process and gives you access to the next command)&lt;br /&gt;
 CHK.ALLOC&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 Minimum voucher year.period?&lt;br /&gt;
&lt;br /&gt;
Generally go back as little as possible to cover vouchers that might be missing from O/I accounts.&lt;br /&gt;
&lt;br /&gt;
 Which account do you want or blank for all?&lt;br /&gt;
&lt;br /&gt;
You MUST search for all accounts. Entering one account WILL NOT WORK since it will only check vouchers already on the open item accounts and we are looking for those that are missing.&lt;br /&gt;
&lt;br /&gt;
IGNORE OR RESPOND NEGATIVELY to all messages or questions EXCEPT the following:&lt;br /&gt;
&lt;br /&gt;
 Missing from O/I index?&lt;br /&gt;
&lt;br /&gt;
Select &amp;quot;Yes&amp;quot; or &amp;quot;Yes to all&amp;quot;&lt;br /&gt;
&lt;br /&gt;
===Meaning of other messages===&lt;br /&gt;
&lt;br /&gt;
1. The following message pair does not usually cause cross check balances and indicates that they have cancelled some foreign currency allocation since allocation should not cause and change in rate.&lt;br /&gt;
&lt;br /&gt;
 IN*175510*C 20/01/08 ALMA 4/2 REC*4440*C allocation base outstanding -7326.15 expected -6762.60 (-563.550,.08333333)&lt;br /&gt;
 IN*175510*C 20/01/08 ALMA 4/2 REC*4440*C allocation changed exchange rate from .08333333 to .07692308&lt;br /&gt;
&lt;br /&gt;
2. For the following message, you MUST choose &amp;quot;Leave all&amp;quot; , otherwise risk damage to closed audited prior year accounts:&lt;br /&gt;
&lt;br /&gt;
 Account numbers do not agree. Delete the allocation?&lt;br /&gt;
&lt;br /&gt;
3. For the following message, choose &amp;quot;Add it to other voucher&amp;quot; ONLY for the voucher/account that needs fixing. Do not choose &amp;quot;Add all&amp;quot; unless you know each and every allocation that will be added, as it could cause problems such as allocating to vouchers that are already allocated i.e. causing double allocations. You MUST check everything that you request to be fixed.&lt;br /&gt;
&lt;br /&gt;
 Allocation is missing ?&lt;br /&gt;
&lt;br /&gt;
4. For the following message, choose &amp;quot;Skip further Warnings&amp;quot;:&lt;br /&gt;
&lt;br /&gt;
 Amounts do not agree - please fix manually&lt;br /&gt;
&lt;br /&gt;
===Re-enabling CCB warning mail notifications===&lt;br /&gt;
NEOSYS is pre-configured to send out email notifications (to the same group of people who receive the backup alerts) when a Cross Check Balance (CCB) warning is found for the first time on an account. That means there will be only 1 email notification irrespective of the times the warning occurs until it is fixed.&lt;br /&gt;
&lt;br /&gt;
After the CCB is fixed or after clearing or otherwise eliminating the same, you need to delete the CCB file in D:\neosys\neosys to re-enable NEOSYS to resend notification by email after it discovers CCB warnings on that account again in the future.&lt;br /&gt;
&lt;br /&gt;
==Fixing &amp;quot;Cross Check Balance&amp;quot; warning using CHK.VINDEX==&lt;br /&gt;
&lt;br /&gt;
YOU MUST READ AND APPLY THE GENERAL INSTRUCTIONS WRITTEN FOR CHK.ALLOC AS WELL FOR CHK.VINDEX&lt;br /&gt;
&lt;br /&gt;
This program can fix a few CCB warnings that CHK.ALLOC cannot - including some in balance forward type accounts (ie not open item/outstanding item accounts) .&lt;br /&gt;
&lt;br /&gt;
Not all the possible fixes are described here and any messages which are not described here should be responded to NEGATIVELY!&lt;br /&gt;
&lt;br /&gt;
CCB error for [http://userwiki.neosys.com/index.php/Troubleshooting_NEOSYS_Finance_System#Fixing_Error:_.22A.2Fc._.3F.3F.3F.22_message_in_account_of_outstanding_items Wrong A/C] can be fixed by running CHK.VINDEX&lt;br /&gt;
&lt;br /&gt;
===Different account - Delete the index entry?===&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
  &amp;quot;*MEVEJ*FZ&amp;quot;  L=232 V=REC*461*FZ 05/07/09 B=447 &amp;quot;MEVEJ&amp;quot;&lt;br /&gt;
  different account &amp;quot;ADVOPME&amp;quot;&lt;br /&gt;
                     Delete the index entry?&lt;br /&gt;
───┬─────────────────────────────────────────────────────────────&lt;br /&gt;
  1&amp;gt;No&lt;br /&gt;
  2│None&lt;br /&gt;
  3│Yes&lt;br /&gt;
  4│All&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Select Yes.&lt;br /&gt;
&lt;br /&gt;
===Missing Voucher - Delete the index entry?===&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
╔═════════════════════════════════════════════════════════════════╗&lt;br /&gt;
║  &amp;quot;*VIV*N&amp;quot;  L=458 V=IN*2012/1170*N 29/05/12 missing voucher      ║&lt;br /&gt;
║                     Delete the index entry?                     ║&lt;br /&gt;
║───┬─────────────────────────────────────────────────────────────║&lt;br /&gt;
║  1&amp;gt;No                                                           ║&lt;br /&gt;
║  2│Yes                                                          ║&lt;br /&gt;
║  3│None                                                         ║&lt;br /&gt;
║  4│All                                                          ║&lt;br /&gt;
╚═════════════════════════════════════════════════════════════════╝&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Select Yes.&lt;br /&gt;
&lt;br /&gt;
===Different Date - Correct index entry?===&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;quot;*OMD*AP&amp;quot;  L=115 V=IN*2013/350*AP 31/03/13 B=1159&lt;br /&gt;
  different date &amp;quot;14/03/13&amp;quot;&lt;br /&gt;
                     Correct index entry?&lt;br /&gt;
───┬─────────────────────────────────────────────────────────────&lt;br /&gt;
  1&amp;gt;No&lt;br /&gt;
  2│Yes&lt;br /&gt;
  3│Correct None&lt;br /&gt;
  4│Correct All&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Select Yes.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Checking if a voucher is fully posted==&lt;br /&gt;
&lt;br /&gt;
Sometimes due to some kind of system error a batch is not fully posted then one voucher in the batch may be half-posted. Any remaining vouchers in the batch (after/below) will almost certainly be completely unposted.&lt;br /&gt;
&lt;br /&gt;
To see if this has happened, first identify which voucher is problematic and then check if the first and last lines of the voucher are correctly posted by seeing if the voucher appears in their respective ledger accounts.&lt;br /&gt;
&lt;br /&gt;
===First line is not posted===&lt;br /&gt;
&lt;br /&gt;
If the first line does not appear then probably the whole voucher is not posted at all.&lt;br /&gt;
&lt;br /&gt;
Reposting the voucher may successfully solve the problem but see [http://techwiki.neosys.com/index.php/Troubleshooting_NEOSYS_Finance_System#Reposting_a_Batch_in_Journal_Entry Reposting a batch] and [http://techwiki.neosys.com/index.php/Troubleshooting_NEOSYS_Finance_System#Fixing_.22Cross_Check_Balance.22_warnings_using_CHK.ALLOC Cross Check Balance] to avoid potential issues in reposting.&lt;br /&gt;
&lt;br /&gt;
===Last line is not posted===&lt;br /&gt;
&lt;br /&gt;
If the first line appears but the last line does not appear as posted in its ledger account then the voucher is &amp;quot;HALF POSTED&amp;quot;. This breaks the all important law of double entry accounting and the trial balance will not balance.&lt;br /&gt;
&lt;br /&gt;
Reposting the voucher will not solve the problem because the system does not take into account that the voucher is half posted when it is reversing the original voucher during the repost.&lt;br /&gt;
&lt;br /&gt;
===First and last lines are posted===&lt;br /&gt;
&lt;br /&gt;
In the case there is no problem. The voucher is fully posted and the half-posted issue is not present&lt;br /&gt;
&lt;br /&gt;
==Voucher number missing from posted batches==&lt;br /&gt;
&lt;br /&gt;
In some cases voucher numbers are missing from posted batches.&lt;br /&gt;
&lt;br /&gt;
There could be several reasons why the voucher numbers are missing. The voucher number is generated but does not reflect on the batch or the voucher number did not get generated at the time of posting.  We are still investigating the root cause to this problem.&lt;br /&gt;
&lt;br /&gt;
For both cases, take a ledger print out for the account the voucher number is missing and check if the voucher number is present in the ledger print out.&lt;br /&gt;
&lt;br /&gt;
===1. The entries in the batch reflect on the ledger print===&lt;br /&gt;
&lt;br /&gt;
If the entries reflect in the ledger print out, open the voucher file and investigate why the voucher number did not appear when the batch was posted.&lt;br /&gt;
&lt;br /&gt;
The voucher numbers will appear in the batch when the batch is re-saved. The same voucher numbers appears as it was in the voucher file.&lt;br /&gt;
&lt;br /&gt;
===2. The entry in the batch does not reflect on the ledger print===&lt;br /&gt;
&lt;br /&gt;
If the voucher file is not present in the ledger print out, open the batch and investigate why the voucher number did not generate when the batch was posted.&lt;br /&gt;
&lt;br /&gt;
The voucher numbers will be generated when the batch is re-saved but not in sequence number. Notify clients the batches are re-saved and the voucher number will not be in sequence.&lt;br /&gt;
&lt;br /&gt;
===Solution===&lt;br /&gt;
&lt;br /&gt;
Run CHK.VOUCHERS and check for errors. Then re-save the batch.&lt;br /&gt;
&lt;br /&gt;
The authorisation to re-save a batch is restricted to NEOSYS and a few client users at the moment. &lt;br /&gt;
&lt;br /&gt;
====Running CHK.VOUCHERS====&lt;br /&gt;
Run the following command in maintenance mode and check for errors. &lt;br /&gt;
 &lt;br /&gt;
 F5&lt;br /&gt;
 UTIL&lt;br /&gt;
 CHK.VOUCHERS  &lt;br /&gt;
&lt;br /&gt;
When running CHK.VOUCHERS, respond to prompts as shown below. Generally respond negatively to prompts which are not specified below, but in TEST datasets you can experiment by responding positively.&lt;br /&gt;
&lt;br /&gt;
Choose &amp;quot;Yes&amp;quot; for the following message:&lt;br /&gt;
&lt;br /&gt;
  Missing from batch but matching ref with no voucher can be found. Add it?&lt;br /&gt;
&lt;br /&gt;
Choose &amp;quot;No&amp;quot; for the following message:&lt;br /&gt;
&lt;br /&gt;
  Delete empty unposted / deleted voucher ?&lt;br /&gt;
&lt;br /&gt;
Choose &amp;quot;Yes or All&amp;quot; for the following message:&lt;br /&gt;
&lt;br /&gt;
  Account “ XYZ” type is “ COST” , but the voucher analysis code “28*1*COMPANYCODE*XYZ” is type “ BILL/INCOME” . &lt;br /&gt;
  Fix voucher analysis code to be COST and repost? :----  YES/ALL&lt;br /&gt;
&lt;br /&gt;
Choose &amp;quot;All&amp;quot; for the following message. This is to keep the file &amp;quot;clean&amp;quot; of messages but does not actually cause any changes in the rest of the system. &lt;br /&gt;
&lt;br /&gt;
 Account &amp;quot;XYZ&amp;quot; is &amp;quot;JOBS&amp;quot;, but the voucher analysis code &amp;quot;28*1*clientcode**marketcode*suppliercode*mediatypecode&amp;quot; is &amp;quot;MEDIA&amp;quot;&lt;br /&gt;
 Fix voucher analysis code is to be JOBS and repost?&lt;br /&gt;
&lt;br /&gt;
After doing check/fix, all accounts should be tested for cross check balance errors. Do this by taking ledger printout for the whole year for all accounts.&lt;br /&gt;
&lt;br /&gt;
==[http://userwiki.neosys.com/index.php/Troubleshooting_NEOSYS_Finance_System#Why_does_an_outstanding_not_appear_while_taking_a_ledger_printout Fixing CCB errors that do not get fixed with CHK.ALLOC, CHK.VINDEX or CHK.VOUCHERS]==&lt;br /&gt;
&lt;br /&gt;
==Using CHK.POST to fix some types of Cross Check Balance (CCB) errors==&lt;br /&gt;
&lt;br /&gt;
CHK.POST can be used to fix/recreate the BALANCES files. This could be useful in the following cases:&lt;br /&gt;
&lt;br /&gt;
#Some stubborn Cross Check Balance errors&lt;br /&gt;
#BALANCES file is damaged (use [[Handling_damaged_files#Using_FIXFILE_to_repair_corrupted_files|FIXFILE]] first)&lt;br /&gt;
&lt;br /&gt;
Use it strictly only after ALL other errors have been fixed using the usual CHK programs&lt;br /&gt;
&lt;br /&gt;
*CHK.VOUCHERS&lt;br /&gt;
*CHK.VINDEX&lt;br /&gt;
*CHK.ALLOC&lt;br /&gt;
*CHK.BATCHES&lt;br /&gt;
*CHK.BALANCES&lt;br /&gt;
*CHK.ACCOUNTS&lt;br /&gt;
*CHK.CHARTS&lt;br /&gt;
*CHK.CONTROLS&lt;br /&gt;
*CHK.OB (As of 12/2/19: Only Bates and AdlineD can parameters be entered in UI, whereas in TEST and other clients, editing of program code must be done to tailor the program to check what you want. E.g a period)&lt;br /&gt;
&lt;br /&gt;
[[Troubleshooting_NEOSYS_Finance_System#Check_steps_of_each_CHK_program|What checks are performed on in each CHK routine]]&lt;br /&gt;
&lt;br /&gt;
This program adjusts the balances in the trial balance reports (which also show in the “Cross Check Balance phrase on the Detailed Ledger Accounts) to match the vouchers found in the voucher file. Note that CHK.ALLOC and CHK.VINDEX have no effect on these figures and instead amend the transactions shown on the Detailed Ledger Account - and thereby the totals on the same report so that they agree with the CCB amount and thereby the conflict is resolved.&lt;br /&gt;
&lt;br /&gt;
Most CCB in NEOSYS are related to problems on outstanding item accounts and are fixed with the CHK.ALLOC program. More rarely, problems occur in the movement accounts and are fixed with the CHK.VINDEX program - although this can also fix some errors in outstanding item statements. Even more rarely will the problem be on the Trial Balances/CCB balances and can be fixed with this CHK.POST procedure&lt;br /&gt;
&lt;br /&gt;
WARNING! This solution may make things worse so don’t use on live data unless EXHAUSTIVELY checked that everything is ok on test data first.&lt;br /&gt;
&lt;br /&gt;
WARNING! Don’t go back and “correct” previous years which have been closed because auditors expect them never to change (EVEN IF THEY ARE WRONG!) and it can be impossible to put them back “wrong” if you “correct” them.&lt;br /&gt;
&lt;br /&gt;
WARNING! If you correct previous years then you must [[Troubleshooting_NEOSYS_Finance_System#Redo_Open_New_Year_procedure| rerun the Open New Year procedure]] for all prior years.&lt;br /&gt;
&lt;br /&gt;
#In maintenance mode press Alt+1&lt;br /&gt;
#Enter the range of periods that you want to check/adjust the trial balance for e.g. 1/9-7/9 for 1st Period of 2009 up to the 7th period of 2009.&lt;br /&gt;
#Press F9 and Esc&lt;br /&gt;
#Press F5 and type CHK.POST&lt;br /&gt;
#What stage to start at? Choose “Select Vouchers”&lt;br /&gt;
#Clear the updated balances file? Choose “Clear it”&lt;br /&gt;
#OK to Start? … OK&lt;br /&gt;
#If there are any discrepancies found between the Trial Balance Balances/CCB balances … and the Vouchers in the file you will get some fairly cryptic questions asking you, one by one, if you want to fix the balances.&lt;br /&gt;
&lt;br /&gt;
IMPORTANT&lt;br /&gt;
&lt;br /&gt;
#It is advised that you only fix the balances which refer to the accounts that you are concerned about. You will find the account number buried in the cryptic questions referred to above.&lt;br /&gt;
#If you fix subsidiary account balances then MAKE SURE that you also fix the control accounts balances (if you are prompted).&lt;br /&gt;
&lt;br /&gt;
==B10 &amp;amp; B12 Errors==&lt;br /&gt;
&lt;br /&gt;
The error might be displayed as follows :&lt;br /&gt;
&lt;br /&gt;
 ERROR NO: B10 IN DAYBOOK.SUBSX AT 133&lt;br /&gt;
 Variable has not been assigned a value. Zero used.&lt;br /&gt;
&lt;br /&gt;
This error should have said something like : &amp;quot;The ledgers are closed up to the period you have just tried to post&amp;quot; OR &amp;quot;Financial Year 2011 must be opened before you post into it.&amp;quot; &lt;br /&gt;
&lt;br /&gt;
Try again and you would see the exact message if you have not opened the new year as yet.&lt;br /&gt;
&lt;br /&gt;
==Fixing &amp;quot;Index has been deleted&amp;quot; message==&lt;br /&gt;
&lt;br /&gt;
===Error Message===&lt;br /&gt;
&lt;br /&gt;
 The index record &amp;quot;TEXT.XREF*abc*xyz&amp;quot;&lt;br /&gt;
 has been deleted.&lt;br /&gt;
 The index for &amp;quot;TEXT.XREF&amp;quot;&lt;br /&gt;
 should be rebuilt.&lt;br /&gt;
&lt;br /&gt;
===Solution===&lt;br /&gt;
&lt;br /&gt;
[http://techwiki.neosys.com/index.php/Handling_damaged_files#Fixing_damaged_index_files_.28names_starting_with_.21.29 Perform REINDEXVOUCHERS in maintenance mode].&lt;br /&gt;
&lt;br /&gt;
==Reposting a Batch in Journal Entry==&lt;br /&gt;
The authorisation to repost a batch is restricted to NEOSYS and a few client users at the moment. Reposting a batch will repost all the vouchers in the batch.&lt;br /&gt;
&lt;br /&gt;
See [http://userwiki.neosys.com/index.php/Troubleshooting_NEOSYS_Finance_System#Correcting_mistakes_in_postings Correcting mistakes in postings] for NEOSYS policy for correcting mistakes in journal postings.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;b&amp;gt;Warning&amp;lt;/b&amp;gt;: Reposting journals which are already allocated will create cross check balance errors, so before reposting, any allocations should be de-allocated to avoid these errors.&lt;br /&gt;
&lt;br /&gt;
Reposting a batch should be done in TEST dataset first. After reposting, all accounts should be tested for cross check balance errors. Do this by taking ledger printout for the whole year for all accounts.&lt;br /&gt;
&lt;br /&gt;
See [[Procedures#Amending.2FReposting_Journal_Entries|Procedure for Reposting Journal Entries]]&lt;br /&gt;
&lt;br /&gt;
To repost a batch, edit the journal on the Journal Entry/Query page and save. Click OK for the prompt “OK to repost now?”.&lt;br /&gt;
==Editing and Reposting Vouchers==&lt;br /&gt;
&lt;br /&gt;
WARNING: Can cause effectively irreversible damage to the finance database requiring restoration of a suitable backup causing loss of data and/or total loss of database if backup not available.&lt;br /&gt;
&lt;br /&gt;
It is almost impossible to edit and repost vouchers and keep the audit trail correct so this procedure is of limited use. The stages are UNPOST, EDIT, REPOST.&lt;br /&gt;
&lt;br /&gt;
Must be done on test data and advisable to run CHK.VOUCHERS afterwards.&lt;br /&gt;
&lt;br /&gt;
===UNPOST===&lt;br /&gt;
 F5&lt;br /&gt;
 UNPOST XXX*YYYYY*ZZZ&lt;br /&gt;
&lt;br /&gt;
Where:&lt;br /&gt;
&lt;br /&gt;
*XXX is the voucher type/journal code&lt;br /&gt;
*YYY is the voucher number&lt;br /&gt;
*ZZZ is the company code&lt;br /&gt;
&lt;br /&gt;
Any problems with the voucher might generate messages but the problems will be reverse the problems which must have occurred when posting the voucher in the first place.&lt;br /&gt;
&lt;br /&gt;
===EDIT===&lt;br /&gt;
 F5&lt;br /&gt;
 ED VOUCHERS XXX*YYYYY*ZZZ&lt;br /&gt;
&lt;br /&gt;
For example, if due to a neosys system error, the ZZZ999 suspense account has been used instead of some missing internal system accounts like exchange gain/loss accounts then you can insert the correct account.&lt;br /&gt;
&lt;br /&gt;
Change line 8 (which contains the account numbers) from:&lt;br /&gt;
&lt;br /&gt;
 REZO²REZO²BMDI²BMDI²²&lt;br /&gt;
&lt;br /&gt;
to&lt;br /&gt;
&lt;br /&gt;
 REZO²REZO²BMDI²BMDI²EXDI²EXDI&lt;br /&gt;
&lt;br /&gt;
where EXDI is the ORIGINAL A/c No. of the Exchange Difference A/c.&lt;br /&gt;
&lt;br /&gt;
F9, ESC to save and exit&lt;br /&gt;
&lt;br /&gt;
===REPOST===&lt;br /&gt;
&lt;br /&gt;
 F5&lt;br /&gt;
 REPOST XXX*YYYYY*ZZZ&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Removing strange outstanding items on accounts that have balance of zero==&lt;br /&gt;
&lt;br /&gt;
Sometimes running CHK.ALLOC on periods too far back in time causes old items to be incorrectly resurrected and become outstanding.&lt;br /&gt;
&lt;br /&gt;
If the account balance is zero in the current period and has been for some years then you can simply delete all outstanding items.&lt;br /&gt;
&lt;br /&gt;
Assuming the (original) account number is AAAA and the company code is CC, in maintenance mode, F5.&lt;br /&gt;
&lt;br /&gt;
 DELETE VOUCHER.INDEX *AAAA*CC&lt;br /&gt;
&lt;br /&gt;
It should say &amp;quot;1 Item(s) deleted&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Reinstating Open Item Statements after Clear Open Items==&lt;br /&gt;
&lt;br /&gt;
WARNING: DO THIS PROCESS ON TEST DATA FIRST TO VERIFY THAT IT DOES NOT CAUSE CROSS CHECK BALANCE ERRORS&lt;br /&gt;
&lt;br /&gt;
WARNING: THIS PROCESS MAY CAUSE CROSS CHECK BALANCE ERRORS BY REINSTATING &amp;quot;ANCIENT CORRUPT VOUCHERS&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&amp;quot;CHECK BACK&amp;quot; AS FEW YEARS AS NEEDED TO INCLUDE ALL VOUCHERS THAT COULD BE OPEN/OUTSTANDING AT THE DESIRED PERIOD.&lt;br /&gt;
&lt;br /&gt;
It is not easy to know how far to &amp;quot;check back&amp;quot; for open items so go back two years initially unless it is known that there may be items outstanding from even earlier years.&lt;br /&gt;
&lt;br /&gt;
===1. Check, solve, record all existing cross check balances===&lt;br /&gt;
&lt;br /&gt;
Restoring open items may create cross check balance errors so first you need to fix all EXISTING cross check balance errors in the database.&lt;br /&gt;
&lt;br /&gt;
Do not proceed to the next step until this step is complete otherwise you will have no idea what problems were created by CHK.ALLOC and what problems were in the database before.&lt;br /&gt;
&lt;br /&gt;
Expect no sympathy from programmers if you ignore this or fail to work on testdata first.&lt;br /&gt;
&lt;br /&gt;
First print ***ALL*** open item ledger accounts to check for existing cross check balances in open item accounts.&lt;br /&gt;
&lt;br /&gt;
Correct all &amp;quot;cross check balances&amp;quot; using the usual procedures to do so.&lt;br /&gt;
&lt;br /&gt;
Note that cross check balances are unavoidable on some *extremely large* open item accounts. This does not mean that you can ignore cross check balances on merely large accounts. They must be fixed.&lt;br /&gt;
&lt;br /&gt;
Save copies of the detailed ledger accounts of any *extremely large&amp;quot; open items accounts that you have not fixed their cross check balances.&lt;br /&gt;
&lt;br /&gt;
===2. Edit back the Company File &amp;quot;cleared-upto period&amp;quot;===&lt;br /&gt;
&lt;br /&gt;
Complete this step quickly if users are working online - in order not to lock the company file for longer than it takes to change the &amp;quot;cleared upto period&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
In maintenance mode,  press F5. example company code X. Do this for all companies that need to.&lt;br /&gt;
&lt;br /&gt;
 ED COMPANIES X&lt;br /&gt;
&lt;br /&gt;
change line 17 to be the last period (YYMM) desired to have been cleared.&lt;br /&gt;
&lt;br /&gt;
DONT add or delete any lines!&lt;br /&gt;
&lt;br /&gt;
F9, Esc&lt;br /&gt;
&lt;br /&gt;
===3. Run CHK.ALLOC===&lt;br /&gt;
&lt;br /&gt;
This process can be run while users are working since there is a only a very slight chance that they will be posting the same account at the time that the program is updating its open item voucher index.&lt;br /&gt;
&lt;br /&gt;
In maintenance mode press F5&lt;br /&gt;
&lt;br /&gt;
 CHK.ALLOC&lt;br /&gt;
&lt;br /&gt;
Minimum is how far to go back. See explanation above.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
╔═══════════════════════════════════════╗&lt;br /&gt;
║ Minimum voucher year.period to check? ║&lt;br /&gt;
║              (0 for all)              ║&lt;br /&gt;
║&amp;lt;200801                               &amp;gt;║&lt;br /&gt;
╚═══════════════════════════════════════╝&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Which account do you want? PRESS ESC (or Enter+Esc)&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
╔═════════════════════════════════════════╗&lt;br /&gt;
║       Which account do you want ?       ║&lt;br /&gt;
║                                         ║&lt;br /&gt;
║    Give the account number or name,     ║&lt;br /&gt;
║     or press [Enter] if not known.      ║&lt;br /&gt;
║ (separate multiple entries with spaces) ║&lt;br /&gt;
║&amp;lt;                                       &amp;gt;║&lt;br /&gt;
╚═════════════════════════════════════════╝&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Add it? ... Choose &amp;quot;Yes to All&amp;quot;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
╔═══════════════════════════╗&lt;br /&gt;
║  Missing from O/I index   ║&lt;br /&gt;
║      Add it? (1.1KB)      ║&lt;br /&gt;
║───┬───────────────────────║&lt;br /&gt;
║  1│Yes                    ║&lt;br /&gt;
║  2│No                     ║&lt;br /&gt;
║  3&amp;gt;Yes to all &amp;lt;-THIS ONE  ║&lt;br /&gt;
║  4│No to all              ║&lt;br /&gt;
║  5│Yes to all *HAEX*FZ    ║&lt;br /&gt;
║  6│No to all *HAEX*FZ     ║&lt;br /&gt;
╚═══════════════════════════╝&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===4. Check for cross check balances===&lt;br /&gt;
&lt;br /&gt;
Print ***ALL*** open item ledger accounts to check for any additional cross check balances in open item accounts.&lt;br /&gt;
&lt;br /&gt;
For speed, omit old WIPxx and ACCxx ledgers since their accounts are probably all closed.&lt;br /&gt;
&lt;br /&gt;
If you have any ADDITIONAL cross check balances compared to those recorded in step 1, then you can rerun step 3 and &amp;quot;check back&amp;quot; a little earlier. Try one year earlier at a time - to avoid the problem of reinstating &amp;quot;ancient corrupt vouchers&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Speeding up CHK.VOUCHERS CHK.ALLOC==&lt;br /&gt;
&lt;br /&gt;
When running the above programs takes time due to a large number of vouchers, then you can speed up the process by prebuilding a filter and using it on each invocation of the program. This filter is lost when you login again.&lt;br /&gt;
&lt;br /&gt;
For example, if you want to check vouchers for account numbers XXXX, YYYY and ZZZZ in financial period 2004.01 and onwards&lt;br /&gt;
&lt;br /&gt;
 SELECT VOUCHERS WITH YEAR_PERIOD GE &amp;quot;14.01&amp;quot; AND WITH ACCOUNT &amp;quot;XXXX&amp;quot; &amp;quot;YYYY&amp;quot; &amp;quot;ZZZZ&amp;quot;&lt;br /&gt;
&lt;br /&gt;
wait for it to say &amp;quot;xxxx record(s) selected&amp;quot; briefly and then show blank command line again, then type&lt;br /&gt;
&lt;br /&gt;
 SAVELIST XYZ&lt;br /&gt;
&lt;br /&gt;
then each time just before you run CHK.VOUCHERS and CHK.ALLOC you can do the following to make them only look at the selected vouchers&lt;br /&gt;
&lt;br /&gt;
 GETLIST XYZ&lt;br /&gt;
&lt;br /&gt;
==Check steps of each CHK program==&lt;br /&gt;
&lt;br /&gt;
===Run CHK.ALLOC===&lt;br /&gt;
&lt;br /&gt;
Check the VOUCHERS file&lt;br /&gt;
&lt;br /&gt;
Checks that allocations occur in pairs and that both sides refer to the same account number and are in the same financial period.&lt;br /&gt;
&lt;br /&gt;
Checks not allocated more than the amount/base amount on the voucher.&lt;br /&gt;
&lt;br /&gt;
Checks open items (not allocated or not fully allocated) exist in the open item records of the voucher index file.&lt;br /&gt;
&lt;br /&gt;
Checks that allocations do not cause a rate change since automatic revaluation is supposed to occur on allocation.&lt;br /&gt;
&lt;br /&gt;
===Run CHK.CONTROLS===&lt;br /&gt;
&lt;br /&gt;
Checks the BALANCES file.&lt;br /&gt;
&lt;br /&gt;
Check that the control account balances agree with the total of the balances of their subsidiary accounts.&lt;br /&gt;
&lt;br /&gt;
===Run CHK.VOUCHERS===&lt;br /&gt;
&lt;br /&gt;
Checks a lot of things in the VOUCHERS File.&lt;br /&gt;
&lt;br /&gt;
===Run CHK.BATCHES===&lt;br /&gt;
&lt;br /&gt;
Check the BATCHES file (Journals File).&lt;br /&gt;
&lt;br /&gt;
Checks journal type, company code and currency codes are valid.&lt;br /&gt;
&lt;br /&gt;
For each voucher check that it is not missing and that its voucher period, posted/unposted state and Journal No. agree with that of the Journal.&lt;br /&gt;
&lt;br /&gt;
Checks amounts and base amounts are all numeric.&lt;br /&gt;
&lt;br /&gt;
Checks base currency entries have matching base amount entries ie if base is USD then amount is 100USD and base is 100 (101 or something else).&lt;br /&gt;
&lt;br /&gt;
For posted batches, checks A/c Nos. are valid.&lt;br /&gt;
&lt;br /&gt;
===Run CHK.VINDEX===&lt;br /&gt;
&lt;br /&gt;
Checks the VOUCHER.INDEX file.&lt;br /&gt;
&lt;br /&gt;
For each entry in the index ie line on a ledger account.&lt;br /&gt;
&lt;br /&gt;
Checks for ledger entries that have problems eg wrong account or missing voucher.&lt;br /&gt;
&lt;br /&gt;
Checks A/c No, currency code, journal type and company code are valid.&lt;br /&gt;
&lt;br /&gt;
Checks open items indexes are only for open item accounts.&lt;br /&gt;
&lt;br /&gt;
Checks Journal type OB does not exist on movement indexes.&lt;br /&gt;
&lt;br /&gt;
Checks that reversed batches have matching reversal batch and vice versa.&lt;br /&gt;
&lt;br /&gt;
Checks vouchers exist.&lt;br /&gt;
&lt;br /&gt;
Checks that the voucher period, date, currency and A/c No. agrees with the index.&lt;br /&gt;
&lt;br /&gt;
===Run CHK.OB===&lt;br /&gt;
&lt;br /&gt;
Check the BALANCES file.&lt;br /&gt;
&lt;br /&gt;
Checks that opening balances are correct versus closing balances for accounts that are neither closed nor closing accounts.&lt;br /&gt;
&lt;br /&gt;
===Run CHK.BALANCES===&lt;br /&gt;
&lt;br /&gt;
Checks the BALANCES file.&lt;br /&gt;
&lt;br /&gt;
Checks A/c No., currency code, voucher type and company code are all valid.&lt;br /&gt;
&lt;br /&gt;
Checks balances are all numeric.&lt;br /&gt;
&lt;br /&gt;
Checks the decimal places of balances of base currency are not more than the standard number of base currency decimal places.&lt;br /&gt;
&lt;br /&gt;
Checks the base currency record references to all other currencies is alphabetical.&lt;br /&gt;
&lt;br /&gt;
Checks all non-base currency balance records are referenced on the base currency record.&lt;br /&gt;
&lt;br /&gt;
===Run CHK.CHARTS===&lt;br /&gt;
&lt;br /&gt;
Checks the CHARTS and LEDGERS files.&lt;br /&gt;
&lt;br /&gt;
Checks A/c and Original A/c are valid ie exist in ACCOUNTS file.&lt;br /&gt;
&lt;br /&gt;
Checks any company and currency codes are valid.&lt;br /&gt;
&lt;br /&gt;
Checks the internal lookup tables in DEFINITIONS file are correct.&lt;br /&gt;
&lt;br /&gt;
===Run CHK.ACCOUNTS===&lt;br /&gt;
&lt;br /&gt;
Checks the ACCOUNTS file.&lt;br /&gt;
&lt;br /&gt;
Checks accounts exist in the Chart File.&lt;br /&gt;
&lt;br /&gt;
Checks the account records representing Account and Orig A/c No. refer to each other symmetrically.&lt;br /&gt;
&lt;br /&gt;
Checks that any Control A/c, Closing A/c, Company code and Currency code is valid and match the same in the Chart File.&lt;br /&gt;
&lt;br /&gt;
==Fixing opening balance of new year does not agree with the closing balance of the previous year==&lt;br /&gt;
&lt;br /&gt;
In order to fix this problem, redo the open new year procedure for the problematic year, where recreating opening balances (which is part of the opennewyear.subs program) should fix the issue.&lt;br /&gt;
&lt;br /&gt;
===Redo Open New Year procedure===&lt;br /&gt;
&lt;br /&gt;
In latest versions of NEOSYS, you can reopen a year using the below command.&lt;br /&gt;
&lt;br /&gt;
 REOPENYEAR &amp;lt;Companycodes&amp;gt; YYYY &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
   Media  Production  Finance  Management  Timesheets  Files  General  Exit&lt;br /&gt;
▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒&lt;br /&gt;
▒╒═══════════════════════════════════TCL - 2══════════════════════════════════╕▒&lt;br /&gt;
▒│                                                                            │▒&lt;br /&gt;
▒│ :REOPENYEAR A,AA 2020                                                      │▒&lt;br /&gt;
▒│                                                                            │▒&lt;br /&gt;
▒╘════════════════════════════════════════════════════════════════════════════╛▒&lt;br /&gt;
▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In Maintenance mode, run CHK.OB and include a few prior years as well, to see if all balances are fine.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
   Media  Production  Finance  Management  Timesheets  Files  General  Exit&lt;br /&gt;
▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒&lt;br /&gt;
▒╒═══════════════════════════════════TCL - 2══════════════════════════════════╕▒&lt;br /&gt;
▒│                                                                            │▒&lt;br /&gt;
▒│ :chk.ob                                                                    │▒&lt;br /&gt;
▒│                                                                            │▒&lt;br /&gt;
▒╘════════════════════════════════════════════════════════════════════════════╛▒&lt;br /&gt;
▒▒▒▒▒▒▒▒▒▒▒▒╔══════════════════════════════════════════════════════╗▒▒▒▒▒▒▒▒▒▒▒▒&lt;br /&gt;
▒▒▒▒▒▒▒▒▒▒▒▒║                   Years to check?                    ║▒▒▒▒▒▒▒▒▒▒▒▒&lt;br /&gt;
▒▒▒▒▒▒▒▒▒▒▒▒║ (0 or starting year for all, but only checks forward ║▒▒▒▒▒▒▒▒▒▒▒▒&lt;br /&gt;
▒▒▒▒▒▒▒▒▒▒▒▒║           ie ob v cb not backward cb v ob)           ║▒▒▒▒▒▒▒▒▒▒▒▒&lt;br /&gt;
▒▒▒▒▒▒▒▒▒▒▒▒║&amp;lt;15 16 17 18 19                                      &amp;gt;║▒▒▒▒▒▒▒▒▒▒▒▒&lt;br /&gt;
▒▒▒▒▒▒▒▒▒▒▒▒╚══════════════════════════════════════════════════════╝▒▒▒▒▒▒▒▒▒▒▒▒&lt;br /&gt;
▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;/div&gt;</summary>
		<author><name>Gregory</name></author>
	</entry>
	<entry>
		<id>https://techwiki.neosys.com/index.php?title=EXODUS_Knowledge&amp;diff=3971</id>
		<title>EXODUS Knowledge</title>
		<link rel="alternate" type="text/html" href="https://techwiki.neosys.com/index.php?title=EXODUS_Knowledge&amp;diff=3971"/>
		<updated>2022-03-22T11:33:54Z</updated>

		<summary type="html">&lt;p&gt;Gregory: /* Speedup postgresql importing databases */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==TMUX Screens==&lt;br /&gt;
&lt;br /&gt;
To create the EXODUS maintenance/programming environment&lt;br /&gt;
 exodus#: ./tmux.exodus&lt;br /&gt;
&lt;br /&gt;
===Screens===&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
0: /&lt;br /&gt;
    Work regarding exodus server. i.e /etc/nagios or general networking or /var/log/mail.log&lt;br /&gt;
&lt;br /&gt;
1: /root/exodus/&lt;br /&gt;
    Exodus core is installed Contains build and make libraries here ./libexodus&lt;br /&gt;
&lt;br /&gt;
2: /root/exodus/libexodus/exodus&lt;br /&gt;
    Core exodus (libraries that emulate the AREV system e.g mv.h )&lt;br /&gt;
    &lt;br /&gt;
3: /root/exodus/cli/src&lt;br /&gt;
    Exodus Command Line Interface e.g edir, edic, list, listfiles, delete, createdb&lt;br /&gt;
    &lt;br /&gt;
4: root/exodus/service&lt;br /&gt;
    EXODUS core default host directory but also contains scripts that create/manage requirements of a service (create_service, create_db, create_site, backup_db, restore_db, start, stop, status)&lt;br /&gt;
    One exception is NEOSYS www files are in ./www, which pulled from NEOSYS www git.&lt;br /&gt;
&lt;br /&gt;
5: /root/exodus/service/src&lt;br /&gt;
    Exodus core service programs (programs that are not related to NEOSYS agency operations and can be used to support other non-NEOSYS services) eg listen, usersubs, sendmail, openfile, select, sort, list,.&lt;br /&gt;
&lt;br /&gt;
    Extra info:    &lt;br /&gt;
    sql directory contains basic dictiorary files converted to sql instructions used when creating a EXODUS psql database&lt;br /&gt;
    e.g dict_voc.sql is a file that describes what to expect in certain fields of the voc file.&lt;br /&gt;
    TODO: compall currently throws few warnings. Read them and familiarise. In case new warnings appear, notify Steve.    &lt;br /&gt;
        &lt;br /&gt;
6: /root/neosys&lt;br /&gt;
    NEOSYS specific client installation management scripts e.g .doall, import_db and import_files (from AREV), ./run ./test (see below for these two commands)&lt;br /&gt;
    &lt;br /&gt;
7: /root/neosys/src&lt;br /&gt;
    NEOSYS Agency programs (see section How AREV programs are distributed in EXODUS src/*.cpp&lt;br /&gt;
    ../ has .git&lt;br /&gt;
&lt;br /&gt;
8: /root/hosts&lt;br /&gt;
    client specific files  e.g logs, images, (shared ./www -&amp;gt; root/exodus/service/www&lt;br /&gt;
&lt;br /&gt;
9: /root/exodus/test/src&lt;br /&gt;
    series of programs that test whether subroutines (specifically Exodus core libraries) work as they should eg for the var lib - &amp;quot;assert( var(&amp;quot;11111&amp;quot;).isnum());&amp;quot;&lt;br /&gt;
&lt;br /&gt;
10: bash /bin/top&lt;br /&gt;
    Monitor for NEOSYS client processes&lt;br /&gt;
    Displays customised format: sorted by total time spend and by processor time.&lt;br /&gt;
     Press &amp;quot;=&amp;quot; : to change to standard top format&lt;br /&gt;
     Press shift + w : to save format settings, replacing the old customised top format&lt;br /&gt;
     To go back to the customised format do:&lt;br /&gt;
        Press &amp;quot;o&amp;quot;&lt;br /&gt;
        Type &amp;quot;COMMAND=serve_agy&amp;quot;&lt;br /&gt;
        shift + t : this sorts by total time spent&lt;br /&gt;
        shift + p : this sorts by processor time&lt;br /&gt;
        shift + w : to save this setting and enter  &#039;y&#039; to confirm&lt;br /&gt;
&lt;br /&gt;
11: /var/log/syslog&lt;br /&gt;
     Log of NEOSYS client requests&lt;br /&gt;
&lt;br /&gt;
12: /root/exodus/service/quick&lt;br /&gt;
     Displays the last time the svr file (in /root/hosts/&amp;lt;client&amp;gt;/data/&amp;lt;dbname&amp;gt;) was updated.&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Object Code/Libraries==&lt;br /&gt;
LIVE and TEST processes use different sets of object code.&lt;br /&gt;
TEST processes use libraries in ~/lib/, whereas LIVE processes use object code in ~/neo/lib&lt;br /&gt;
&lt;br /&gt;
This means development &amp;amp; testing can be done stress free on TEST database, as opposed to testing on production databases.&lt;br /&gt;
&lt;br /&gt;
When compiling using edic, the TEST object code is updated if the compilation is successful. (~/lib)&lt;br /&gt;
In order to apply a tested patch to LIVE see [[Update LIVE programs]].&lt;br /&gt;
&lt;br /&gt;
==Dictionaries==&lt;br /&gt;
Dictionaries, the files used to describe the fields of a file&#039;s record.&lt;br /&gt;
Unlike in AREV, there is a copy of all dictionaries in each pgsql database (In AREV, updating a dictionary would affect all the databases).&lt;br /&gt;
&lt;br /&gt;
==Processes==&lt;br /&gt;
The TEST process for all database use the same object code stored in /root/lib, whereas all LIVE process use the object code in /root/neo/.&lt;br /&gt;
&lt;br /&gt;
==Postgres==&lt;br /&gt;
Connect into postgres shell:&lt;br /&gt;
 alias psql=&#039;sudo -u postgres psql&#039;&lt;br /&gt;
&lt;br /&gt;
Delete a database:&lt;br /&gt;
 sudo -u postgres dropdb &amp;lt;dbcode&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Debugging Exodus==&lt;br /&gt;
&lt;br /&gt;
===Debugging Live/Test services===&lt;br /&gt;
&lt;br /&gt;
./test &amp;lt;dbname&amp;gt; - execute test programs on _test database.&lt;br /&gt;
&lt;br /&gt;
./run &amp;lt;dbname&amp;gt;  - execute test programs on live database.&lt;br /&gt;
&lt;br /&gt;
===Debugging var values===&lt;br /&gt;
&lt;br /&gt;
Explanation of var flag value in gdb debug mode.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
(gdb) p varx                                                           &lt;br /&gt;
$2 = {var_str = &amp;quot;&amp;quot;, var_int = 0, var_dbl = 0, var_typ = {flags_ = 2}}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Each exodus var object contains 3 variables of type string, int and double.&lt;br /&gt;
&lt;br /&gt;
All 3 may be unassigned or only the string be assigned or just the int and double e.t.&lt;br /&gt;
&lt;br /&gt;
You can tell which variable type of a var object are set based on the var&#039;s flag value.&lt;br /&gt;
&lt;br /&gt;
1 = Means the string is assigned&lt;br /&gt;
2 = Means the int is assigned&lt;br /&gt;
4 = Means the double is assigned&lt;br /&gt;
&lt;br /&gt;
Example: If the flag is 7 (1+2+4), then all types are assigned.&lt;br /&gt;
&lt;br /&gt;
===Process Hung or consuming +100% CPU===&lt;br /&gt;
If process is consuming +100% CPU then it is likely stuck in an infinite loop.&lt;br /&gt;
&lt;br /&gt;
 ./doall &amp;lt;CLIENT&amp;gt; stop&lt;br /&gt;
&lt;br /&gt;
 ./run &amp;lt;CLIENT&amp;gt; &lt;br /&gt;
&lt;br /&gt;
 ./test &amp;lt;CLIENT&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Search through recent logs for &amp;lt;CLIENT&amp;gt; looking for requests that didn&#039;t return OK at the time nagios alerted of Hung process.&lt;br /&gt;
&lt;br /&gt;
A user may also instigate the error again, so monitor the CLIENT&#039;s service CPU usage.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
If cause found recreate it in test and once test process hit +100% break in test debugger.&lt;br /&gt;
&lt;br /&gt;
If cause not found, you will have to continue checking logs for the request that caused it or hope a user recreates the issue in live debugged service.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Once you&#039;ve broken in the debugged with the error, enter &amp;quot;n&amp;quot; and hold the enter key until you just seeing line repeat.&lt;br /&gt;
&lt;br /&gt;
Pay attention to start of loops code. E.g WHILE or FOR. (there is likely an error is there)&lt;br /&gt;
&lt;br /&gt;
==./doall==&lt;br /&gt;
====General====&lt;br /&gt;
&lt;br /&gt;
~/neosys/doall [LIVE|TEST] &amp;lt;DBCODE|ALL&amp;gt; &amp;lt; ACTION [OPTIONS,..]  | bash -- COMMAND ]&lt;br /&gt;
&lt;br /&gt;
Example: &lt;br /&gt;
 ./doall TEST ALL create_site t-&lt;br /&gt;
Result:&lt;br /&gt;
Create site for ALL TEST databases, using domain name prefix option &amp;quot;t-&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Screen 6: ./doall script contains all the necessary information(codes) to setup an installation.&lt;br /&gt;
It includes scripts to backup, restore, create an Apache site, create/start/stop/status a service, import an AREV database into postgres and more.&lt;br /&gt;
&lt;br /&gt;
====backup_db====&lt;br /&gt;
&lt;br /&gt;
*Does a backup &amp;amp; restore of a LIVE database into the corresponding TEST database.&lt;br /&gt;
*Backup &amp;lt;dbcode&amp;gt;.sql file is written to /root/backups/sql; which is rsynced to nl19:/backups/current/exodus/&lt;br /&gt;
*Unlike AREV, postgres can perform a &amp;quot;backup&amp;quot; of a database whilst the system is in use.&lt;br /&gt;
&lt;br /&gt;
==Git==&lt;br /&gt;
&lt;br /&gt;
There are two repositories, one for EXODUS and the other for NEOSYS.&lt;br /&gt;
&lt;br /&gt;
===Using git to make changes===&lt;br /&gt;
&lt;br /&gt;
Before following steps you must have a tested updated to a program/file/script. Do not commit untested changes to avoid a messy git history of reverts.&lt;br /&gt;
&lt;br /&gt;
Update your local repo before committing to local repo using the g alias for &amp;quot;git pull --ff-only ; git push &amp;amp;&amp;amp; git status&#039;&amp;quot;:&lt;br /&gt;
&amp;lt;pre&amp;gt;g&amp;lt;/pre&amp;gt;&lt;br /&gt;
Check which updates/files have not yet been staged and/or committed:&lt;br /&gt;
Add your updates to the staged area:&lt;br /&gt;
&amp;lt;pre&amp;gt;git add &amp;lt;filename&amp;gt;&amp;lt;/pre&amp;gt;&lt;br /&gt;
or if all the changes made need to be staged:&lt;br /&gt;
&amp;lt;pre&amp;gt;git add -a&amp;lt;/pre&amp;gt;&lt;br /&gt;
Make a commit with a descriptive message on purpose of updates:&lt;br /&gt;
&amp;lt;pre&amp;gt;git commit -m &amp;lt;description n purpose of changes&amp;gt;&amp;lt;/pre&amp;gt;&lt;br /&gt;
Again use g alias:&lt;br /&gt;
&amp;lt;pre&amp;gt;g&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Other useful git cmds===&lt;br /&gt;
&lt;br /&gt;
Do not use this commands unless you know what WILL happen. &lt;br /&gt;
*git pull - Instead use the safe &amp;quot;git pull --ff-only&amp;quot;&lt;br /&gt;
Stick to the alias &amp;quot;g&amp;quot; which does &amp;quot;git pull --ff-only ; git push &amp;amp;&amp;amp; git status&#039;&amp;quot;&lt;br /&gt;
&lt;br /&gt;
*git log - display history of commits to master branch&lt;br /&gt;
*git diff - display the differences in files between working files and files in local repo.&lt;br /&gt;
*git status - display: which updated files are staged/not staged(tracked)&lt;br /&gt;
*git stash - &lt;br /&gt;
*git branch - switch to a new branch&lt;br /&gt;
*git branch &amp;lt;branchname&amp;gt; - will switch to this branch only if it exists&lt;br /&gt;
*git checkout - DESTROYS/Updates the state of local working directory with the state of the files in the local repo. (YOU WILL LOSE non staged updates)&lt;br /&gt;
*git restore &amp;lt;filename&amp;gt; - DESTROYS/Updates the file with the version in the local repo. (like with git checkout but for a specific file)&lt;br /&gt;
*git checkin - &lt;br /&gt;
*git revert &amp;lt;commitHash&amp;gt; - reverses a specific commit (use git log to get the chosen commit hash)&lt;br /&gt;
*git ..&lt;br /&gt;
&lt;br /&gt;
==Converting AREV programs to EXODUS==&lt;br /&gt;
===Decompile AREV to C++===&lt;br /&gt;
&lt;br /&gt;
Do in Master AREV Installation Maintenance mode: (win7)&lt;br /&gt;
&lt;br /&gt;
#ATTACH ADECOMC &lt;br /&gt;
#*ADECOM &amp;lt;programname&amp;gt;   *single program&lt;br /&gt;
#*ADECOM &amp;lt;prog1&amp;gt; &amp;lt;prog2&amp;gt; &lt;br /&gt;
#*ADECOMALL              *all programs   (CHECK FIRST)&lt;br /&gt;
&lt;br /&gt;
Include the option &amp;quot;(V)&amp;quot; in the command to print the C++ to a notepad, which can easily be copy and pasted.&lt;br /&gt;
&lt;br /&gt;
===Getting C++ program to Exodus Installation===&lt;br /&gt;
&lt;br /&gt;
Two methods: (use the first for one off programs)&lt;br /&gt;
&lt;br /&gt;
====Copy &amp;amp; Paste====&lt;br /&gt;
&lt;br /&gt;
Compile program and open source code in notepad&lt;br /&gt;
&lt;br /&gt;
 ADECOM &amp;lt;programname&amp;gt; (V)&lt;br /&gt;
&lt;br /&gt;
Find which directory the program belongs. e.g fin/med/job/sys e.t&lt;br /&gt;
&lt;br /&gt;
 find /cygdrive/d/exodus/pickos | grep &amp;lt;program name&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If cpp in SYS, the program belongs in ~/exodus/service/src OR if in MED JOB FIN GEN AGY the program belongs in ~/neosys/src&lt;br /&gt;
&lt;br /&gt;
Copy the source code in the text file from the first command.&lt;br /&gt;
&lt;br /&gt;
In Exodus, create a new .cpp (in correct directory) and paste the source code.&lt;br /&gt;
&lt;br /&gt;
Compile &amp;amp; Test&lt;br /&gt;
&lt;br /&gt;
====Rsync====&lt;br /&gt;
&lt;br /&gt;
 /d/exodus/arev/syncup.sh&lt;br /&gt;
&lt;br /&gt;
If cpp in SYS then: ~/exodus/service/src ./getpickos&lt;br /&gt;
&lt;br /&gt;
If cpp in MED JOB FIN GEN AGY then: *~/neosys/src&lt;br /&gt;
&lt;br /&gt;
===Compile C++ files to TEST system===&lt;br /&gt;
&lt;br /&gt;
#*./test &amp;lt;DBNAME&amp;gt;&lt;br /&gt;
#*~/neosys ./doall TEST &amp;lt;DBNAME&amp;gt; restart    #to get one service to start start using the new lib files&lt;br /&gt;
#*~/neosys ./doall TEST all restart         #to get all the services to start start using the new lib files&lt;br /&gt;
&lt;br /&gt;
===Install C++ files to LIVE System===&lt;br /&gt;
&lt;br /&gt;
#~/exodus/service/ ./copyall            #to copy all the ~/lib and bin files to ~/live/lib and bin ... which is used by all exodus/live services&lt;br /&gt;
&lt;br /&gt;
==Writing Standard Exodus Core Function/Method Testing==&lt;br /&gt;
Screen 9: ~/exodus/test/src/&lt;br /&gt;
There are a series of test programs that check whether methods/functions behave as intended.&lt;br /&gt;
They do this using the function, assert.. a 1 or more argument values produce one and only one output)&lt;br /&gt;
&lt;br /&gt;
e.g test_multilang.cpp or test_sort.cpp&lt;br /&gt;
&lt;br /&gt;
Two methods of running test programs:&lt;br /&gt;
*Screen 9: make test&lt;br /&gt;
*after compiling using edic/compile/c, enter test_prog_name. (Since compile has moved it to ~/bin)&lt;br /&gt;
&lt;br /&gt;
Difference between the two methods is make calls gdb directly;&lt;br /&gt;
whereas ~/bin/test_prog_name uses exodus compile program&lt;br /&gt;
#~/neosys ./doall LIVE all restart&lt;br /&gt;
&lt;br /&gt;
==Updating a pgsql function in an exodus dictionary==&lt;br /&gt;
&lt;br /&gt;
PENDING&lt;br /&gt;
&lt;br /&gt;
==Development and deployment using &#039;dat&#039; files==&lt;br /&gt;
&lt;br /&gt;
===Rationale===&lt;br /&gt;
&lt;br /&gt;
Part of system development is the creation of various data that is neither programs nor layout i.e. not cpp, h, html, js, php files etc.&lt;br /&gt;
&lt;br /&gt;
For example:&lt;br /&gt;
&lt;br /&gt;
*Dictionaries are data about data.&lt;br /&gt;
*Language files are data about text to use for various languages.&lt;br /&gt;
*“Change logs” are data about changes in the system.&lt;br /&gt;
&lt;br /&gt;
Historically, in EXODUS and NEOSYS, the above data has been deployed in exodus database files using SQL text files. However SQL files are not convenient for development.&lt;br /&gt;
&lt;br /&gt;
Therefore, &#039;dat&#039; text files will be used now so that standard development tools including editors and git can be fully exploited.&lt;br /&gt;
&lt;br /&gt;
===&#039;dat&#039; files===&lt;br /&gt;
&lt;br /&gt;
Each database file is represented by an os directory of the same name.&lt;br /&gt;
&lt;br /&gt;
Each record in the database file is represented by an os text file where filename is the primary key.&lt;br /&gt;
&lt;br /&gt;
For example a record with key &#039;&#039;&#039;DEADLINE&#039;&#039;&#039; in a dat file &#039;&#039;&#039;dict.materials&#039;&#039;&#039; would be represented as an os text file &#039;&#039;&#039;dat/dict.materials/DEADLINE&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Each line in the os text file represents one field in the db record. In other words, db record FM characters are represented by new line characters in &#039;dat&#039; files. Any actual new line characters required in the record, and any backslashes, are escaped and appear as &#039;\n&#039; and &#039;\\&#039; in &#039;dat&#039; files. Other database field separator characters such as VM, SM, TM and STM are stored without any conversion.&lt;br /&gt;
&lt;br /&gt;
===Location of dat files===&lt;br /&gt;
&lt;br /&gt;
The development versions are stored in exodus and neosys src/dat dirs. They form part of the standard git repositories in parallel with cpp files.&lt;br /&gt;
&lt;br /&gt;
The operational versions are stored in ~/dat and ~/live/dat alongside bin and lib dirs and are automatically installed into databases as database files on service startup. Any database functions embedded in the text files (pgsql) are also automatically installed at the same time.&lt;br /&gt;
&lt;br /&gt;
===Editing and deploying a &#039;dat&#039; file===&lt;br /&gt;
&lt;br /&gt;
It is currently a three step process to edit and deploy such &#039;dat&#039; files. &lt;br /&gt;
&lt;br /&gt;
====Edit the &#039;dat&#039; file====&lt;br /&gt;
&lt;br /&gt;
Note that EXODUS service and NEOSYS service have different src/dat folders.&lt;br /&gt;
&lt;br /&gt;
Editing language items:&lt;br /&gt;
&lt;br /&gt;
 edir dat/alanguage/SCHEDULES*ARABIC&lt;br /&gt;
&lt;br /&gt;
Editing a dictionary item:&lt;br /&gt;
&lt;br /&gt;
 edir dat/dict.materials/DEADLINE&lt;br /&gt;
&lt;br /&gt;
Editing a pgsql function in a dictionary:&lt;br /&gt;
&lt;br /&gt;
 edir dat/dict.materials/DEADLINE 8&lt;br /&gt;
&lt;br /&gt;
====Copy all &#039;dat&#039; files to ~/dat ====&lt;br /&gt;
&lt;br /&gt;
This step might be removed at a later date.&lt;br /&gt;
&lt;br /&gt;
This will cause all test databases to immediately restart and load any &#039;dat&#039; file changes into dictionaries and data files and also create any new or modified pgsql functions.&lt;br /&gt;
&lt;br /&gt;
If any ~/neosys/src/dat files were edited:&lt;br /&gt;
&lt;br /&gt;
 cd ~/neosys/src&lt;br /&gt;
 &lt;br /&gt;
 ./compall dat&lt;br /&gt;
&lt;br /&gt;
and/or, if exodus/service/dat files were edited&lt;br /&gt;
&lt;br /&gt;
 cd ~/exodus/service/src&lt;br /&gt;
 &lt;br /&gt;
 ./compall dat&lt;br /&gt;
&lt;br /&gt;
====Copy all programs and &#039;dat&#039; files to ~/live/bin|lib|dat====&lt;br /&gt;
&lt;br /&gt;
This should only be run after testing. It will cause all live databases to automatically restart and do the same as the test databases mentioned above.&lt;br /&gt;
&lt;br /&gt;
 cd ~/exodus/service&lt;br /&gt;
 &lt;br /&gt;
 ./copyall CONFIRM&lt;br /&gt;
​&lt;br /&gt;
&lt;br /&gt;
==Upgrading Exodus==&lt;br /&gt;
&lt;br /&gt;
#Develop patch in Dev system &lt;br /&gt;
&lt;br /&gt;
===Single Patches===&lt;br /&gt;
&lt;br /&gt;
#Insert patches into various files and compile if necessary&lt;br /&gt;
#If patch dat files then run neosys compall to get dat files into ~/dat&lt;br /&gt;
*If Patsalides:&lt;br /&gt;
*#SITE_DIR=ptcy ./test basic  #requires /etc/systemd/system/agy_test@.service to have been patched like agy_live@.service&lt;br /&gt;
*#web login to BASIC_TEST to test&lt;br /&gt;
*If not patsalides&lt;br /&gt;
*#./test DBCODE&lt;br /&gt;
*#login to DBCODE and test&lt;br /&gt;
#If all ok&lt;br /&gt;
#./copyall &lt;br /&gt;
#CHECK what WILL be copied!&lt;br /&gt;
#Judge if really need to get people off (unlikely for typical patch) and request users to logout for 10 mins&lt;br /&gt;
#./copyall CONFIRM and CHECK what was copied is as per exceptions same as previous step&lt;br /&gt;
#./copyone could be used instead of copyall but it has no test mode and does not copy dat files&lt;br /&gt;
&lt;br /&gt;
===Upgrading to new version===&lt;br /&gt;
&lt;br /&gt;
Use when there are too many changes to do individually patches.&lt;br /&gt;
&lt;br /&gt;
#Inform clients.&lt;br /&gt;
#*Client hosted - Schedule a planned upgrade with client.&lt;br /&gt;
#*NEOSYS hosted - Inform all clients/users of planned morning upgrade, 24hours in advanced.      (TODO: &#039;What&#039;s New in NEOSYS&#039;) AND (emailallusers.cpp)&lt;br /&gt;
#If the morning&#039;s USB backup failed, do NOT continue upgrade procedure because if upgrade fails, we need a way to roll back system to last working state.&lt;br /&gt;
#Check upgrade works on test service using:/root/neosys/upgrade.all.sh test&lt;br /&gt;
#Check the latest patch is working.&lt;br /&gt;
#Run/root/neosys/upgrade.all.sh live&lt;br /&gt;
#Inform users their system has been upgraded and they can login.&lt;br /&gt;
&lt;br /&gt;
===Roll Back Upgrade===&lt;br /&gt;
&lt;br /&gt;
If for any reason the entire upgrade needs to be reverted (excludes clients database), follow steps below:&lt;br /&gt;
&lt;br /&gt;
#Inform users that there is a problem and services need to be stopped.&lt;br /&gt;
#Stop all exodus processes.&lt;br /&gt;
#Restore the morning&#039;s USB backup by: (Note this backup contains:  source/obj code, /etc, neosys scripts but not client data)&lt;br /&gt;
##Login into container&#039;s host and rsync the morning&#039;s usb backup to the container&#039;s /:&lt;br /&gt;
#*&amp;lt;pre&amp;gt;rsync --dry-run -avz -e &#039;ssh -p &amp;lt;C_SSHPORT&amp;gt;&#039; /backups/usb/&amp;lt;C_CODE&amp;gt; &amp;lt;C_CODE&amp;gt;:/      (Example: rsync --dry-run -avz -e &#039;ssh -p 19582&#039; /backups/usb/ad1 ad1:/&amp;lt;/pre&amp;gt;)&lt;br /&gt;
#Quick sane check, the latest git commit is not the latest git commit in the remote repo.&lt;br /&gt;
#Inform users they can login.&lt;br /&gt;
&lt;br /&gt;
==Configuring services to autostart during login==&lt;br /&gt;
For Ptcy.&lt;br /&gt;
&lt;br /&gt;
#Create a file &#039;autostart.cfg&#039; in the data folder &lt;br /&gt;
&lt;br /&gt;
 touch /root/hosts/&amp;lt;dbname&amp;gt;/data/autostart.cfg&lt;br /&gt;
&lt;br /&gt;
This will autostart a database service as long as at least one database service in that directory is running.&lt;br /&gt;
&lt;br /&gt;
For example, demo service will autostart during login if,&lt;br /&gt;
#/root/hosts/demo/data/autostart.cfg exists and&lt;br /&gt;
#demo_test service is running&lt;br /&gt;
&lt;br /&gt;
==Speedup postgresql importing databases==&lt;br /&gt;
&lt;br /&gt;
Can be sped up by a factor of 10 BUT may result in corrupt files in case of hard OS crash where the dirty memory is not flushed to storage.&lt;br /&gt;
&lt;br /&gt;
Therefore it is advisable to use this feature only briefly and REMEMBER TO REMOVE IT! &lt;br /&gt;
&lt;br /&gt;
Email to support@neosys.com whenever using it or use personal notes not memory.&lt;br /&gt;
&lt;br /&gt;
nano /etc/postgresql/12/main/postgresql.conf&lt;br /&gt;
&lt;br /&gt;
Uncomment or add a line&lt;br /&gt;
 fsync = off&lt;br /&gt;
Restart postgres … will break any neosys/exodus running processes.&lt;br /&gt;
 r postgresql&lt;br /&gt;
or reload postgres may also work&lt;br /&gt;
&lt;br /&gt;
==Database Attach==&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
root@exodus:~/exodus/cli/src# dbattach&lt;br /&gt;
dbattach - Attach foreign database files to the current default database&lt;br /&gt;
&lt;br /&gt;
Syntax is dbattach TARGETDB [FILENAME,...] {OPTION...}&lt;br /&gt;
&lt;br /&gt;
Options:&lt;br /&gt;
&lt;br /&gt;
  F   Forcibly delete any normal files in the current default database.&lt;br /&gt;
&lt;br /&gt;
  R   Detach foreign files&lt;br /&gt;
  RR  Remove foreign database connection.&lt;br /&gt;
  RRR Remove all foreign database connections and attachments.&lt;br /&gt;
&lt;br /&gt;
  L   List attached foreign files in the current default database&lt;br /&gt;
&lt;br /&gt;
If no filenames are provided then a database connection is created.&lt;br /&gt;
This is *required* before filenames can be provided and attached.&lt;br /&gt;
&lt;br /&gt;
Notes:&lt;br /&gt;
&lt;br /&gt;
Attachments are permanent until re-attached or removed.&lt;br /&gt;
&lt;br /&gt;
Indexes on attached files behave strangely.&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Issues:&lt;br /&gt;
&lt;br /&gt;
TARGETDB must be on the same connection as the current default database.&lt;br /&gt;
&lt;br /&gt;
Current user must have access to the foreign database.&lt;br /&gt;
&lt;br /&gt;
If EXO_USER and EXO_PASS are not set then exodus defaults are used.&lt;br /&gt;
&lt;br /&gt;
exodus .config file is not used currently.&lt;/div&gt;</summary>
		<author><name>Gregory</name></author>
	</entry>
	<entry>
		<id>https://techwiki.neosys.com/index.php?title=EXODUS_Knowledge&amp;diff=3970</id>
		<title>EXODUS Knowledge</title>
		<link rel="alternate" type="text/html" href="https://techwiki.neosys.com/index.php?title=EXODUS_Knowledge&amp;diff=3970"/>
		<updated>2022-03-18T08:36:28Z</updated>

		<summary type="html">&lt;p&gt;Gregory: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==TMUX Screens==&lt;br /&gt;
&lt;br /&gt;
To create the EXODUS maintenance/programming environment&lt;br /&gt;
 exodus#: ./tmux.exodus&lt;br /&gt;
&lt;br /&gt;
===Screens===&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
0: /&lt;br /&gt;
    Work regarding exodus server. i.e /etc/nagios or general networking or /var/log/mail.log&lt;br /&gt;
&lt;br /&gt;
1: /root/exodus/&lt;br /&gt;
    Exodus core is installed Contains build and make libraries here ./libexodus&lt;br /&gt;
&lt;br /&gt;
2: /root/exodus/libexodus/exodus&lt;br /&gt;
    Core exodus (libraries that emulate the AREV system e.g mv.h )&lt;br /&gt;
    &lt;br /&gt;
3: /root/exodus/cli/src&lt;br /&gt;
    Exodus Command Line Interface e.g edir, edic, list, listfiles, delete, createdb&lt;br /&gt;
    &lt;br /&gt;
4: root/exodus/service&lt;br /&gt;
    EXODUS core default host directory but also contains scripts that create/manage requirements of a service (create_service, create_db, create_site, backup_db, restore_db, start, stop, status)&lt;br /&gt;
    One exception is NEOSYS www files are in ./www, which pulled from NEOSYS www git.&lt;br /&gt;
&lt;br /&gt;
5: /root/exodus/service/src&lt;br /&gt;
    Exodus core service programs (programs that are not related to NEOSYS agency operations and can be used to support other non-NEOSYS services) eg listen, usersubs, sendmail, openfile, select, sort, list,.&lt;br /&gt;
&lt;br /&gt;
    Extra info:    &lt;br /&gt;
    sql directory contains basic dictiorary files converted to sql instructions used when creating a EXODUS psql database&lt;br /&gt;
    e.g dict_voc.sql is a file that describes what to expect in certain fields of the voc file.&lt;br /&gt;
    TODO: compall currently throws few warnings. Read them and familiarise. In case new warnings appear, notify Steve.    &lt;br /&gt;
        &lt;br /&gt;
6: /root/neosys&lt;br /&gt;
    NEOSYS specific client installation management scripts e.g .doall, import_db and import_files (from AREV), ./run ./test (see below for these two commands)&lt;br /&gt;
    &lt;br /&gt;
7: /root/neosys/src&lt;br /&gt;
    NEOSYS Agency programs (see section How AREV programs are distributed in EXODUS src/*.cpp&lt;br /&gt;
    ../ has .git&lt;br /&gt;
&lt;br /&gt;
8: /root/hosts&lt;br /&gt;
    client specific files  e.g logs, images, (shared ./www -&amp;gt; root/exodus/service/www&lt;br /&gt;
&lt;br /&gt;
9: /root/exodus/test/src&lt;br /&gt;
    series of programs that test whether subroutines (specifically Exodus core libraries) work as they should eg for the var lib - &amp;quot;assert( var(&amp;quot;11111&amp;quot;).isnum());&amp;quot;&lt;br /&gt;
&lt;br /&gt;
10: bash /bin/top&lt;br /&gt;
    Monitor for NEOSYS client processes&lt;br /&gt;
    Displays customised format: sorted by total time spend and by processor time.&lt;br /&gt;
     Press &amp;quot;=&amp;quot; : to change to standard top format&lt;br /&gt;
     Press shift + w : to save format settings, replacing the old customised top format&lt;br /&gt;
     To go back to the customised format do:&lt;br /&gt;
        Press &amp;quot;o&amp;quot;&lt;br /&gt;
        Type &amp;quot;COMMAND=serve_agy&amp;quot;&lt;br /&gt;
        shift + t : this sorts by total time spent&lt;br /&gt;
        shift + p : this sorts by processor time&lt;br /&gt;
        shift + w : to save this setting and enter  &#039;y&#039; to confirm&lt;br /&gt;
&lt;br /&gt;
11: /var/log/syslog&lt;br /&gt;
     Log of NEOSYS client requests&lt;br /&gt;
&lt;br /&gt;
12: /root/exodus/service/quick&lt;br /&gt;
     Displays the last time the svr file (in /root/hosts/&amp;lt;client&amp;gt;/data/&amp;lt;dbname&amp;gt;) was updated.&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Object Code/Libraries==&lt;br /&gt;
LIVE and TEST processes use different sets of object code.&lt;br /&gt;
TEST processes use libraries in ~/lib/, whereas LIVE processes use object code in ~/neo/lib&lt;br /&gt;
&lt;br /&gt;
This means development &amp;amp; testing can be done stress free on TEST database, as opposed to testing on production databases.&lt;br /&gt;
&lt;br /&gt;
When compiling using edic, the TEST object code is updated if the compilation is successful. (~/lib)&lt;br /&gt;
In order to apply a tested patch to LIVE see [[Update LIVE programs]].&lt;br /&gt;
&lt;br /&gt;
==Dictionaries==&lt;br /&gt;
Dictionaries, the files used to describe the fields of a file&#039;s record.&lt;br /&gt;
Unlike in AREV, there is a copy of all dictionaries in each pgsql database (In AREV, updating a dictionary would affect all the databases).&lt;br /&gt;
&lt;br /&gt;
==Processes==&lt;br /&gt;
The TEST process for all database use the same object code stored in /root/lib, whereas all LIVE process use the object code in /root/neo/.&lt;br /&gt;
&lt;br /&gt;
==Postgres==&lt;br /&gt;
Connect into postgres shell:&lt;br /&gt;
 alias psql=&#039;sudo -u postgres psql&#039;&lt;br /&gt;
&lt;br /&gt;
Delete a database:&lt;br /&gt;
 sudo -u postgres dropdb &amp;lt;dbcode&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Debugging Exodus==&lt;br /&gt;
&lt;br /&gt;
===Debugging Live/Test services===&lt;br /&gt;
&lt;br /&gt;
./test &amp;lt;dbname&amp;gt; - execute test programs on _test database.&lt;br /&gt;
&lt;br /&gt;
./run &amp;lt;dbname&amp;gt;  - execute test programs on live database.&lt;br /&gt;
&lt;br /&gt;
===Debugging var values===&lt;br /&gt;
&lt;br /&gt;
Explanation of var flag value in gdb debug mode.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
(gdb) p varx                                                           &lt;br /&gt;
$2 = {var_str = &amp;quot;&amp;quot;, var_int = 0, var_dbl = 0, var_typ = {flags_ = 2}}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Each exodus var object contains 3 variables of type string, int and double.&lt;br /&gt;
&lt;br /&gt;
All 3 may be unassigned or only the string be assigned or just the int and double e.t.&lt;br /&gt;
&lt;br /&gt;
You can tell which variable type of a var object are set based on the var&#039;s flag value.&lt;br /&gt;
&lt;br /&gt;
1 = Means the string is assigned&lt;br /&gt;
2 = Means the int is assigned&lt;br /&gt;
4 = Means the double is assigned&lt;br /&gt;
&lt;br /&gt;
Example: If the flag is 7 (1+2+4), then all types are assigned.&lt;br /&gt;
&lt;br /&gt;
===Process Hung or consuming +100% CPU===&lt;br /&gt;
If process is consuming +100% CPU then it is likely stuck in an infinite loop.&lt;br /&gt;
&lt;br /&gt;
 ./doall &amp;lt;CLIENT&amp;gt; stop&lt;br /&gt;
&lt;br /&gt;
 ./run &amp;lt;CLIENT&amp;gt; &lt;br /&gt;
&lt;br /&gt;
 ./test &amp;lt;CLIENT&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Search through recent logs for &amp;lt;CLIENT&amp;gt; looking for requests that didn&#039;t return OK at the time nagios alerted of Hung process.&lt;br /&gt;
&lt;br /&gt;
A user may also instigate the error again, so monitor the CLIENT&#039;s service CPU usage.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
If cause found recreate it in test and once test process hit +100% break in test debugger.&lt;br /&gt;
&lt;br /&gt;
If cause not found, you will have to continue checking logs for the request that caused it or hope a user recreates the issue in live debugged service.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Once you&#039;ve broken in the debugged with the error, enter &amp;quot;n&amp;quot; and hold the enter key until you just seeing line repeat.&lt;br /&gt;
&lt;br /&gt;
Pay attention to start of loops code. E.g WHILE or FOR. (there is likely an error is there)&lt;br /&gt;
&lt;br /&gt;
==./doall==&lt;br /&gt;
====General====&lt;br /&gt;
&lt;br /&gt;
~/neosys/doall [LIVE|TEST] &amp;lt;DBCODE|ALL&amp;gt; &amp;lt; ACTION [OPTIONS,..]  | bash -- COMMAND ]&lt;br /&gt;
&lt;br /&gt;
Example: &lt;br /&gt;
 ./doall TEST ALL create_site t-&lt;br /&gt;
Result:&lt;br /&gt;
Create site for ALL TEST databases, using domain name prefix option &amp;quot;t-&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Screen 6: ./doall script contains all the necessary information(codes) to setup an installation.&lt;br /&gt;
It includes scripts to backup, restore, create an Apache site, create/start/stop/status a service, import an AREV database into postgres and more.&lt;br /&gt;
&lt;br /&gt;
====backup_db====&lt;br /&gt;
&lt;br /&gt;
*Does a backup &amp;amp; restore of a LIVE database into the corresponding TEST database.&lt;br /&gt;
*Backup &amp;lt;dbcode&amp;gt;.sql file is written to /root/backups/sql; which is rsynced to nl19:/backups/current/exodus/&lt;br /&gt;
*Unlike AREV, postgres can perform a &amp;quot;backup&amp;quot; of a database whilst the system is in use.&lt;br /&gt;
&lt;br /&gt;
==Git==&lt;br /&gt;
&lt;br /&gt;
There are two repositories, one for EXODUS and the other for NEOSYS.&lt;br /&gt;
&lt;br /&gt;
===Using git to make changes===&lt;br /&gt;
&lt;br /&gt;
Before following steps you must have a tested updated to a program/file/script. Do not commit untested changes to avoid a messy git history of reverts.&lt;br /&gt;
&lt;br /&gt;
Update your local repo before committing to local repo using the g alias for &amp;quot;git pull --ff-only ; git push &amp;amp;&amp;amp; git status&#039;&amp;quot;:&lt;br /&gt;
&amp;lt;pre&amp;gt;g&amp;lt;/pre&amp;gt;&lt;br /&gt;
Check which updates/files have not yet been staged and/or committed:&lt;br /&gt;
Add your updates to the staged area:&lt;br /&gt;
&amp;lt;pre&amp;gt;git add &amp;lt;filename&amp;gt;&amp;lt;/pre&amp;gt;&lt;br /&gt;
or if all the changes made need to be staged:&lt;br /&gt;
&amp;lt;pre&amp;gt;git add -a&amp;lt;/pre&amp;gt;&lt;br /&gt;
Make a commit with a descriptive message on purpose of updates:&lt;br /&gt;
&amp;lt;pre&amp;gt;git commit -m &amp;lt;description n purpose of changes&amp;gt;&amp;lt;/pre&amp;gt;&lt;br /&gt;
Again use g alias:&lt;br /&gt;
&amp;lt;pre&amp;gt;g&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Other useful git cmds===&lt;br /&gt;
&lt;br /&gt;
Do not use this commands unless you know what WILL happen. &lt;br /&gt;
*git pull - Instead use the safe &amp;quot;git pull --ff-only&amp;quot;&lt;br /&gt;
Stick to the alias &amp;quot;g&amp;quot; which does &amp;quot;git pull --ff-only ; git push &amp;amp;&amp;amp; git status&#039;&amp;quot;&lt;br /&gt;
&lt;br /&gt;
*git log - display history of commits to master branch&lt;br /&gt;
*git diff - display the differences in files between working files and files in local repo.&lt;br /&gt;
*git status - display: which updated files are staged/not staged(tracked)&lt;br /&gt;
*git stash - &lt;br /&gt;
*git branch - switch to a new branch&lt;br /&gt;
*git branch &amp;lt;branchname&amp;gt; - will switch to this branch only if it exists&lt;br /&gt;
*git checkout - DESTROYS/Updates the state of local working directory with the state of the files in the local repo. (YOU WILL LOSE non staged updates)&lt;br /&gt;
*git restore &amp;lt;filename&amp;gt; - DESTROYS/Updates the file with the version in the local repo. (like with git checkout but for a specific file)&lt;br /&gt;
*git checkin - &lt;br /&gt;
*git revert &amp;lt;commitHash&amp;gt; - reverses a specific commit (use git log to get the chosen commit hash)&lt;br /&gt;
*git ..&lt;br /&gt;
&lt;br /&gt;
==Converting AREV programs to EXODUS==&lt;br /&gt;
===Decompile AREV to C++===&lt;br /&gt;
&lt;br /&gt;
Do in Master AREV Installation Maintenance mode: (win7)&lt;br /&gt;
&lt;br /&gt;
#ATTACH ADECOMC &lt;br /&gt;
#*ADECOM &amp;lt;programname&amp;gt;   *single program&lt;br /&gt;
#*ADECOM &amp;lt;prog1&amp;gt; &amp;lt;prog2&amp;gt; &lt;br /&gt;
#*ADECOMALL              *all programs   (CHECK FIRST)&lt;br /&gt;
&lt;br /&gt;
Include the option &amp;quot;(V)&amp;quot; in the command to print the C++ to a notepad, which can easily be copy and pasted.&lt;br /&gt;
&lt;br /&gt;
===Getting C++ program to Exodus Installation===&lt;br /&gt;
&lt;br /&gt;
Two methods: (use the first for one off programs)&lt;br /&gt;
&lt;br /&gt;
====Copy &amp;amp; Paste====&lt;br /&gt;
&lt;br /&gt;
Compile program and open source code in notepad&lt;br /&gt;
&lt;br /&gt;
 ADECOM &amp;lt;programname&amp;gt; (V)&lt;br /&gt;
&lt;br /&gt;
Find which directory the program belongs. e.g fin/med/job/sys e.t&lt;br /&gt;
&lt;br /&gt;
 find /cygdrive/d/exodus/pickos | grep &amp;lt;program name&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If cpp in SYS, the program belongs in ~/exodus/service/src OR if in MED JOB FIN GEN AGY the program belongs in ~/neosys/src&lt;br /&gt;
&lt;br /&gt;
Copy the source code in the text file from the first command.&lt;br /&gt;
&lt;br /&gt;
In Exodus, create a new .cpp (in correct directory) and paste the source code.&lt;br /&gt;
&lt;br /&gt;
Compile &amp;amp; Test&lt;br /&gt;
&lt;br /&gt;
====Rsync====&lt;br /&gt;
&lt;br /&gt;
 /d/exodus/arev/syncup.sh&lt;br /&gt;
&lt;br /&gt;
If cpp in SYS then: ~/exodus/service/src ./getpickos&lt;br /&gt;
&lt;br /&gt;
If cpp in MED JOB FIN GEN AGY then: *~/neosys/src&lt;br /&gt;
&lt;br /&gt;
===Compile C++ files to TEST system===&lt;br /&gt;
&lt;br /&gt;
#*./test &amp;lt;DBNAME&amp;gt;&lt;br /&gt;
#*~/neosys ./doall TEST &amp;lt;DBNAME&amp;gt; restart    #to get one service to start start using the new lib files&lt;br /&gt;
#*~/neosys ./doall TEST all restart         #to get all the services to start start using the new lib files&lt;br /&gt;
&lt;br /&gt;
===Install C++ files to LIVE System===&lt;br /&gt;
&lt;br /&gt;
#~/exodus/service/ ./copyall            #to copy all the ~/lib and bin files to ~/live/lib and bin ... which is used by all exodus/live services&lt;br /&gt;
&lt;br /&gt;
==Writing Standard Exodus Core Function/Method Testing==&lt;br /&gt;
Screen 9: ~/exodus/test/src/&lt;br /&gt;
There are a series of test programs that check whether methods/functions behave as intended.&lt;br /&gt;
They do this using the function, assert.. a 1 or more argument values produce one and only one output)&lt;br /&gt;
&lt;br /&gt;
e.g test_multilang.cpp or test_sort.cpp&lt;br /&gt;
&lt;br /&gt;
Two methods of running test programs:&lt;br /&gt;
*Screen 9: make test&lt;br /&gt;
*after compiling using edic/compile/c, enter test_prog_name. (Since compile has moved it to ~/bin)&lt;br /&gt;
&lt;br /&gt;
Difference between the two methods is make calls gdb directly;&lt;br /&gt;
whereas ~/bin/test_prog_name uses exodus compile program&lt;br /&gt;
#~/neosys ./doall LIVE all restart&lt;br /&gt;
&lt;br /&gt;
==Updating a pgsql function in an exodus dictionary==&lt;br /&gt;
&lt;br /&gt;
PENDING&lt;br /&gt;
&lt;br /&gt;
==Development and deployment using &#039;dat&#039; files==&lt;br /&gt;
&lt;br /&gt;
===Rationale===&lt;br /&gt;
&lt;br /&gt;
Part of system development is the creation of various data that is neither programs nor layout i.e. not cpp, h, html, js, php files etc.&lt;br /&gt;
&lt;br /&gt;
For example:&lt;br /&gt;
&lt;br /&gt;
*Dictionaries are data about data.&lt;br /&gt;
*Language files are data about text to use for various languages.&lt;br /&gt;
*“Change logs” are data about changes in the system.&lt;br /&gt;
&lt;br /&gt;
Historically, in EXODUS and NEOSYS, the above data has been deployed in exodus database files using SQL text files. However SQL files are not convenient for development.&lt;br /&gt;
&lt;br /&gt;
Therefore, &#039;dat&#039; text files will be used now so that standard development tools including editors and git can be fully exploited.&lt;br /&gt;
&lt;br /&gt;
===&#039;dat&#039; files===&lt;br /&gt;
&lt;br /&gt;
Each database file is represented by an os directory of the same name.&lt;br /&gt;
&lt;br /&gt;
Each record in the database file is represented by an os text file where filename is the primary key.&lt;br /&gt;
&lt;br /&gt;
For example a record with key &#039;&#039;&#039;DEADLINE&#039;&#039;&#039; in a dat file &#039;&#039;&#039;dict.materials&#039;&#039;&#039; would be represented as an os text file &#039;&#039;&#039;dat/dict.materials/DEADLINE&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Each line in the os text file represents one field in the db record. In other words, db record FM characters are represented by new line characters in &#039;dat&#039; files. Any actual new line characters required in the record, and any backslashes, are escaped and appear as &#039;\n&#039; and &#039;\\&#039; in &#039;dat&#039; files. Other database field separator characters such as VM, SM, TM and STM are stored without any conversion.&lt;br /&gt;
&lt;br /&gt;
===Location of dat files===&lt;br /&gt;
&lt;br /&gt;
The development versions are stored in exodus and neosys src/dat dirs. They form part of the standard git repositories in parallel with cpp files.&lt;br /&gt;
&lt;br /&gt;
The operational versions are stored in ~/dat and ~/live/dat alongside bin and lib dirs and are automatically installed into databases as database files on service startup. Any database functions embedded in the text files (pgsql) are also automatically installed at the same time.&lt;br /&gt;
&lt;br /&gt;
===Editing and deploying a &#039;dat&#039; file===&lt;br /&gt;
&lt;br /&gt;
It is currently a three step process to edit and deploy such &#039;dat&#039; files. &lt;br /&gt;
&lt;br /&gt;
====Edit the &#039;dat&#039; file====&lt;br /&gt;
&lt;br /&gt;
Note that EXODUS service and NEOSYS service have different src/dat folders.&lt;br /&gt;
&lt;br /&gt;
Editing language items:&lt;br /&gt;
&lt;br /&gt;
 edir dat/alanguage/SCHEDULES*ARABIC&lt;br /&gt;
&lt;br /&gt;
Editing a dictionary item:&lt;br /&gt;
&lt;br /&gt;
 edir dat/dict.materials/DEADLINE&lt;br /&gt;
&lt;br /&gt;
Editing a pgsql function in a dictionary:&lt;br /&gt;
&lt;br /&gt;
 edir dat/dict.materials/DEADLINE 8&lt;br /&gt;
&lt;br /&gt;
====Copy all &#039;dat&#039; files to ~/dat ====&lt;br /&gt;
&lt;br /&gt;
This step might be removed at a later date.&lt;br /&gt;
&lt;br /&gt;
This will cause all test databases to immediately restart and load any &#039;dat&#039; file changes into dictionaries and data files and also create any new or modified pgsql functions.&lt;br /&gt;
&lt;br /&gt;
If any ~/neosys/src/dat files were edited:&lt;br /&gt;
&lt;br /&gt;
 cd ~/neosys/src&lt;br /&gt;
 &lt;br /&gt;
 ./compall dat&lt;br /&gt;
&lt;br /&gt;
and/or, if exodus/service/dat files were edited&lt;br /&gt;
&lt;br /&gt;
 cd ~/exodus/service/src&lt;br /&gt;
 &lt;br /&gt;
 ./compall dat&lt;br /&gt;
&lt;br /&gt;
====Copy all programs and &#039;dat&#039; files to ~/live/bin|lib|dat====&lt;br /&gt;
&lt;br /&gt;
This should only be run after testing. It will cause all live databases to automatically restart and do the same as the test databases mentioned above.&lt;br /&gt;
&lt;br /&gt;
 cd ~/exodus/service&lt;br /&gt;
 &lt;br /&gt;
 ./copyall CONFIRM&lt;br /&gt;
​&lt;br /&gt;
&lt;br /&gt;
==Upgrading Exodus==&lt;br /&gt;
&lt;br /&gt;
#Develop patch in Dev system &lt;br /&gt;
&lt;br /&gt;
===Single Patches===&lt;br /&gt;
&lt;br /&gt;
#Insert patches into various files and compile if necessary&lt;br /&gt;
#If patch dat files then run neosys compall to get dat files into ~/dat&lt;br /&gt;
*If Patsalides:&lt;br /&gt;
*#SITE_DIR=ptcy ./test basic  #requires /etc/systemd/system/agy_test@.service to have been patched like agy_live@.service&lt;br /&gt;
*#web login to BASIC_TEST to test&lt;br /&gt;
*If not patsalides&lt;br /&gt;
*#./test DBCODE&lt;br /&gt;
*#login to DBCODE and test&lt;br /&gt;
#If all ok&lt;br /&gt;
#./copyall &lt;br /&gt;
#CHECK what WILL be copied!&lt;br /&gt;
#Judge if really need to get people off (unlikely for typical patch) and request users to logout for 10 mins&lt;br /&gt;
#./copyall CONFIRM and CHECK what was copied is as per exceptions same as previous step&lt;br /&gt;
#./copyone could be used instead of copyall but it has no test mode and does not copy dat files&lt;br /&gt;
&lt;br /&gt;
===Upgrading to new version===&lt;br /&gt;
&lt;br /&gt;
Use when there are too many changes to do individually patches.&lt;br /&gt;
&lt;br /&gt;
#Inform clients.&lt;br /&gt;
#*Client hosted - Schedule a planned upgrade with client.&lt;br /&gt;
#*NEOSYS hosted - Inform all clients/users of planned morning upgrade, 24hours in advanced.      (TODO: &#039;What&#039;s New in NEOSYS&#039;) AND (emailallusers.cpp)&lt;br /&gt;
#If the morning&#039;s USB backup failed, do NOT continue upgrade procedure because if upgrade fails, we need a way to roll back system to last working state.&lt;br /&gt;
#Check upgrade works on test service using:/root/neosys/upgrade.all.sh test&lt;br /&gt;
#Check the latest patch is working.&lt;br /&gt;
#Run/root/neosys/upgrade.all.sh live&lt;br /&gt;
#Inform users their system has been upgraded and they can login.&lt;br /&gt;
&lt;br /&gt;
===Roll Back Upgrade===&lt;br /&gt;
&lt;br /&gt;
If for any reason the entire upgrade needs to be reverted (excludes clients database), follow steps below:&lt;br /&gt;
&lt;br /&gt;
#Inform users that there is a problem and services need to be stopped.&lt;br /&gt;
#Stop all exodus processes.&lt;br /&gt;
#Restore the morning&#039;s USB backup by: (Note this backup contains:  source/obj code, /etc, neosys scripts but not client data)&lt;br /&gt;
##Login into container&#039;s host and rsync the morning&#039;s usb backup to the container&#039;s /:&lt;br /&gt;
#*&amp;lt;pre&amp;gt;rsync --dry-run -avz -e &#039;ssh -p &amp;lt;C_SSHPORT&amp;gt;&#039; /backups/usb/&amp;lt;C_CODE&amp;gt; &amp;lt;C_CODE&amp;gt;:/      (Example: rsync --dry-run -avz -e &#039;ssh -p 19582&#039; /backups/usb/ad1 ad1:/&amp;lt;/pre&amp;gt;)&lt;br /&gt;
#Quick sane check, the latest git commit is not the latest git commit in the remote repo.&lt;br /&gt;
#Inform users they can login.&lt;br /&gt;
&lt;br /&gt;
==Configuring services to autostart during login==&lt;br /&gt;
For Ptcy.&lt;br /&gt;
&lt;br /&gt;
#Create a file &#039;autostart.cfg&#039; in the data folder &lt;br /&gt;
&lt;br /&gt;
 touch /root/hosts/&amp;lt;dbname&amp;gt;/data/autostart.cfg&lt;br /&gt;
&lt;br /&gt;
This will autostart a database service as long as at least one database service in that directory is running.&lt;br /&gt;
&lt;br /&gt;
For example, demo service will autostart during login if,&lt;br /&gt;
#/root/hosts/demo/data/autostart.cfg exists and&lt;br /&gt;
#demo_test service is running&lt;br /&gt;
&lt;br /&gt;
==Speedup postgresql importing databases==&lt;br /&gt;
&lt;br /&gt;
Can be sped up by a factor of 10 BUT may result in corrupt files in case of hard OS crash where the dirty memory is not flushed to storage.&lt;br /&gt;
&lt;br /&gt;
Therefore it is advisable to use this feature only briefly and REMEMBER TO REMOVE IT! &lt;br /&gt;
&lt;br /&gt;
Email to support@neosys.com whenever using it or use personal notes not memory.&lt;br /&gt;
&lt;br /&gt;
nano /etc/postgresql/12/main/postgresql.conf&lt;br /&gt;
&lt;br /&gt;
Uncomment or add a line&lt;br /&gt;
 fsync = off&lt;br /&gt;
Restart postgres … will break any neosys/exodus running processes.&lt;br /&gt;
 r postgresql&lt;br /&gt;
or reload postgres may also work&lt;br /&gt;
&lt;br /&gt;
===Database Attach===&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
root@exodus:~/exodus/cli/src# dbattach&lt;br /&gt;
dbattach - Attach foreign database files to the current default database&lt;br /&gt;
&lt;br /&gt;
Syntax is dbattach TARGETDB [FILENAME,...] {OPTION...}&lt;br /&gt;
&lt;br /&gt;
Options:&lt;br /&gt;
&lt;br /&gt;
  F   Forcibly delete any normal files in the current default database.&lt;br /&gt;
&lt;br /&gt;
  R   Detach foreign files&lt;br /&gt;
  RR  Remove foreign database connection.&lt;br /&gt;
  RRR Remove all foreign database connections and attachments.&lt;br /&gt;
&lt;br /&gt;
  L   List attached foreign files in the current default database&lt;br /&gt;
&lt;br /&gt;
If no filenames are provided then a database connection is created.&lt;br /&gt;
This is *required* before filenames can be provided and attached.&lt;br /&gt;
&lt;br /&gt;
Notes:&lt;br /&gt;
&lt;br /&gt;
Attachments are permanent until re-attached or removed.&lt;br /&gt;
&lt;br /&gt;
Indexes on attached files behave strangely.&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Issues:&lt;br /&gt;
&lt;br /&gt;
TARGETDB must be on the same connection as the current default database.&lt;br /&gt;
&lt;br /&gt;
Current user must have access to the foreign database.&lt;br /&gt;
&lt;br /&gt;
If EXO_USER and EXO_PASS are not set then exodus defaults are used.&lt;br /&gt;
&lt;br /&gt;
exodus .config file is not used currently.&lt;/div&gt;</summary>
		<author><name>Gregory</name></author>
	</entry>
	<entry>
		<id>https://techwiki.neosys.com/index.php?title=EXODUS_Knowledge&amp;diff=3968</id>
		<title>EXODUS Knowledge</title>
		<link rel="alternate" type="text/html" href="https://techwiki.neosys.com/index.php?title=EXODUS_Knowledge&amp;diff=3968"/>
		<updated>2022-03-16T14:11:40Z</updated>

		<summary type="html">&lt;p&gt;Gregory: /* Upgrading to new version */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==TMUX Screens==&lt;br /&gt;
&lt;br /&gt;
To create the EXODUS maintenance/programming environment&lt;br /&gt;
 exodus#: ./tmux.exodus&lt;br /&gt;
&lt;br /&gt;
===Screens===&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
0: /&lt;br /&gt;
    Work regarding exodus server. i.e /etc/nagios or general networking or /var/log/mail.log&lt;br /&gt;
&lt;br /&gt;
1: /root/exodus/&lt;br /&gt;
    Exodus core is installed Contains build and make libraries here ./libexodus&lt;br /&gt;
&lt;br /&gt;
2: /root/exodus/libexodus/exodus&lt;br /&gt;
    Core exodus (libraries that emulate the AREV system e.g mv.h )&lt;br /&gt;
    &lt;br /&gt;
3: /root/exodus/cli/src&lt;br /&gt;
    Exodus Command Line Interface e.g edir, edic, list, listfiles, delete, createdb&lt;br /&gt;
    &lt;br /&gt;
4: root/exodus/service&lt;br /&gt;
    EXODUS core default host directory but also contains scripts that create/manage requirements of a service (create_service, create_db, create_site, backup_db, restore_db, start, stop, status)&lt;br /&gt;
    One exception is NEOSYS www files are in ./www, which pulled from NEOSYS www git.&lt;br /&gt;
&lt;br /&gt;
5: /root/exodus/service/src&lt;br /&gt;
    Exodus core service programs (programs that are not related to NEOSYS agency operations and can be used to support other non-NEOSYS services) eg listen, usersubs, sendmail, openfile, select, sort, list,.&lt;br /&gt;
&lt;br /&gt;
    Extra info:    &lt;br /&gt;
    sql directory contains basic dictiorary files converted to sql instructions used when creating a EXODUS psql database&lt;br /&gt;
    e.g dict_voc.sql is a file that describes what to expect in certain fields of the voc file.&lt;br /&gt;
    TODO: compall currently throws few warnings. Read them and familiarise. In case new warnings appear, notify Steve.    &lt;br /&gt;
        &lt;br /&gt;
6: /root/neosys&lt;br /&gt;
    NEOSYS specific client installation management scripts e.g .doall, import_db and import_files (from AREV), ./run ./test (see below for these two commands)&lt;br /&gt;
    &lt;br /&gt;
7: /root/neosys/src&lt;br /&gt;
    NEOSYS Agency programs (see section How AREV programs are distributed in EXODUS src/*.cpp&lt;br /&gt;
    ../ has .git&lt;br /&gt;
&lt;br /&gt;
8: /root/hosts&lt;br /&gt;
    client specific files  e.g logs, images, (shared ./www -&amp;gt; root/exodus/service/www&lt;br /&gt;
&lt;br /&gt;
9: /root/exodus/test/src&lt;br /&gt;
    series of programs that test whether subroutines (specifically Exodus core libraries) work as they should eg for the var lib - &amp;quot;assert( var(&amp;quot;11111&amp;quot;).isnum());&amp;quot;&lt;br /&gt;
&lt;br /&gt;
10: bash /bin/top&lt;br /&gt;
    Monitor for NEOSYS client processes&lt;br /&gt;
    Displays customised format: sorted by total time spend and by processor time.&lt;br /&gt;
     Press &amp;quot;=&amp;quot; : to change to standard top format&lt;br /&gt;
     Press shift + w : to save format settings, replacing the old customised top format&lt;br /&gt;
     To go back to the customised format do:&lt;br /&gt;
        Press &amp;quot;o&amp;quot;&lt;br /&gt;
        Type &amp;quot;COMMAND=serve_agy&amp;quot;&lt;br /&gt;
        shift + t : this sorts by total time spent&lt;br /&gt;
        shift + p : this sorts by processor time&lt;br /&gt;
        shift + w : to save this setting and enter  &#039;y&#039; to confirm&lt;br /&gt;
&lt;br /&gt;
11: /var/log/syslog&lt;br /&gt;
     Log of NEOSYS client requests&lt;br /&gt;
&lt;br /&gt;
12: /root/exodus/service/quick&lt;br /&gt;
     Displays the last time the svr file (in /root/hosts/&amp;lt;client&amp;gt;/data/&amp;lt;dbname&amp;gt;) was updated.&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Object Code/Libraries==&lt;br /&gt;
LIVE and TEST processes use different sets of object code.&lt;br /&gt;
TEST processes use libraries in ~/lib/, whereas LIVE processes use object code in ~/neo/lib&lt;br /&gt;
&lt;br /&gt;
This means development &amp;amp; testing can be done stress free on TEST database, as opposed to testing on production databases.&lt;br /&gt;
&lt;br /&gt;
When compiling using edic, the TEST object code is updated if the compilation is successful. (~/lib)&lt;br /&gt;
In order to apply a tested patch to LIVE see [[Update LIVE programs]].&lt;br /&gt;
&lt;br /&gt;
==Dictionaries==&lt;br /&gt;
Dictionaries, the files used to describe the fields of a file&#039;s record.&lt;br /&gt;
Unlike in AREV, there is a copy of all dictionaries in each pgsql database (In AREV, updating a dictionary would affect all the databases).&lt;br /&gt;
&lt;br /&gt;
==Processes==&lt;br /&gt;
The TEST process for all database use the same object code stored in /root/lib, whereas all LIVE process use the object code in /root/neo/.&lt;br /&gt;
&lt;br /&gt;
==Postgres==&lt;br /&gt;
Connect into postgres shell:&lt;br /&gt;
 alias psql=&#039;sudo -u postgres psql&#039;&lt;br /&gt;
&lt;br /&gt;
Delete a database:&lt;br /&gt;
 sudo -u postgres dropdb &amp;lt;dbcode&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Debugging Exodus==&lt;br /&gt;
&lt;br /&gt;
===Debugging Live/Test services===&lt;br /&gt;
&lt;br /&gt;
./test &amp;lt;dbname&amp;gt; - execute test programs on _test database.&lt;br /&gt;
&lt;br /&gt;
./run &amp;lt;dbname&amp;gt;  - execute test programs on live database.&lt;br /&gt;
&lt;br /&gt;
===Debugging var values===&lt;br /&gt;
&lt;br /&gt;
Explanation of var flag value in gdb debug mode.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
(gdb) p varx                                                           &lt;br /&gt;
$2 = {var_str = &amp;quot;&amp;quot;, var_int = 0, var_dbl = 0, var_typ = {flags_ = 2}}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Each exodus var object contains 3 variables of type string, int and double.&lt;br /&gt;
&lt;br /&gt;
All 3 may be unassigned or only the string be assigned or just the int and double e.t.&lt;br /&gt;
&lt;br /&gt;
You can tell which variable type of a var object are set based on the var&#039;s flag value.&lt;br /&gt;
&lt;br /&gt;
1 = Means the string is assigned&lt;br /&gt;
2 = Means the int is assigned&lt;br /&gt;
4 = Means the double is assigned&lt;br /&gt;
&lt;br /&gt;
Example: If the flag is 7 (1+2+4), then all types are assigned.&lt;br /&gt;
&lt;br /&gt;
===Process Hung or consuming +100% CPU===&lt;br /&gt;
If process is consuming +100% CPU then it is likely stuck in an infinite loop.&lt;br /&gt;
&lt;br /&gt;
 ./doall &amp;lt;CLIENT&amp;gt; stop&lt;br /&gt;
&lt;br /&gt;
 ./run &amp;lt;CLIENT&amp;gt; &lt;br /&gt;
&lt;br /&gt;
 ./test &amp;lt;CLIENT&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Search through recent logs for &amp;lt;CLIENT&amp;gt; looking for requests that didn&#039;t return OK at the time nagios alerted of Hung process.&lt;br /&gt;
&lt;br /&gt;
A user may also instigate the error again, so monitor the CLIENT&#039;s service CPU usage.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
If cause found recreate it in test and once test process hit +100% break in test debugger.&lt;br /&gt;
&lt;br /&gt;
If cause not found, you will have to continue checking logs for the request that caused it or hope a user recreates the issue in live debugged service.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Once you&#039;ve broken in the debugged with the error, enter &amp;quot;n&amp;quot; and hold the enter key until you just seeing line repeat.&lt;br /&gt;
&lt;br /&gt;
Pay attention to start of loops code. E.g WHILE or FOR. (there is likely an error is there)&lt;br /&gt;
&lt;br /&gt;
==./doall==&lt;br /&gt;
====General====&lt;br /&gt;
&lt;br /&gt;
~/neosys/doall [LIVE|TEST] &amp;lt;DBCODE|ALL&amp;gt; &amp;lt; ACTION [OPTIONS,..]  | bash -- COMMAND ]&lt;br /&gt;
&lt;br /&gt;
Example: &lt;br /&gt;
 ./doall TEST ALL create_site t-&lt;br /&gt;
Result:&lt;br /&gt;
Create site for ALL TEST databases, using domain name prefix option &amp;quot;t-&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Screen 6: ./doall script contains all the necessary information(codes) to setup an installation.&lt;br /&gt;
It includes scripts to backup, restore, create an Apache site, create/start/stop/status a service, import an AREV database into postgres and more.&lt;br /&gt;
&lt;br /&gt;
====backup_db====&lt;br /&gt;
&lt;br /&gt;
*Does a backup &amp;amp; restore of a LIVE database into the corresponding TEST database.&lt;br /&gt;
*Backup &amp;lt;dbcode&amp;gt;.sql file is written to /root/backups/sql; which is rsynced to nl19:/backups/current/exodus/&lt;br /&gt;
*Unlike AREV, postgres can perform a &amp;quot;backup&amp;quot; of a database whilst the system is in use.&lt;br /&gt;
&lt;br /&gt;
==Git==&lt;br /&gt;
&lt;br /&gt;
There are two repositories, one for EXODUS and the other for NEOSYS.&lt;br /&gt;
&lt;br /&gt;
===Using git to make changes===&lt;br /&gt;
&lt;br /&gt;
Before following steps you must have a tested updated to a program/file/script. Do not commit untested changes to avoid a messy git history of reverts.&lt;br /&gt;
&lt;br /&gt;
Update your local repo before committing to local repo using the g alias for &amp;quot;git pull --ff-only ; git push &amp;amp;&amp;amp; git status&#039;&amp;quot;:&lt;br /&gt;
&amp;lt;pre&amp;gt;g&amp;lt;/pre&amp;gt;&lt;br /&gt;
Check which updates/files have not yet been staged and/or committed:&lt;br /&gt;
Add your updates to the staged area:&lt;br /&gt;
&amp;lt;pre&amp;gt;git add &amp;lt;filename&amp;gt;&amp;lt;/pre&amp;gt;&lt;br /&gt;
or if all the changes made need to be staged:&lt;br /&gt;
&amp;lt;pre&amp;gt;git add -a&amp;lt;/pre&amp;gt;&lt;br /&gt;
Make a commit with a descriptive message on purpose of updates:&lt;br /&gt;
&amp;lt;pre&amp;gt;git commit -m &amp;lt;description n purpose of changes&amp;gt;&amp;lt;/pre&amp;gt;&lt;br /&gt;
Again use g alias:&lt;br /&gt;
&amp;lt;pre&amp;gt;g&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Other useful git cmds===&lt;br /&gt;
&lt;br /&gt;
Do not use this commands unless you know what WILL happen. &lt;br /&gt;
*git pull - Instead use the safe &amp;quot;git pull --ff-only&amp;quot;&lt;br /&gt;
Stick to the alias &amp;quot;g&amp;quot; which does &amp;quot;git pull --ff-only ; git push &amp;amp;&amp;amp; git status&#039;&amp;quot;&lt;br /&gt;
&lt;br /&gt;
*git log - display history of commits to master branch&lt;br /&gt;
*git diff - display the differences in files between working files and files in local repo.&lt;br /&gt;
*git status - display: which updated files are staged/not staged(tracked)&lt;br /&gt;
*git stash - &lt;br /&gt;
*git branch - switch to a new branch&lt;br /&gt;
*git branch &amp;lt;branchname&amp;gt; - will switch to this branch only if it exists&lt;br /&gt;
*git checkout - DESTROYS/Updates the state of local working directory with the state of the files in the local repo. (YOU WILL LOSE non staged updates)&lt;br /&gt;
*git restore &amp;lt;filename&amp;gt; - DESTROYS/Updates the file with the version in the local repo. (like with git checkout but for a specific file)&lt;br /&gt;
*git checkin - &lt;br /&gt;
*git revert &amp;lt;commitHash&amp;gt; - reverses a specific commit (use git log to get the chosen commit hash)&lt;br /&gt;
*git ..&lt;br /&gt;
&lt;br /&gt;
==Converting AREV programs to EXODUS==&lt;br /&gt;
===Decompile AREV to C++===&lt;br /&gt;
&lt;br /&gt;
Do in Master AREV Installation Maintenance mode: (win7)&lt;br /&gt;
&lt;br /&gt;
#ATTACH ADECOMC &lt;br /&gt;
#*ADECOM &amp;lt;programname&amp;gt;   *single program&lt;br /&gt;
#*ADECOM &amp;lt;prog1&amp;gt; &amp;lt;prog2&amp;gt; &lt;br /&gt;
#*ADECOMALL              *all programs   (CHECK FIRST)&lt;br /&gt;
&lt;br /&gt;
Include the option &amp;quot;(V)&amp;quot; in the command to print the C++ to a notepad, which can easily be copy and pasted.&lt;br /&gt;
&lt;br /&gt;
===Getting C++ program to Exodus Installation===&lt;br /&gt;
&lt;br /&gt;
Two methods: (use the first for one off programs)&lt;br /&gt;
&lt;br /&gt;
====Copy &amp;amp; Paste====&lt;br /&gt;
&lt;br /&gt;
Compile program and open source code in notepad&lt;br /&gt;
&lt;br /&gt;
 ADECOM &amp;lt;programname&amp;gt; (V)&lt;br /&gt;
&lt;br /&gt;
Find which directory the program belongs. e.g fin/med/job/sys e.t&lt;br /&gt;
&lt;br /&gt;
 find /cygdrive/d/exodus/pickos | grep &amp;lt;program name&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If cpp in SYS, the program belongs in ~/exodus/service/src OR if in MED JOB FIN GEN AGY the program belongs in ~/neosys/src&lt;br /&gt;
&lt;br /&gt;
Copy the source code in the text file from the first command.&lt;br /&gt;
&lt;br /&gt;
In Exodus, create a new .cpp (in correct directory) and paste the source code.&lt;br /&gt;
&lt;br /&gt;
Compile &amp;amp; Test&lt;br /&gt;
&lt;br /&gt;
====Rsync====&lt;br /&gt;
&lt;br /&gt;
 /d/exodus/arev/syncup.sh&lt;br /&gt;
&lt;br /&gt;
If cpp in SYS then: ~/exodus/service/src ./getpickos&lt;br /&gt;
&lt;br /&gt;
If cpp in MED JOB FIN GEN AGY then: *~/neosys/src&lt;br /&gt;
&lt;br /&gt;
===Compile C++ files to TEST system===&lt;br /&gt;
&lt;br /&gt;
#*./test &amp;lt;DBNAME&amp;gt;&lt;br /&gt;
#*~/neosys ./doall TEST &amp;lt;DBNAME&amp;gt; restart    #to get one service to start start using the new lib files&lt;br /&gt;
#*~/neosys ./doall TEST all restart         #to get all the services to start start using the new lib files&lt;br /&gt;
&lt;br /&gt;
===Install C++ files to LIVE System===&lt;br /&gt;
&lt;br /&gt;
#~/exodus/service/ ./copyall            #to copy all the ~/lib and bin files to ~/live/lib and bin ... which is used by all exodus/live services&lt;br /&gt;
&lt;br /&gt;
==Writing Standard Exodus Core Function/Method Testing==&lt;br /&gt;
Screen 9: ~/exodus/test/src/&lt;br /&gt;
There are a series of test programs that check whether methods/functions behave as intended.&lt;br /&gt;
They do this using the function, assert.. a 1 or more argument values produce one and only one output)&lt;br /&gt;
&lt;br /&gt;
e.g test_multilang.cpp or test_sort.cpp&lt;br /&gt;
&lt;br /&gt;
Two methods of running test programs:&lt;br /&gt;
*Screen 9: make test&lt;br /&gt;
*after compiling using edic/compile/c, enter test_prog_name. (Since compile has moved it to ~/bin)&lt;br /&gt;
&lt;br /&gt;
Difference between the two methods is make calls gdb directly;&lt;br /&gt;
whereas ~/bin/test_prog_name uses exodus compile program&lt;br /&gt;
#~/neosys ./doall LIVE all restart&lt;br /&gt;
&lt;br /&gt;
==Updating a pgsql function in an exodus dictionary==&lt;br /&gt;
&lt;br /&gt;
PENDING&lt;br /&gt;
&lt;br /&gt;
==Development and deployment using &#039;dat&#039; files==&lt;br /&gt;
&lt;br /&gt;
===Rationale===&lt;br /&gt;
&lt;br /&gt;
Part of system development is the creation of various data that is neither programs nor layout i.e. not cpp, h, html, js, php files etc.&lt;br /&gt;
&lt;br /&gt;
For example:&lt;br /&gt;
&lt;br /&gt;
*Dictionaries are data about data.&lt;br /&gt;
*Language files are data about text to use for various languages.&lt;br /&gt;
*“Change logs” are data about changes in the system.&lt;br /&gt;
&lt;br /&gt;
Historically, in EXODUS and NEOSYS, the above data has been deployed in exodus database files using SQL text files. However SQL files are not convenient for development.&lt;br /&gt;
&lt;br /&gt;
Therefore, &#039;dat&#039; text files will be used now so that standard development tools including editors and git can be fully exploited.&lt;br /&gt;
&lt;br /&gt;
===&#039;dat&#039; files===&lt;br /&gt;
&lt;br /&gt;
Each database file is represented by an os directory of the same name.&lt;br /&gt;
&lt;br /&gt;
Each record in the database file is represented by an os text file where filename is the primary key.&lt;br /&gt;
&lt;br /&gt;
For example a record with key &#039;&#039;&#039;DEADLINE&#039;&#039;&#039; in a dat file &#039;&#039;&#039;dict.materials&#039;&#039;&#039; would be represented as an os text file &#039;&#039;&#039;dat/dict.materials/DEADLINE&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Each line in the os text file represents one field in the db record. In other words, db record FM characters are represented by new line characters in &#039;dat&#039; files. Any actual new line characters required in the record, and any backslashes, are escaped and appear as &#039;\n&#039; and &#039;\\&#039; in &#039;dat&#039; files. Other database field separator characters such as VM, SM, TM and STM are stored without any conversion.&lt;br /&gt;
&lt;br /&gt;
===Location of dat files===&lt;br /&gt;
&lt;br /&gt;
The development versions are stored in exodus and neosys src/dat dirs. They form part of the standard git repositories in parallel with cpp files.&lt;br /&gt;
&lt;br /&gt;
The operational versions are stored in ~/dat and ~/live/dat alongside bin and lib dirs and are automatically installed into databases as database files on service startup. Any database functions embedded in the text files (pgsql) are also automatically installed at the same time.&lt;br /&gt;
&lt;br /&gt;
===Editing and deploying a &#039;dat&#039; file===&lt;br /&gt;
&lt;br /&gt;
It is currently a three step process to edit and deploy such &#039;dat&#039; files. &lt;br /&gt;
&lt;br /&gt;
====Edit the &#039;dat&#039; file====&lt;br /&gt;
&lt;br /&gt;
Note that EXODUS service and NEOSYS service have different src/dat folders.&lt;br /&gt;
&lt;br /&gt;
Editing language items:&lt;br /&gt;
&lt;br /&gt;
 edir dat/alanguage/SCHEDULES*ARABIC&lt;br /&gt;
&lt;br /&gt;
Editing a dictionary item:&lt;br /&gt;
&lt;br /&gt;
 edir dat/dict.materials/DEADLINE&lt;br /&gt;
&lt;br /&gt;
Editing a pgsql function in a dictionary:&lt;br /&gt;
&lt;br /&gt;
 edir dat/dict.materials/DEADLINE 8&lt;br /&gt;
&lt;br /&gt;
====Copy all &#039;dat&#039; files to ~/dat ====&lt;br /&gt;
&lt;br /&gt;
This step might be removed at a later date.&lt;br /&gt;
&lt;br /&gt;
This will cause all test databases to immediately restart and load any &#039;dat&#039; file changes into dictionaries and data files and also create any new or modified pgsql functions.&lt;br /&gt;
&lt;br /&gt;
If any ~/neosys/src/dat files were edited:&lt;br /&gt;
&lt;br /&gt;
 cd ~/neosys/src&lt;br /&gt;
 &lt;br /&gt;
 ./compall dat&lt;br /&gt;
&lt;br /&gt;
and/or, if exodus/service/dat files were edited&lt;br /&gt;
&lt;br /&gt;
 cd ~/exodus/service/src&lt;br /&gt;
 &lt;br /&gt;
 ./compall dat&lt;br /&gt;
&lt;br /&gt;
====Copy all programs and &#039;dat&#039; files to ~/live/bin|lib|dat====&lt;br /&gt;
&lt;br /&gt;
This should only be run after testing. It will cause all live databases to automatically restart and do the same as the test databases mentioned above.&lt;br /&gt;
&lt;br /&gt;
 cd ~/exodus/service&lt;br /&gt;
 &lt;br /&gt;
 ./copyall CONFIRM&lt;br /&gt;
​&lt;br /&gt;
&lt;br /&gt;
==Upgrading Exodus==&lt;br /&gt;
&lt;br /&gt;
#Develop patch in Dev system &lt;br /&gt;
&lt;br /&gt;
===Single Patches===&lt;br /&gt;
&lt;br /&gt;
#Insert patches into various files and compile if necessary&lt;br /&gt;
#If patch dat files then run neosys compall to get dat files into ~/dat&lt;br /&gt;
*If Patsalides:&lt;br /&gt;
*#SITE_DIR=ptcy ./run basic&lt;br /&gt;
*#login to BASIC to test&lt;br /&gt;
*If not patsalides&lt;br /&gt;
*#./test DBCODE&lt;br /&gt;
*#login to DBCODE and test&lt;br /&gt;
#If all ok&lt;br /&gt;
#./copyall &lt;br /&gt;
#CHECK what WILL be copied!&lt;br /&gt;
#Judge if really need to get people off (unlikely for typical patch) and request users to logout for 10 mins&lt;br /&gt;
#./copyall CONFIRM and CHECK what was copied is as per exceptions same as previous step&lt;br /&gt;
#./copyone could be used instead of copyall but it has no test mode and does not copy dat files&lt;br /&gt;
&lt;br /&gt;
===Upgrading to new version===&lt;br /&gt;
&lt;br /&gt;
Use when there are too many changes to do individually patches.&lt;br /&gt;
&lt;br /&gt;
#Inform clients.&lt;br /&gt;
#*Client hosted - Schedule a planned upgrade with client.&lt;br /&gt;
#*NEOSYS hosted - Inform all clients/users of planned morning upgrade, 24hours in advanced.      (TODO: &#039;What&#039;s New in NEOSYS&#039;) AND (emailallusers.cpp)&lt;br /&gt;
#If the morning&#039;s USB backup failed, do NOT continue upgrade procedure because if upgrade fails, we need a way to roll back system to last working state.&lt;br /&gt;
#Check upgrade works on test service using:/root/neosys/upgrade.all.sh test&lt;br /&gt;
#Check the latest patch is working.&lt;br /&gt;
#Run/root/neosys/upgrade.all.sh live&lt;br /&gt;
#Inform users their system has been upgraded and they can login.&lt;br /&gt;
&lt;br /&gt;
===Roll Back Upgrade===&lt;br /&gt;
&lt;br /&gt;
If for any reason the entire upgrade needs to be reverted (excludes clients database), follow steps below:&lt;br /&gt;
&lt;br /&gt;
#Inform users that there is a problem and services need to be stopped.&lt;br /&gt;
#Stop all exodus processes.&lt;br /&gt;
#Restore the morning&#039;s USB backup by: (Note this backup contains:  source/obj code, /etc, neosys scripts but not client data)&lt;br /&gt;
##Login into container&#039;s host and rsync the morning&#039;s usb backup to the container&#039;s /:&lt;br /&gt;
#*&amp;lt;pre&amp;gt;rsync --dry-run -avz -e &#039;ssh -p &amp;lt;C_SSHPORT&amp;gt;&#039; /backups/usb/&amp;lt;C_CODE&amp;gt; &amp;lt;C_CODE&amp;gt;:/      (Example: rsync --dry-run -avz -e &#039;ssh -p 19582&#039; /backups/usb/ad1 ad1:/&amp;lt;/pre&amp;gt;)&lt;br /&gt;
#Quick sane check, the latest git commit is not the latest git commit in the remote repo.&lt;br /&gt;
#Inform users they can login.&lt;br /&gt;
&lt;br /&gt;
==Configuring services to autostart during login==&lt;br /&gt;
For Ptcy.&lt;br /&gt;
&lt;br /&gt;
#Create a file &#039;autostart.cfg&#039; in the data folder &lt;br /&gt;
&lt;br /&gt;
 touch /root/hosts/&amp;lt;dbname&amp;gt;/data/autostart.cfg&lt;br /&gt;
&lt;br /&gt;
This will autostart a database service as long as at least one database service in that directory is running.&lt;br /&gt;
&lt;br /&gt;
For example, demo service will autostart during login if,&lt;br /&gt;
#/root/hosts/demo/data/autostart.cfg exists and&lt;br /&gt;
#demo_test service is running&lt;br /&gt;
&lt;br /&gt;
==Speedup postgresql importing databases==&lt;br /&gt;
&lt;br /&gt;
Can be sped up by a factor of 10 BUT may result in corrupt files in case of hard OS crash where the dirty memory is not flushed to storage.&lt;br /&gt;
&lt;br /&gt;
Therefore it is advisable to use this feature only briefly and REMEMBER TO REMOVE IT! &lt;br /&gt;
&lt;br /&gt;
Email to support@neosys.com whenever using it or use personal notes not memory.&lt;br /&gt;
&lt;br /&gt;
nano /etc/postgresql/12/main/postgresql.conf&lt;br /&gt;
&lt;br /&gt;
Uncomment or add a line&lt;br /&gt;
 fsync = off&lt;br /&gt;
Restart postgres … will break any neosys/exodus running processes.&lt;br /&gt;
 r postgresql&lt;br /&gt;
or reload postgres may also work&lt;/div&gt;</summary>
		<author><name>Gregory</name></author>
	</entry>
	<entry>
		<id>https://techwiki.neosys.com/index.php?title=EXODUS_Knowledge&amp;diff=3967</id>
		<title>EXODUS Knowledge</title>
		<link rel="alternate" type="text/html" href="https://techwiki.neosys.com/index.php?title=EXODUS_Knowledge&amp;diff=3967"/>
		<updated>2022-03-16T14:09:48Z</updated>

		<summary type="html">&lt;p&gt;Gregory: /* Upgrading Exodus */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==TMUX Screens==&lt;br /&gt;
&lt;br /&gt;
To create the EXODUS maintenance/programming environment&lt;br /&gt;
 exodus#: ./tmux.exodus&lt;br /&gt;
&lt;br /&gt;
===Screens===&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
0: /&lt;br /&gt;
    Work regarding exodus server. i.e /etc/nagios or general networking or /var/log/mail.log&lt;br /&gt;
&lt;br /&gt;
1: /root/exodus/&lt;br /&gt;
    Exodus core is installed Contains build and make libraries here ./libexodus&lt;br /&gt;
&lt;br /&gt;
2: /root/exodus/libexodus/exodus&lt;br /&gt;
    Core exodus (libraries that emulate the AREV system e.g mv.h )&lt;br /&gt;
    &lt;br /&gt;
3: /root/exodus/cli/src&lt;br /&gt;
    Exodus Command Line Interface e.g edir, edic, list, listfiles, delete, createdb&lt;br /&gt;
    &lt;br /&gt;
4: root/exodus/service&lt;br /&gt;
    EXODUS core default host directory but also contains scripts that create/manage requirements of a service (create_service, create_db, create_site, backup_db, restore_db, start, stop, status)&lt;br /&gt;
    One exception is NEOSYS www files are in ./www, which pulled from NEOSYS www git.&lt;br /&gt;
&lt;br /&gt;
5: /root/exodus/service/src&lt;br /&gt;
    Exodus core service programs (programs that are not related to NEOSYS agency operations and can be used to support other non-NEOSYS services) eg listen, usersubs, sendmail, openfile, select, sort, list,.&lt;br /&gt;
&lt;br /&gt;
    Extra info:    &lt;br /&gt;
    sql directory contains basic dictiorary files converted to sql instructions used when creating a EXODUS psql database&lt;br /&gt;
    e.g dict_voc.sql is a file that describes what to expect in certain fields of the voc file.&lt;br /&gt;
    TODO: compall currently throws few warnings. Read them and familiarise. In case new warnings appear, notify Steve.    &lt;br /&gt;
        &lt;br /&gt;
6: /root/neosys&lt;br /&gt;
    NEOSYS specific client installation management scripts e.g .doall, import_db and import_files (from AREV), ./run ./test (see below for these two commands)&lt;br /&gt;
    &lt;br /&gt;
7: /root/neosys/src&lt;br /&gt;
    NEOSYS Agency programs (see section How AREV programs are distributed in EXODUS src/*.cpp&lt;br /&gt;
    ../ has .git&lt;br /&gt;
&lt;br /&gt;
8: /root/hosts&lt;br /&gt;
    client specific files  e.g logs, images, (shared ./www -&amp;gt; root/exodus/service/www&lt;br /&gt;
&lt;br /&gt;
9: /root/exodus/test/src&lt;br /&gt;
    series of programs that test whether subroutines (specifically Exodus core libraries) work as they should eg for the var lib - &amp;quot;assert( var(&amp;quot;11111&amp;quot;).isnum());&amp;quot;&lt;br /&gt;
&lt;br /&gt;
10: bash /bin/top&lt;br /&gt;
    Monitor for NEOSYS client processes&lt;br /&gt;
    Displays customised format: sorted by total time spend and by processor time.&lt;br /&gt;
     Press &amp;quot;=&amp;quot; : to change to standard top format&lt;br /&gt;
     Press shift + w : to save format settings, replacing the old customised top format&lt;br /&gt;
     To go back to the customised format do:&lt;br /&gt;
        Press &amp;quot;o&amp;quot;&lt;br /&gt;
        Type &amp;quot;COMMAND=serve_agy&amp;quot;&lt;br /&gt;
        shift + t : this sorts by total time spent&lt;br /&gt;
        shift + p : this sorts by processor time&lt;br /&gt;
        shift + w : to save this setting and enter  &#039;y&#039; to confirm&lt;br /&gt;
&lt;br /&gt;
11: /var/log/syslog&lt;br /&gt;
     Log of NEOSYS client requests&lt;br /&gt;
&lt;br /&gt;
12: /root/exodus/service/quick&lt;br /&gt;
     Displays the last time the svr file (in /root/hosts/&amp;lt;client&amp;gt;/data/&amp;lt;dbname&amp;gt;) was updated.&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Object Code/Libraries==&lt;br /&gt;
LIVE and TEST processes use different sets of object code.&lt;br /&gt;
TEST processes use libraries in ~/lib/, whereas LIVE processes use object code in ~/neo/lib&lt;br /&gt;
&lt;br /&gt;
This means development &amp;amp; testing can be done stress free on TEST database, as opposed to testing on production databases.&lt;br /&gt;
&lt;br /&gt;
When compiling using edic, the TEST object code is updated if the compilation is successful. (~/lib)&lt;br /&gt;
In order to apply a tested patch to LIVE see [[Update LIVE programs]].&lt;br /&gt;
&lt;br /&gt;
==Dictionaries==&lt;br /&gt;
Dictionaries, the files used to describe the fields of a file&#039;s record.&lt;br /&gt;
Unlike in AREV, there is a copy of all dictionaries in each pgsql database (In AREV, updating a dictionary would affect all the databases).&lt;br /&gt;
&lt;br /&gt;
==Processes==&lt;br /&gt;
The TEST process for all database use the same object code stored in /root/lib, whereas all LIVE process use the object code in /root/neo/.&lt;br /&gt;
&lt;br /&gt;
==Postgres==&lt;br /&gt;
Connect into postgres shell:&lt;br /&gt;
 alias psql=&#039;sudo -u postgres psql&#039;&lt;br /&gt;
&lt;br /&gt;
Delete a database:&lt;br /&gt;
 sudo -u postgres dropdb &amp;lt;dbcode&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Debugging Exodus==&lt;br /&gt;
&lt;br /&gt;
===Debugging Live/Test services===&lt;br /&gt;
&lt;br /&gt;
./test &amp;lt;dbname&amp;gt; - execute test programs on _test database.&lt;br /&gt;
&lt;br /&gt;
./run &amp;lt;dbname&amp;gt;  - execute test programs on live database.&lt;br /&gt;
&lt;br /&gt;
===Debugging var values===&lt;br /&gt;
&lt;br /&gt;
Explanation of var flag value in gdb debug mode.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
(gdb) p varx                                                           &lt;br /&gt;
$2 = {var_str = &amp;quot;&amp;quot;, var_int = 0, var_dbl = 0, var_typ = {flags_ = 2}}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Each exodus var object contains 3 variables of type string, int and double.&lt;br /&gt;
&lt;br /&gt;
All 3 may be unassigned or only the string be assigned or just the int and double e.t.&lt;br /&gt;
&lt;br /&gt;
You can tell which variable type of a var object are set based on the var&#039;s flag value.&lt;br /&gt;
&lt;br /&gt;
1 = Means the string is assigned&lt;br /&gt;
2 = Means the int is assigned&lt;br /&gt;
4 = Means the double is assigned&lt;br /&gt;
&lt;br /&gt;
Example: If the flag is 7 (1+2+4), then all types are assigned.&lt;br /&gt;
&lt;br /&gt;
===Process Hung or consuming +100% CPU===&lt;br /&gt;
If process is consuming +100% CPU then it is likely stuck in an infinite loop.&lt;br /&gt;
&lt;br /&gt;
 ./doall &amp;lt;CLIENT&amp;gt; stop&lt;br /&gt;
&lt;br /&gt;
 ./run &amp;lt;CLIENT&amp;gt; &lt;br /&gt;
&lt;br /&gt;
 ./test &amp;lt;CLIENT&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Search through recent logs for &amp;lt;CLIENT&amp;gt; looking for requests that didn&#039;t return OK at the time nagios alerted of Hung process.&lt;br /&gt;
&lt;br /&gt;
A user may also instigate the error again, so monitor the CLIENT&#039;s service CPU usage.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
If cause found recreate it in test and once test process hit +100% break in test debugger.&lt;br /&gt;
&lt;br /&gt;
If cause not found, you will have to continue checking logs for the request that caused it or hope a user recreates the issue in live debugged service.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Once you&#039;ve broken in the debugged with the error, enter &amp;quot;n&amp;quot; and hold the enter key until you just seeing line repeat.&lt;br /&gt;
&lt;br /&gt;
Pay attention to start of loops code. E.g WHILE or FOR. (there is likely an error is there)&lt;br /&gt;
&lt;br /&gt;
==./doall==&lt;br /&gt;
====General====&lt;br /&gt;
&lt;br /&gt;
~/neosys/doall [LIVE|TEST] &amp;lt;DBCODE|ALL&amp;gt; &amp;lt; ACTION [OPTIONS,..]  | bash -- COMMAND ]&lt;br /&gt;
&lt;br /&gt;
Example: &lt;br /&gt;
 ./doall TEST ALL create_site t-&lt;br /&gt;
Result:&lt;br /&gt;
Create site for ALL TEST databases, using domain name prefix option &amp;quot;t-&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Screen 6: ./doall script contains all the necessary information(codes) to setup an installation.&lt;br /&gt;
It includes scripts to backup, restore, create an Apache site, create/start/stop/status a service, import an AREV database into postgres and more.&lt;br /&gt;
&lt;br /&gt;
====backup_db====&lt;br /&gt;
&lt;br /&gt;
*Does a backup &amp;amp; restore of a LIVE database into the corresponding TEST database.&lt;br /&gt;
*Backup &amp;lt;dbcode&amp;gt;.sql file is written to /root/backups/sql; which is rsynced to nl19:/backups/current/exodus/&lt;br /&gt;
*Unlike AREV, postgres can perform a &amp;quot;backup&amp;quot; of a database whilst the system is in use.&lt;br /&gt;
&lt;br /&gt;
==Git==&lt;br /&gt;
&lt;br /&gt;
There are two repositories, one for EXODUS and the other for NEOSYS.&lt;br /&gt;
&lt;br /&gt;
===Using git to make changes===&lt;br /&gt;
&lt;br /&gt;
Before following steps you must have a tested updated to a program/file/script. Do not commit untested changes to avoid a messy git history of reverts.&lt;br /&gt;
&lt;br /&gt;
Update your local repo before committing to local repo using the g alias for &amp;quot;git pull --ff-only ; git push &amp;amp;&amp;amp; git status&#039;&amp;quot;:&lt;br /&gt;
&amp;lt;pre&amp;gt;g&amp;lt;/pre&amp;gt;&lt;br /&gt;
Check which updates/files have not yet been staged and/or committed:&lt;br /&gt;
Add your updates to the staged area:&lt;br /&gt;
&amp;lt;pre&amp;gt;git add &amp;lt;filename&amp;gt;&amp;lt;/pre&amp;gt;&lt;br /&gt;
or if all the changes made need to be staged:&lt;br /&gt;
&amp;lt;pre&amp;gt;git add -a&amp;lt;/pre&amp;gt;&lt;br /&gt;
Make a commit with a descriptive message on purpose of updates:&lt;br /&gt;
&amp;lt;pre&amp;gt;git commit -m &amp;lt;description n purpose of changes&amp;gt;&amp;lt;/pre&amp;gt;&lt;br /&gt;
Again use g alias:&lt;br /&gt;
&amp;lt;pre&amp;gt;g&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Other useful git cmds===&lt;br /&gt;
&lt;br /&gt;
Do not use this commands unless you know what WILL happen. &lt;br /&gt;
*git pull - Instead use the safe &amp;quot;git pull --ff-only&amp;quot;&lt;br /&gt;
Stick to the alias &amp;quot;g&amp;quot; which does &amp;quot;git pull --ff-only ; git push &amp;amp;&amp;amp; git status&#039;&amp;quot;&lt;br /&gt;
&lt;br /&gt;
*git log - display history of commits to master branch&lt;br /&gt;
*git diff - display the differences in files between working files and files in local repo.&lt;br /&gt;
*git status - display: which updated files are staged/not staged(tracked)&lt;br /&gt;
*git stash - &lt;br /&gt;
*git branch - switch to a new branch&lt;br /&gt;
*git branch &amp;lt;branchname&amp;gt; - will switch to this branch only if it exists&lt;br /&gt;
*git checkout - DESTROYS/Updates the state of local working directory with the state of the files in the local repo. (YOU WILL LOSE non staged updates)&lt;br /&gt;
*git restore &amp;lt;filename&amp;gt; - DESTROYS/Updates the file with the version in the local repo. (like with git checkout but for a specific file)&lt;br /&gt;
*git checkin - &lt;br /&gt;
*git revert &amp;lt;commitHash&amp;gt; - reverses a specific commit (use git log to get the chosen commit hash)&lt;br /&gt;
*git ..&lt;br /&gt;
&lt;br /&gt;
==Converting AREV programs to EXODUS==&lt;br /&gt;
===Decompile AREV to C++===&lt;br /&gt;
&lt;br /&gt;
Do in Master AREV Installation Maintenance mode: (win7)&lt;br /&gt;
&lt;br /&gt;
#ATTACH ADECOMC &lt;br /&gt;
#*ADECOM &amp;lt;programname&amp;gt;   *single program&lt;br /&gt;
#*ADECOM &amp;lt;prog1&amp;gt; &amp;lt;prog2&amp;gt; &lt;br /&gt;
#*ADECOMALL              *all programs   (CHECK FIRST)&lt;br /&gt;
&lt;br /&gt;
Include the option &amp;quot;(V)&amp;quot; in the command to print the C++ to a notepad, which can easily be copy and pasted.&lt;br /&gt;
&lt;br /&gt;
===Getting C++ program to Exodus Installation===&lt;br /&gt;
&lt;br /&gt;
Two methods: (use the first for one off programs)&lt;br /&gt;
&lt;br /&gt;
====Copy &amp;amp; Paste====&lt;br /&gt;
&lt;br /&gt;
Compile program and open source code in notepad&lt;br /&gt;
&lt;br /&gt;
 ADECOM &amp;lt;programname&amp;gt; (V)&lt;br /&gt;
&lt;br /&gt;
Find which directory the program belongs. e.g fin/med/job/sys e.t&lt;br /&gt;
&lt;br /&gt;
 find /cygdrive/d/exodus/pickos | grep &amp;lt;program name&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If cpp in SYS, the program belongs in ~/exodus/service/src OR if in MED JOB FIN GEN AGY the program belongs in ~/neosys/src&lt;br /&gt;
&lt;br /&gt;
Copy the source code in the text file from the first command.&lt;br /&gt;
&lt;br /&gt;
In Exodus, create a new .cpp (in correct directory) and paste the source code.&lt;br /&gt;
&lt;br /&gt;
Compile &amp;amp; Test&lt;br /&gt;
&lt;br /&gt;
====Rsync====&lt;br /&gt;
&lt;br /&gt;
 /d/exodus/arev/syncup.sh&lt;br /&gt;
&lt;br /&gt;
If cpp in SYS then: ~/exodus/service/src ./getpickos&lt;br /&gt;
&lt;br /&gt;
If cpp in MED JOB FIN GEN AGY then: *~/neosys/src&lt;br /&gt;
&lt;br /&gt;
===Compile C++ files to TEST system===&lt;br /&gt;
&lt;br /&gt;
#*./test &amp;lt;DBNAME&amp;gt;&lt;br /&gt;
#*~/neosys ./doall TEST &amp;lt;DBNAME&amp;gt; restart    #to get one service to start start using the new lib files&lt;br /&gt;
#*~/neosys ./doall TEST all restart         #to get all the services to start start using the new lib files&lt;br /&gt;
&lt;br /&gt;
===Install C++ files to LIVE System===&lt;br /&gt;
&lt;br /&gt;
#~/exodus/service/ ./copyall            #to copy all the ~/lib and bin files to ~/live/lib and bin ... which is used by all exodus/live services&lt;br /&gt;
&lt;br /&gt;
==Writing Standard Exodus Core Function/Method Testing==&lt;br /&gt;
Screen 9: ~/exodus/test/src/&lt;br /&gt;
There are a series of test programs that check whether methods/functions behave as intended.&lt;br /&gt;
They do this using the function, assert.. a 1 or more argument values produce one and only one output)&lt;br /&gt;
&lt;br /&gt;
e.g test_multilang.cpp or test_sort.cpp&lt;br /&gt;
&lt;br /&gt;
Two methods of running test programs:&lt;br /&gt;
*Screen 9: make test&lt;br /&gt;
*after compiling using edic/compile/c, enter test_prog_name. (Since compile has moved it to ~/bin)&lt;br /&gt;
&lt;br /&gt;
Difference between the two methods is make calls gdb directly;&lt;br /&gt;
whereas ~/bin/test_prog_name uses exodus compile program&lt;br /&gt;
#~/neosys ./doall LIVE all restart&lt;br /&gt;
&lt;br /&gt;
==Updating a pgsql function in an exodus dictionary==&lt;br /&gt;
&lt;br /&gt;
PENDING&lt;br /&gt;
&lt;br /&gt;
==Development and deployment using &#039;dat&#039; files==&lt;br /&gt;
&lt;br /&gt;
===Rationale===&lt;br /&gt;
&lt;br /&gt;
Part of system development is the creation of various data that is neither programs nor layout i.e. not cpp, h, html, js, php files etc.&lt;br /&gt;
&lt;br /&gt;
For example:&lt;br /&gt;
&lt;br /&gt;
*Dictionaries are data about data.&lt;br /&gt;
*Language files are data about text to use for various languages.&lt;br /&gt;
*“Change logs” are data about changes in the system.&lt;br /&gt;
&lt;br /&gt;
Historically, in EXODUS and NEOSYS, the above data has been deployed in exodus database files using SQL text files. However SQL files are not convenient for development.&lt;br /&gt;
&lt;br /&gt;
Therefore, &#039;dat&#039; text files will be used now so that standard development tools including editors and git can be fully exploited.&lt;br /&gt;
&lt;br /&gt;
===&#039;dat&#039; files===&lt;br /&gt;
&lt;br /&gt;
Each database file is represented by an os directory of the same name.&lt;br /&gt;
&lt;br /&gt;
Each record in the database file is represented by an os text file where filename is the primary key.&lt;br /&gt;
&lt;br /&gt;
For example a record with key &#039;&#039;&#039;DEADLINE&#039;&#039;&#039; in a dat file &#039;&#039;&#039;dict.materials&#039;&#039;&#039; would be represented as an os text file &#039;&#039;&#039;dat/dict.materials/DEADLINE&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Each line in the os text file represents one field in the db record. In other words, db record FM characters are represented by new line characters in &#039;dat&#039; files. Any actual new line characters required in the record, and any backslashes, are escaped and appear as &#039;\n&#039; and &#039;\\&#039; in &#039;dat&#039; files. Other database field separator characters such as VM, SM, TM and STM are stored without any conversion.&lt;br /&gt;
&lt;br /&gt;
===Location of dat files===&lt;br /&gt;
&lt;br /&gt;
The development versions are stored in exodus and neosys src/dat dirs. They form part of the standard git repositories in parallel with cpp files.&lt;br /&gt;
&lt;br /&gt;
The operational versions are stored in ~/dat and ~/live/dat alongside bin and lib dirs and are automatically installed into databases as database files on service startup. Any database functions embedded in the text files (pgsql) are also automatically installed at the same time.&lt;br /&gt;
&lt;br /&gt;
===Editing and deploying a &#039;dat&#039; file===&lt;br /&gt;
&lt;br /&gt;
It is currently a three step process to edit and deploy such &#039;dat&#039; files. &lt;br /&gt;
&lt;br /&gt;
====Edit the &#039;dat&#039; file====&lt;br /&gt;
&lt;br /&gt;
Note that EXODUS service and NEOSYS service have different src/dat folders.&lt;br /&gt;
&lt;br /&gt;
Editing language items:&lt;br /&gt;
&lt;br /&gt;
 edir dat/alanguage/SCHEDULES*ARABIC&lt;br /&gt;
&lt;br /&gt;
Editing a dictionary item:&lt;br /&gt;
&lt;br /&gt;
 edir dat/dict.materials/DEADLINE&lt;br /&gt;
&lt;br /&gt;
Editing a pgsql function in a dictionary:&lt;br /&gt;
&lt;br /&gt;
 edir dat/dict.materials/DEADLINE 8&lt;br /&gt;
&lt;br /&gt;
====Copy all &#039;dat&#039; files to ~/dat ====&lt;br /&gt;
&lt;br /&gt;
This step might be removed at a later date.&lt;br /&gt;
&lt;br /&gt;
This will cause all test databases to immediately restart and load any &#039;dat&#039; file changes into dictionaries and data files and also create any new or modified pgsql functions.&lt;br /&gt;
&lt;br /&gt;
If any ~/neosys/src/dat files were edited:&lt;br /&gt;
&lt;br /&gt;
 cd ~/neosys/src&lt;br /&gt;
 &lt;br /&gt;
 ./compall dat&lt;br /&gt;
&lt;br /&gt;
and/or, if exodus/service/dat files were edited&lt;br /&gt;
&lt;br /&gt;
 cd ~/exodus/service/src&lt;br /&gt;
 &lt;br /&gt;
 ./compall dat&lt;br /&gt;
&lt;br /&gt;
====Copy all programs and &#039;dat&#039; files to ~/live/bin|lib|dat====&lt;br /&gt;
&lt;br /&gt;
This should only be run after testing. It will cause all live databases to automatically restart and do the same as the test databases mentioned above.&lt;br /&gt;
&lt;br /&gt;
 cd ~/exodus/service&lt;br /&gt;
 &lt;br /&gt;
 ./copyall CONFIRM&lt;br /&gt;
​&lt;br /&gt;
&lt;br /&gt;
==Upgrading Exodus==&lt;br /&gt;
&lt;br /&gt;
#Develop patch in Dev system &lt;br /&gt;
&lt;br /&gt;
===Single Patches===&lt;br /&gt;
&lt;br /&gt;
#Insert patches into various files and compile if necessary&lt;br /&gt;
#If patch dat files then run neosys compall to get dat files into ~/dat&lt;br /&gt;
*If Patsalides:&lt;br /&gt;
*#SITE_DIR=ptcy ./run basic&lt;br /&gt;
*#login to BASIC to test&lt;br /&gt;
*If not patsalides&lt;br /&gt;
*#./test DBCODE&lt;br /&gt;
*#login to DBCODE and test&lt;br /&gt;
#If all ok&lt;br /&gt;
#./copyall &lt;br /&gt;
#CHECK what WILL be copied!&lt;br /&gt;
#Judge if really need to get people off (unlikely for typical patch) and request users to logout for 10 mins&lt;br /&gt;
#./copyall CONFIRM and CHECK what was copied is as per exceptions same as previous step&lt;br /&gt;
#./copyone could be used instead of copyall but it has no test mode and does not copy dat files&lt;br /&gt;
&lt;br /&gt;
===Upgrading to new version===&lt;br /&gt;
&lt;br /&gt;
Many patches.&lt;br /&gt;
&lt;br /&gt;
#Inform clients.&lt;br /&gt;
#*Client hosted - Schedule a planned upgrade with client.&lt;br /&gt;
#*NEOSYS hosted - Inform all clients/users of planned morning upgrade, 24hours in advanced.      (TODO: &#039;What&#039;s New in NEOSYS&#039;) AND (emailallusers.cpp)&lt;br /&gt;
#If the morning&#039;s USB backup failed, do NOT continue upgrade procedure because if upgrade fails, we need a way to roll back system to last working state.&lt;br /&gt;
#Check upgrade works on test service using:/root/neosys/upgrade.all.sh test&lt;br /&gt;
#Check the latest patch is working.&lt;br /&gt;
#Run/root/neosys/upgrade.all.sh live&lt;br /&gt;
#Inform users their system has been upgraded and they can login.&lt;br /&gt;
&lt;br /&gt;
===Roll Back Upgrade===&lt;br /&gt;
&lt;br /&gt;
If for any reason the entire upgrade needs to be reverted (excludes clients database), follow steps below:&lt;br /&gt;
&lt;br /&gt;
#Inform users that there is a problem and services need to be stopped.&lt;br /&gt;
#Stop all exodus processes.&lt;br /&gt;
#Restore the morning&#039;s USB backup by: (Note this backup contains:  source/obj code, /etc, neosys scripts but not client data)&lt;br /&gt;
##Login into container&#039;s host and rsync the morning&#039;s usb backup to the container&#039;s /:&lt;br /&gt;
#*&amp;lt;pre&amp;gt;rsync --dry-run -avz -e &#039;ssh -p &amp;lt;C_SSHPORT&amp;gt;&#039; /backups/usb/&amp;lt;C_CODE&amp;gt; &amp;lt;C_CODE&amp;gt;:/      (Example: rsync --dry-run -avz -e &#039;ssh -p 19582&#039; /backups/usb/ad1 ad1:/&amp;lt;/pre&amp;gt;)&lt;br /&gt;
#Quick sane check, the latest git commit is not the latest git commit in the remote repo.&lt;br /&gt;
#Inform users they can login.&lt;br /&gt;
&lt;br /&gt;
==Configuring services to autostart during login==&lt;br /&gt;
For Ptcy.&lt;br /&gt;
&lt;br /&gt;
#Create a file &#039;autostart.cfg&#039; in the data folder &lt;br /&gt;
&lt;br /&gt;
 touch /root/hosts/&amp;lt;dbname&amp;gt;/data/autostart.cfg&lt;br /&gt;
&lt;br /&gt;
This will autostart a database service as long as at least one database service in that directory is running.&lt;br /&gt;
&lt;br /&gt;
For example, demo service will autostart during login if,&lt;br /&gt;
#/root/hosts/demo/data/autostart.cfg exists and&lt;br /&gt;
#demo_test service is running&lt;br /&gt;
&lt;br /&gt;
==Speedup postgresql importing databases==&lt;br /&gt;
&lt;br /&gt;
Can be sped up by a factor of 10 BUT may result in corrupt files in case of hard OS crash where the dirty memory is not flushed to storage.&lt;br /&gt;
&lt;br /&gt;
Therefore it is advisable to use this feature only briefly and REMEMBER TO REMOVE IT! &lt;br /&gt;
&lt;br /&gt;
Email to support@neosys.com whenever using it or use personal notes not memory.&lt;br /&gt;
&lt;br /&gt;
nano /etc/postgresql/12/main/postgresql.conf&lt;br /&gt;
&lt;br /&gt;
Uncomment or add a line&lt;br /&gt;
 fsync = off&lt;br /&gt;
Restart postgres … will break any neosys/exodus running processes.&lt;br /&gt;
 r postgresql&lt;br /&gt;
or reload postgres may also work&lt;/div&gt;</summary>
		<author><name>Gregory</name></author>
	</entry>
	<entry>
		<id>https://techwiki.neosys.com/index.php?title=Configuring_Thunderbird&amp;diff=3966</id>
		<title>Configuring Thunderbird</title>
		<link rel="alternate" type="text/html" href="https://techwiki.neosys.com/index.php?title=Configuring_Thunderbird&amp;diff=3966"/>
		<updated>2022-03-14T07:27:54Z</updated>

		<summary type="html">&lt;p&gt;Gregory: /* Tags */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
==Setting Up the Inbox Accounts==&lt;br /&gt;
&lt;br /&gt;
The instructions given below explain how to set up the &amp;quot;Support&amp;quot; account on Thunderbird.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
1. Open Mozilla Thunderbird. Choose the &amp;quot;Create a new account&amp;quot; option. Click on &amp;quot;Skip this and use my existing email&amp;quot; option on the &amp;quot;Welcome to Thunderbird&amp;quot; window.&lt;br /&gt;
&lt;br /&gt;
[[File:Thunderbird_1.jpg]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
2. In the Mail Account Setup window, enter &amp;quot;support@neosys.com&amp;quot; for Your Name, &amp;quot;support@neosys.com&amp;quot; for Email Address and the password provided by Neosys staff. Click on continue.&lt;br /&gt;
&lt;br /&gt;
[[File:Thunderbird_2.jpg]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
3. Click on &amp;quot;Manual Config&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
[[File:Thunderbird_3.jpg]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
4. Key in &amp;quot;imap.neosys.com&amp;quot; for incoming IMAP host name, server hostname &amp;quot;smtp.neosys.com&amp;quot; and port &amp;quot;587&amp;quot; for outgoing SMTP and &amp;quot;support.neosys&amp;quot; as username. For SMTP, change the SSL to &amp;quot;STARTTLS&amp;quot; and authentication to &amp;quot;No authentication&amp;quot;. Click on the &amp;quot;Re-test&amp;quot; button and then click &amp;quot;Done&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
[[File:Thunderbird_4.jpg]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
BEFORE clicking on inbox and BEFORE adding other inboxes, you MUST refer to [[Configuring_Thunderbird#Adding_email_accounts_with_large_numbers_of_emails | Adding email accounts with large numbers of emails]]. This is because if you add all the accounts together at once, they will all sync together and it will take 1-2 days for the sync to complete.&lt;br /&gt;
&lt;br /&gt;
For backups@neosys.com, support2@neosys.com (Nagios), name.neosys@gmail.com repeat the steps mentioned above, with the below-mentioned replacements.&lt;br /&gt;
&lt;br /&gt;
1. For backups@neosys.com, enter &amp;quot;backups@neosys.com&amp;quot; for Your Name, &amp;quot;backups@neosys.com&amp;quot; for Email address and enter the password provided by Neosys staff.&lt;br /&gt;
Enter the username as &amp;quot;backups.neosys&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
2. For support2@neosys.com, enter &amp;quot;support2@neosys.com&amp;quot; for Your Name, &amp;quot;support2@neosys.com&amp;quot; for Email address and enter the password provided by Neosys staff.&lt;br /&gt;
Enter the username as &amp;quot;support2.neosys&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
3. For name.neosys@gmail.com, enter your full name for Your Name, &amp;quot;name.neosys@gmail.com&amp;quot; for Email address and enter the password. You do not need to follow the steps for manual config as the settings will be automatically configured.&lt;br /&gt;
&lt;br /&gt;
[[File:thunderbird_6.jpg]]&lt;br /&gt;
&lt;br /&gt;
[[File:thunderbird_7.jpg]]&lt;br /&gt;
&lt;br /&gt;
==Account Settings==&lt;br /&gt;
&lt;br /&gt;
Verify that the account settings for all the accounts are entered as shown below.&lt;br /&gt;
&lt;br /&gt;
[[File:acsettings1.jpg]]&lt;br /&gt;
&lt;br /&gt;
[[File:acsettings2.jpg]]&lt;br /&gt;
&lt;br /&gt;
[[File:acsettings3.jpg]]&lt;br /&gt;
&lt;br /&gt;
[[File:acsettings4.jpg]]&lt;br /&gt;
&lt;br /&gt;
[[File:Account junk.jpg|500px]]&lt;br /&gt;
&lt;br /&gt;
For backups@neosys.com account, under &amp;quot;Synchronization and Storage&amp;quot;, change the setting to &amp;quot;Delete messages more than 365 days old&amp;quot;&lt;br /&gt;
&lt;br /&gt;
The Synchronisation &amp;amp; Storage settings should be changed to the settings shown below only at a convenient time, since downloading all the emails will take a lot of time for accounts with large number of emails. Also see [[Configuring_Thunderbird#Adding_email_accounts_with_large_numbers_of_emails |Adding email accounts with large number of emails]]&lt;br /&gt;
&lt;br /&gt;
[[File:acsettings6.jpg]]&lt;br /&gt;
&lt;br /&gt;
[[File:acsettings7.jpg]]&lt;br /&gt;
&lt;br /&gt;
[[File:acsettings8.jpg]]&lt;br /&gt;
&lt;br /&gt;
===Adding email accounts with large numbers of emails===&lt;br /&gt;
&lt;br /&gt;
After adding email accounts with large numbers of emails, in order to avoid long wait while downloading all the emails, it is best to change the account settings - BEFORE clicking on INBOX, which triggers the download/sync - to download the bodies of only the last 30 days of emails. The email headings are always synced but that does not take long.&lt;br /&gt;
&lt;br /&gt;
See Account Settings, Synchronisation and Storage.&lt;br /&gt;
&lt;br /&gt;
Since searching of emails only works when the bodies of emails have been downloaded, if you need to text search all emails, then, at a convenient time, you can remove or increase the number of days in the setting and somehow trigger the full sync.&lt;br /&gt;
&lt;br /&gt;
[[File:thla.jpg]]&lt;br /&gt;
&lt;br /&gt;
===Configuring Outgoing SMTP Mail Servers===&lt;br /&gt;
&lt;br /&gt;
By default Thunderbird adds a new smtp profile with each Inbox added.&lt;br /&gt;
&lt;br /&gt;
However you only need two, main and backup. &lt;br /&gt;
&lt;br /&gt;
1. Right click on any Inbox &amp;gt; Settings.&lt;br /&gt;
&lt;br /&gt;
2. Scroll down and click &amp;quot;Outgoing Server (SMTP)&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
3. Delete all smtp server profiles except the default and ensure your settings match below screenshot.&lt;br /&gt;
[[File:Smtpsettings.png]]&lt;br /&gt;
&lt;br /&gt;
4. Add a new profile with settings in below screenshot.&lt;br /&gt;
&lt;br /&gt;
TODO - setup backup imap2 container and add settings screenshot here. (old imap2 smtp port 2500)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Add-ons==&lt;br /&gt;
&lt;br /&gt;
#Install addons: General settings menu (Top right 3 bars) &amp;gt; Addons &lt;br /&gt;
#Search and install the addons in below screenshot.&lt;br /&gt;
#Configure Mailbox Alert by Right e.g support inbox &amp;gt; Mailbox Alert: &lt;br /&gt;
##Check default sound and message.&lt;br /&gt;
[[File:Addon2.png]]&lt;br /&gt;
&lt;br /&gt;
==Other General Configurations==&lt;br /&gt;
&lt;br /&gt;
===Configure inbox to display selected columns===&lt;br /&gt;
&lt;br /&gt;
The below options MUST be set in Support Inbox. To do so Right click on a column heading and select the below options:  &lt;br /&gt;
&lt;br /&gt;
#Thread&lt;br /&gt;
#Starred&lt;br /&gt;
#Attachment&lt;br /&gt;
#Subject&lt;br /&gt;
#Correspondents&lt;br /&gt;
#Received: You MUST add column RECEIVED which is the email date received to email inbox because the default Date seems to be the DATE SENT whereas we are primarily interested in the date we received the email. The difference is due to delays in email servers or spam tricks.&lt;br /&gt;
&lt;br /&gt;
The below options MUST NOT be set in Support Inbox&lt;br /&gt;
&lt;br /&gt;
#Junk status: Emails will automatically be moved to Junk folder if the junk icon in this column is clicked. Hence remove Junk Status column so that emails are not accidentally moved to junk. To remove, right-click on a column heading and untick &amp;quot;Junk Status&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
===Configure Mail Content===&lt;br /&gt;
&lt;br /&gt;
Preferences &amp;gt; Privacy &amp;gt; untick &amp;quot;Allow remote content in messages&amp;quot;&lt;br /&gt;
&lt;br /&gt;
Support MUST set the &amp;quot;Allow remote content in messages&amp;quot; as blocked in Thunderbird without adding any exceptions for any email id. The reason is remote content i.e embedded images, stylesheets etc is a privacy concern as it sends your private information to the mail sender. We do not know the source of these embedded content in emails so cannot trust them as they can be web bugs.&lt;br /&gt;
&lt;br /&gt;
===Configure Layout View===&lt;br /&gt;
&lt;br /&gt;
Layout view should be set as Vertical view.&lt;br /&gt;
&lt;br /&gt;
===Thunderbird Preferences===&lt;br /&gt;
&lt;br /&gt;
#Preferences &amp;gt; Display &amp;gt; Advanced &amp;gt; untick &amp;quot; Automatically mark messages as read&amp;quot;.&lt;br /&gt;
#Keep settings as below for Preferences &amp;gt; Security.&lt;br /&gt;
#Keep settings as below for Preferences &amp;gt; Composition &amp;gt; Spelling.&lt;br /&gt;
&lt;br /&gt;
[[File:Globaljunk.jpg|500px]]&lt;br /&gt;
&lt;br /&gt;
[[File:Composition.png|500px]]&lt;br /&gt;
&lt;br /&gt;
===Configure MailAlert===&lt;br /&gt;
&lt;br /&gt;
Right click Inbox &amp;gt; Mailbox Alert &amp;gt; Edit Mailbox Alert alerts &amp;gt; Select Default message. Set as below. Once set Right click Inbox &amp;gt; Mailbox Alert &amp;gt; check Default message&lt;br /&gt;
&lt;br /&gt;
[[file:thsh.jpg]]&lt;br /&gt;
&lt;br /&gt;
===Configure Auto Resize Image===&lt;br /&gt;
&lt;br /&gt;
Set the preferences for the Auto Resize Image add-on as shown in the screenshot at the end of this section.&lt;br /&gt;
&lt;br /&gt;
To handle different scenarios when resizing images in emails, follow the below steps:&lt;br /&gt;
&lt;br /&gt;
*Resize all images in the email: Click &amp;quot;Send&amp;quot; followed by &amp;quot;Confirm&amp;quot; on the Auto resize screen.&lt;br /&gt;
&lt;br /&gt;
*Skip resize all images in the email: Click &amp;quot;Send&amp;quot; followed by &amp;quot;Cancel Resizing&amp;quot; on the Auto resize screen.&lt;br /&gt;
&lt;br /&gt;
*Resize Images only in the email trail and skip resizing new images: Click &amp;quot;Resize&amp;quot; on top of your screen and proceed with writing the email/adding new images. When ready to send the email, follow above step for skipping resize all images in the email.&lt;br /&gt;
&lt;br /&gt;
[[File:Resize2.png]]&lt;br /&gt;
&lt;br /&gt;
===Configure Header Tools Lite===&lt;br /&gt;
&lt;br /&gt;
Set the preferences for the Header Tools Lite add-on as shown in the screenshot below.&lt;br /&gt;
&lt;br /&gt;
[[File:headertoolslite.jpg]]&lt;br /&gt;
&lt;br /&gt;
===Configure Dorando Keyconfig===&lt;br /&gt;
&lt;br /&gt;
Menu &amp;gt; Add-ons &amp;gt; Edit Keyconfig Preferences &amp;gt; Disable shortcuts for &#039;Archive&#039; and &#039;Junk&#039; as shown in the screenshots below.&lt;br /&gt;
&lt;br /&gt;
[[File:Keyconfig1.png]]&lt;br /&gt;
&lt;br /&gt;
[[File:Keyconfig2.png]]&lt;br /&gt;
&lt;br /&gt;
===Getting access to NEOSYS support calendar===&lt;br /&gt;
&lt;br /&gt;
After confirming that the steps below are successfully done, delete your local personal calendar and make the shared support calendar the default.&lt;br /&gt;
&lt;br /&gt;
In Thunderbird, add a new CalDAV network calendar by navigating to File (Alt+f) -&amp;gt; New -&amp;gt; Calendar.&lt;br /&gt;
&lt;br /&gt;
You will have to enter your nextcloud user and pass.&lt;br /&gt;
&lt;br /&gt;
[[File:Cal1.png]]&lt;br /&gt;
&lt;br /&gt;
Location: https://nextcloud.hosts.neosys.com:44318/remote.php/dav/calendars/support/support_shared_by_steve/&lt;br /&gt;
&lt;br /&gt;
[[File:Cal2.png]]&lt;br /&gt;
&lt;br /&gt;
[[File:Cal3.png]]&lt;br /&gt;
&lt;br /&gt;
It should show a tick if successful, otherwise you will have to Unsubscribe and try again.&lt;br /&gt;
&lt;br /&gt;
[[File:Cal4.png]]&lt;br /&gt;
&lt;br /&gt;
Change the new calendar properties to Refresh every 5 mins.&lt;br /&gt;
&lt;br /&gt;
[[File:Cal5.png]]&lt;br /&gt;
&lt;br /&gt;
===Applying filter for backup failure emails===&lt;br /&gt;
&lt;br /&gt;
In order to filter any backup failure emails as Important, go to Tools &amp;gt; Message Filters and create a new filter with settings as shown below:&lt;br /&gt;
&lt;br /&gt;
Refer to filters list of other staff members.&lt;br /&gt;
&lt;br /&gt;
===Tags===&lt;br /&gt;
&lt;br /&gt;
Find the prefs.js file in your profile directory:&lt;br /&gt;
 find ~/.thunderbird/ -name prefs.js &lt;br /&gt;
Edit the prefs.js file&lt;br /&gt;
 nano /home/gregory/.thunderbird/s3bqjf24.dsfaefawe/prefs.js&lt;br /&gt;
Replace the all the &amp;quot;user_pref(&amp;quot;mailnews.tags.&amp;quot; with the new set of tag configurations below and restart Thunderbird.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
user_pref(&amp;quot;mailnews.tags.$label1.color&amp;quot;, &amp;quot;#FF0000&amp;quot;);&lt;br /&gt;
user_pref(&amp;quot;mailnews.tags.$label1.tag&amp;quot;, &amp;quot;Important&amp;quot;);&lt;br /&gt;
user_pref(&amp;quot;mailnews.tags.$label2.color&amp;quot;, &amp;quot;#FF9900&amp;quot;);&lt;br /&gt;
user_pref(&amp;quot;mailnews.tags.$label2.tag&amp;quot;, &amp;quot;Work&amp;quot;);&lt;br /&gt;
user_pref(&amp;quot;mailnews.tags.$label3.color&amp;quot;, &amp;quot;#009900&amp;quot;);&lt;br /&gt;
user_pref(&amp;quot;mailnews.tags.$label3.tag&amp;quot;, &amp;quot;Joel&amp;quot;);&lt;br /&gt;
user_pref(&amp;quot;mailnews.tags.$label4.color&amp;quot;, &amp;quot;#3333ff&amp;quot;);&lt;br /&gt;
user_pref(&amp;quot;mailnews.tags.$label4.tag&amp;quot;, &amp;quot;Greg&amp;quot;);&lt;br /&gt;
user_pref(&amp;quot;mailnews.tags.$label5.color&amp;quot;, &amp;quot;#993399&amp;quot;);&lt;br /&gt;
user_pref(&amp;quot;mailnews.tags.$label5.tag&amp;quot;, &amp;quot;Arvind&amp;quot;);&lt;br /&gt;
user_pref(&amp;quot;mailnews.tags.$label6.color&amp;quot;, &amp;quot;#ff6e6e&amp;quot;);&lt;br /&gt;
user_pref(&amp;quot;mailnews.tags.$label6.tag&amp;quot;, &amp;quot;Follow up&amp;quot;);&lt;br /&gt;
user_pref(&amp;quot;mailnews.tags.$label7.color&amp;quot;, &amp;quot;#eb007b&amp;quot;);&lt;br /&gt;
user_pref(&amp;quot;mailnews.tags.$label7.tag&amp;quot;, &amp;quot;Client issue&amp;quot;);&lt;br /&gt;
user_pref(&amp;quot;mailnews.tags.$label8.color&amp;quot;, &amp;quot;#28e2d8&amp;quot;);&lt;br /&gt;
user_pref(&amp;quot;mailnews.tags.$label8.tag&amp;quot;, &amp;quot;Delay support&amp;quot;);&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==[[Procedures#Email_Retention_Policy| Email Retention Policy]]==&lt;br /&gt;
&lt;br /&gt;
==[[Procedures#Handling_junk.2Fspam_email| Handling junk/spam emails]]==&lt;br /&gt;
&lt;br /&gt;
==Viewing long running processes on Thunderbird==&lt;br /&gt;
When setting up and configuring Thunderbird, using its Activity Manager (Tools &amp;gt; Activity Manager) and possibly using the header bar &amp;quot;Always on top&amp;quot; option on the Activity Manager window may be helpful to know what long running processes are being performed.&lt;br /&gt;
&lt;br /&gt;
[[File:Activity manager.jpg]]&lt;br /&gt;
&lt;br /&gt;
==Deleting Thunderbird accounts==&lt;br /&gt;
Check the option &amp;quot;Remove Message Data&amp;quot; when removing accounts from Thunderbird. Otherwise, the old messages stay forever taking space on the disk.&lt;br /&gt;
&lt;br /&gt;
[[File:dt2.png]]&lt;br /&gt;
&lt;br /&gt;
Select Remove Message Data option as shown below.&lt;br /&gt;
&lt;br /&gt;
[[File:dt.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Clearing out old improperly deleted Thunderbird Accounts==&lt;br /&gt;
&lt;br /&gt;
If you delete Thunderbird accounts without checking the option &amp;quot;Remove Message Data&amp;quot; the old messages stay forever taking space on the disk.&lt;br /&gt;
&lt;br /&gt;
To locate any such unnecessary files&lt;br /&gt;
&lt;br /&gt;
 ls -l -h /home/*/.thunderbird/*.default/ImapMail/*/INBOX&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
-rw------- 1 arvind arvind  16M May 25 16:36 /home/arvind/.thunderbird/odi5mrka.default/ImapMail/imap.gmail.com/INBOX&lt;br /&gt;
-rw------- 1 arvind arvind 668M Mar 29 08:54 /home/arvind/.thunderbird/odi5mrka.default/ImapMail/imap.neosys-1.com/INBOX&lt;br /&gt;
-rw------- 1 arvind arvind 242M May 28 14:45 /home/arvind/.thunderbird/odi5mrka.default/ImapMail/imap.neosys-2.com/INBOX&lt;br /&gt;
-rw------- 1 arvind arvind 755M May 25 12:39 /home/arvind/.thunderbird/odi5mrka.default/ImapMail/imap.neosys-3.com/INBOX&lt;br /&gt;
-rw------- 1 arvind arvind 420M Apr 24 10:27 /home/arvind/.thunderbird/odi5mrka.default/ImapMail/imap.neosys-4.com/INBOX&lt;br /&gt;
-rw------- 1 arvind arvind  13G May 28 14:37 /home/arvind/.thunderbird/odi5mrka.default/ImapMail/imap.neosys.com/INBOX&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Check the dates, which indicate the date of the last message received, to get a rough idea of what accounts are in use and not in use&lt;br /&gt;
&lt;br /&gt;
Check which of the folders are currently in use by looking in Thunderbird settings for each account one by one, &amp;quot;Server Settings&amp;quot;, &amp;quot;Local Directory&amp;quot;&lt;br /&gt;
&lt;br /&gt;
Delete the folders and files which are not in use using whatever method you like.&lt;br /&gt;
&lt;br /&gt;
&amp;quot;.thunderbird&amp;quot;, like all files and folders which start with a dot, is a hidden folder which you can make visible in Nautilus File Manager by pressing Ctrl+h&lt;/div&gt;</summary>
		<author><name>Gregory</name></author>
	</entry>
	<entry>
		<id>https://techwiki.neosys.com/index.php?title=Configuring_Thunderbird&amp;diff=3965</id>
		<title>Configuring Thunderbird</title>
		<link rel="alternate" type="text/html" href="https://techwiki.neosys.com/index.php?title=Configuring_Thunderbird&amp;diff=3965"/>
		<updated>2022-03-14T07:27:33Z</updated>

		<summary type="html">&lt;p&gt;Gregory: /* Tags */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
==Setting Up the Inbox Accounts==&lt;br /&gt;
&lt;br /&gt;
The instructions given below explain how to set up the &amp;quot;Support&amp;quot; account on Thunderbird.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
1. Open Mozilla Thunderbird. Choose the &amp;quot;Create a new account&amp;quot; option. Click on &amp;quot;Skip this and use my existing email&amp;quot; option on the &amp;quot;Welcome to Thunderbird&amp;quot; window.&lt;br /&gt;
&lt;br /&gt;
[[File:Thunderbird_1.jpg]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
2. In the Mail Account Setup window, enter &amp;quot;support@neosys.com&amp;quot; for Your Name, &amp;quot;support@neosys.com&amp;quot; for Email Address and the password provided by Neosys staff. Click on continue.&lt;br /&gt;
&lt;br /&gt;
[[File:Thunderbird_2.jpg]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
3. Click on &amp;quot;Manual Config&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
[[File:Thunderbird_3.jpg]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
4. Key in &amp;quot;imap.neosys.com&amp;quot; for incoming IMAP host name, server hostname &amp;quot;smtp.neosys.com&amp;quot; and port &amp;quot;587&amp;quot; for outgoing SMTP and &amp;quot;support.neosys&amp;quot; as username. For SMTP, change the SSL to &amp;quot;STARTTLS&amp;quot; and authentication to &amp;quot;No authentication&amp;quot;. Click on the &amp;quot;Re-test&amp;quot; button and then click &amp;quot;Done&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
[[File:Thunderbird_4.jpg]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
BEFORE clicking on inbox and BEFORE adding other inboxes, you MUST refer to [[Configuring_Thunderbird#Adding_email_accounts_with_large_numbers_of_emails | Adding email accounts with large numbers of emails]]. This is because if you add all the accounts together at once, they will all sync together and it will take 1-2 days for the sync to complete.&lt;br /&gt;
&lt;br /&gt;
For backups@neosys.com, support2@neosys.com (Nagios), name.neosys@gmail.com repeat the steps mentioned above, with the below-mentioned replacements.&lt;br /&gt;
&lt;br /&gt;
1. For backups@neosys.com, enter &amp;quot;backups@neosys.com&amp;quot; for Your Name, &amp;quot;backups@neosys.com&amp;quot; for Email address and enter the password provided by Neosys staff.&lt;br /&gt;
Enter the username as &amp;quot;backups.neosys&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
2. For support2@neosys.com, enter &amp;quot;support2@neosys.com&amp;quot; for Your Name, &amp;quot;support2@neosys.com&amp;quot; for Email address and enter the password provided by Neosys staff.&lt;br /&gt;
Enter the username as &amp;quot;support2.neosys&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
3. For name.neosys@gmail.com, enter your full name for Your Name, &amp;quot;name.neosys@gmail.com&amp;quot; for Email address and enter the password. You do not need to follow the steps for manual config as the settings will be automatically configured.&lt;br /&gt;
&lt;br /&gt;
[[File:thunderbird_6.jpg]]&lt;br /&gt;
&lt;br /&gt;
[[File:thunderbird_7.jpg]]&lt;br /&gt;
&lt;br /&gt;
==Account Settings==&lt;br /&gt;
&lt;br /&gt;
Verify that the account settings for all the accounts are entered as shown below.&lt;br /&gt;
&lt;br /&gt;
[[File:acsettings1.jpg]]&lt;br /&gt;
&lt;br /&gt;
[[File:acsettings2.jpg]]&lt;br /&gt;
&lt;br /&gt;
[[File:acsettings3.jpg]]&lt;br /&gt;
&lt;br /&gt;
[[File:acsettings4.jpg]]&lt;br /&gt;
&lt;br /&gt;
[[File:Account junk.jpg|500px]]&lt;br /&gt;
&lt;br /&gt;
For backups@neosys.com account, under &amp;quot;Synchronization and Storage&amp;quot;, change the setting to &amp;quot;Delete messages more than 365 days old&amp;quot;&lt;br /&gt;
&lt;br /&gt;
The Synchronisation &amp;amp; Storage settings should be changed to the settings shown below only at a convenient time, since downloading all the emails will take a lot of time for accounts with large number of emails. Also see [[Configuring_Thunderbird#Adding_email_accounts_with_large_numbers_of_emails |Adding email accounts with large number of emails]]&lt;br /&gt;
&lt;br /&gt;
[[File:acsettings6.jpg]]&lt;br /&gt;
&lt;br /&gt;
[[File:acsettings7.jpg]]&lt;br /&gt;
&lt;br /&gt;
[[File:acsettings8.jpg]]&lt;br /&gt;
&lt;br /&gt;
===Adding email accounts with large numbers of emails===&lt;br /&gt;
&lt;br /&gt;
After adding email accounts with large numbers of emails, in order to avoid long wait while downloading all the emails, it is best to change the account settings - BEFORE clicking on INBOX, which triggers the download/sync - to download the bodies of only the last 30 days of emails. The email headings are always synced but that does not take long.&lt;br /&gt;
&lt;br /&gt;
See Account Settings, Synchronisation and Storage.&lt;br /&gt;
&lt;br /&gt;
Since searching of emails only works when the bodies of emails have been downloaded, if you need to text search all emails, then, at a convenient time, you can remove or increase the number of days in the setting and somehow trigger the full sync.&lt;br /&gt;
&lt;br /&gt;
[[File:thla.jpg]]&lt;br /&gt;
&lt;br /&gt;
===Configuring Outgoing SMTP Mail Servers===&lt;br /&gt;
&lt;br /&gt;
By default Thunderbird adds a new smtp profile with each Inbox added.&lt;br /&gt;
&lt;br /&gt;
However you only need two, main and backup. &lt;br /&gt;
&lt;br /&gt;
1. Right click on any Inbox &amp;gt; Settings.&lt;br /&gt;
&lt;br /&gt;
2. Scroll down and click &amp;quot;Outgoing Server (SMTP)&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
3. Delete all smtp server profiles except the default and ensure your settings match below screenshot.&lt;br /&gt;
[[File:Smtpsettings.png]]&lt;br /&gt;
&lt;br /&gt;
4. Add a new profile with settings in below screenshot.&lt;br /&gt;
&lt;br /&gt;
TODO - setup backup imap2 container and add settings screenshot here. (old imap2 smtp port 2500)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Add-ons==&lt;br /&gt;
&lt;br /&gt;
#Install addons: General settings menu (Top right 3 bars) &amp;gt; Addons &lt;br /&gt;
#Search and install the addons in below screenshot.&lt;br /&gt;
#Configure Mailbox Alert by Right e.g support inbox &amp;gt; Mailbox Alert: &lt;br /&gt;
##Check default sound and message.&lt;br /&gt;
[[File:Addon2.png]]&lt;br /&gt;
&lt;br /&gt;
==Other General Configurations==&lt;br /&gt;
&lt;br /&gt;
===Configure inbox to display selected columns===&lt;br /&gt;
&lt;br /&gt;
The below options MUST be set in Support Inbox. To do so Right click on a column heading and select the below options:  &lt;br /&gt;
&lt;br /&gt;
#Thread&lt;br /&gt;
#Starred&lt;br /&gt;
#Attachment&lt;br /&gt;
#Subject&lt;br /&gt;
#Correspondents&lt;br /&gt;
#Received: You MUST add column RECEIVED which is the email date received to email inbox because the default Date seems to be the DATE SENT whereas we are primarily interested in the date we received the email. The difference is due to delays in email servers or spam tricks.&lt;br /&gt;
&lt;br /&gt;
The below options MUST NOT be set in Support Inbox&lt;br /&gt;
&lt;br /&gt;
#Junk status: Emails will automatically be moved to Junk folder if the junk icon in this column is clicked. Hence remove Junk Status column so that emails are not accidentally moved to junk. To remove, right-click on a column heading and untick &amp;quot;Junk Status&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
===Configure Mail Content===&lt;br /&gt;
&lt;br /&gt;
Preferences &amp;gt; Privacy &amp;gt; untick &amp;quot;Allow remote content in messages&amp;quot;&lt;br /&gt;
&lt;br /&gt;
Support MUST set the &amp;quot;Allow remote content in messages&amp;quot; as blocked in Thunderbird without adding any exceptions for any email id. The reason is remote content i.e embedded images, stylesheets etc is a privacy concern as it sends your private information to the mail sender. We do not know the source of these embedded content in emails so cannot trust them as they can be web bugs.&lt;br /&gt;
&lt;br /&gt;
===Configure Layout View===&lt;br /&gt;
&lt;br /&gt;
Layout view should be set as Vertical view.&lt;br /&gt;
&lt;br /&gt;
===Thunderbird Preferences===&lt;br /&gt;
&lt;br /&gt;
#Preferences &amp;gt; Display &amp;gt; Advanced &amp;gt; untick &amp;quot; Automatically mark messages as read&amp;quot;.&lt;br /&gt;
#Keep settings as below for Preferences &amp;gt; Security.&lt;br /&gt;
#Keep settings as below for Preferences &amp;gt; Composition &amp;gt; Spelling.&lt;br /&gt;
&lt;br /&gt;
[[File:Globaljunk.jpg|500px]]&lt;br /&gt;
&lt;br /&gt;
[[File:Composition.png|500px]]&lt;br /&gt;
&lt;br /&gt;
===Configure MailAlert===&lt;br /&gt;
&lt;br /&gt;
Right click Inbox &amp;gt; Mailbox Alert &amp;gt; Edit Mailbox Alert alerts &amp;gt; Select Default message. Set as below. Once set Right click Inbox &amp;gt; Mailbox Alert &amp;gt; check Default message&lt;br /&gt;
&lt;br /&gt;
[[file:thsh.jpg]]&lt;br /&gt;
&lt;br /&gt;
===Configure Auto Resize Image===&lt;br /&gt;
&lt;br /&gt;
Set the preferences for the Auto Resize Image add-on as shown in the screenshot at the end of this section.&lt;br /&gt;
&lt;br /&gt;
To handle different scenarios when resizing images in emails, follow the below steps:&lt;br /&gt;
&lt;br /&gt;
*Resize all images in the email: Click &amp;quot;Send&amp;quot; followed by &amp;quot;Confirm&amp;quot; on the Auto resize screen.&lt;br /&gt;
&lt;br /&gt;
*Skip resize all images in the email: Click &amp;quot;Send&amp;quot; followed by &amp;quot;Cancel Resizing&amp;quot; on the Auto resize screen.&lt;br /&gt;
&lt;br /&gt;
*Resize Images only in the email trail and skip resizing new images: Click &amp;quot;Resize&amp;quot; on top of your screen and proceed with writing the email/adding new images. When ready to send the email, follow above step for skipping resize all images in the email.&lt;br /&gt;
&lt;br /&gt;
[[File:Resize2.png]]&lt;br /&gt;
&lt;br /&gt;
===Configure Header Tools Lite===&lt;br /&gt;
&lt;br /&gt;
Set the preferences for the Header Tools Lite add-on as shown in the screenshot below.&lt;br /&gt;
&lt;br /&gt;
[[File:headertoolslite.jpg]]&lt;br /&gt;
&lt;br /&gt;
===Configure Dorando Keyconfig===&lt;br /&gt;
&lt;br /&gt;
Menu &amp;gt; Add-ons &amp;gt; Edit Keyconfig Preferences &amp;gt; Disable shortcuts for &#039;Archive&#039; and &#039;Junk&#039; as shown in the screenshots below.&lt;br /&gt;
&lt;br /&gt;
[[File:Keyconfig1.png]]&lt;br /&gt;
&lt;br /&gt;
[[File:Keyconfig2.png]]&lt;br /&gt;
&lt;br /&gt;
===Getting access to NEOSYS support calendar===&lt;br /&gt;
&lt;br /&gt;
After confirming that the steps below are successfully done, delete your local personal calendar and make the shared support calendar the default.&lt;br /&gt;
&lt;br /&gt;
In Thunderbird, add a new CalDAV network calendar by navigating to File (Alt+f) -&amp;gt; New -&amp;gt; Calendar.&lt;br /&gt;
&lt;br /&gt;
You will have to enter your nextcloud user and pass.&lt;br /&gt;
&lt;br /&gt;
[[File:Cal1.png]]&lt;br /&gt;
&lt;br /&gt;
Location: https://nextcloud.hosts.neosys.com:44318/remote.php/dav/calendars/support/support_shared_by_steve/&lt;br /&gt;
&lt;br /&gt;
[[File:Cal2.png]]&lt;br /&gt;
&lt;br /&gt;
[[File:Cal3.png]]&lt;br /&gt;
&lt;br /&gt;
It should show a tick if successful, otherwise you will have to Unsubscribe and try again.&lt;br /&gt;
&lt;br /&gt;
[[File:Cal4.png]]&lt;br /&gt;
&lt;br /&gt;
Change the new calendar properties to Refresh every 5 mins.&lt;br /&gt;
&lt;br /&gt;
[[File:Cal5.png]]&lt;br /&gt;
&lt;br /&gt;
===Applying filter for backup failure emails===&lt;br /&gt;
&lt;br /&gt;
In order to filter any backup failure emails as Important, go to Tools &amp;gt; Message Filters and create a new filter with settings as shown below:&lt;br /&gt;
&lt;br /&gt;
Refer to filters list of other staff members.&lt;br /&gt;
&lt;br /&gt;
===Tags===&lt;br /&gt;
&lt;br /&gt;
# Find the prefs.js file in your profile directory:&lt;br /&gt;
 find ~/.thunderbird/ -name prefs.js &lt;br /&gt;
#Edit the prefs.js file&lt;br /&gt;
 nano /home/gregory/.thunderbird/s3bqjf24.dsfaefawe/prefs.js&lt;br /&gt;
#Replace the all the &amp;quot;user_pref(&amp;quot;mailnews.tags.&amp;quot; with the new set of tag configurations below and restart Thunderbird.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
user_pref(&amp;quot;mailnews.tags.$label1.color&amp;quot;, &amp;quot;#FF0000&amp;quot;);&lt;br /&gt;
user_pref(&amp;quot;mailnews.tags.$label1.tag&amp;quot;, &amp;quot;Important&amp;quot;);&lt;br /&gt;
user_pref(&amp;quot;mailnews.tags.$label2.color&amp;quot;, &amp;quot;#FF9900&amp;quot;);&lt;br /&gt;
user_pref(&amp;quot;mailnews.tags.$label2.tag&amp;quot;, &amp;quot;Work&amp;quot;);&lt;br /&gt;
user_pref(&amp;quot;mailnews.tags.$label3.color&amp;quot;, &amp;quot;#009900&amp;quot;);&lt;br /&gt;
user_pref(&amp;quot;mailnews.tags.$label3.tag&amp;quot;, &amp;quot;Joel&amp;quot;);&lt;br /&gt;
user_pref(&amp;quot;mailnews.tags.$label4.color&amp;quot;, &amp;quot;#3333ff&amp;quot;);&lt;br /&gt;
user_pref(&amp;quot;mailnews.tags.$label4.tag&amp;quot;, &amp;quot;Greg&amp;quot;);&lt;br /&gt;
user_pref(&amp;quot;mailnews.tags.$label5.color&amp;quot;, &amp;quot;#993399&amp;quot;);&lt;br /&gt;
user_pref(&amp;quot;mailnews.tags.$label5.tag&amp;quot;, &amp;quot;Arvind&amp;quot;);&lt;br /&gt;
user_pref(&amp;quot;mailnews.tags.$label6.color&amp;quot;, &amp;quot;#ff6e6e&amp;quot;);&lt;br /&gt;
user_pref(&amp;quot;mailnews.tags.$label6.tag&amp;quot;, &amp;quot;Follow up&amp;quot;);&lt;br /&gt;
user_pref(&amp;quot;mailnews.tags.$label7.color&amp;quot;, &amp;quot;#eb007b&amp;quot;);&lt;br /&gt;
user_pref(&amp;quot;mailnews.tags.$label7.tag&amp;quot;, &amp;quot;Client issue&amp;quot;);&lt;br /&gt;
user_pref(&amp;quot;mailnews.tags.$label8.color&amp;quot;, &amp;quot;#28e2d8&amp;quot;);&lt;br /&gt;
user_pref(&amp;quot;mailnews.tags.$label8.tag&amp;quot;, &amp;quot;Delay support&amp;quot;);&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==[[Procedures#Email_Retention_Policy| Email Retention Policy]]==&lt;br /&gt;
&lt;br /&gt;
==[[Procedures#Handling_junk.2Fspam_email| Handling junk/spam emails]]==&lt;br /&gt;
&lt;br /&gt;
==Viewing long running processes on Thunderbird==&lt;br /&gt;
When setting up and configuring Thunderbird, using its Activity Manager (Tools &amp;gt; Activity Manager) and possibly using the header bar &amp;quot;Always on top&amp;quot; option on the Activity Manager window may be helpful to know what long running processes are being performed.&lt;br /&gt;
&lt;br /&gt;
[[File:Activity manager.jpg]]&lt;br /&gt;
&lt;br /&gt;
==Deleting Thunderbird accounts==&lt;br /&gt;
Check the option &amp;quot;Remove Message Data&amp;quot; when removing accounts from Thunderbird. Otherwise, the old messages stay forever taking space on the disk.&lt;br /&gt;
&lt;br /&gt;
[[File:dt2.png]]&lt;br /&gt;
&lt;br /&gt;
Select Remove Message Data option as shown below.&lt;br /&gt;
&lt;br /&gt;
[[File:dt.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Clearing out old improperly deleted Thunderbird Accounts==&lt;br /&gt;
&lt;br /&gt;
If you delete Thunderbird accounts without checking the option &amp;quot;Remove Message Data&amp;quot; the old messages stay forever taking space on the disk.&lt;br /&gt;
&lt;br /&gt;
To locate any such unnecessary files&lt;br /&gt;
&lt;br /&gt;
 ls -l -h /home/*/.thunderbird/*.default/ImapMail/*/INBOX&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
-rw------- 1 arvind arvind  16M May 25 16:36 /home/arvind/.thunderbird/odi5mrka.default/ImapMail/imap.gmail.com/INBOX&lt;br /&gt;
-rw------- 1 arvind arvind 668M Mar 29 08:54 /home/arvind/.thunderbird/odi5mrka.default/ImapMail/imap.neosys-1.com/INBOX&lt;br /&gt;
-rw------- 1 arvind arvind 242M May 28 14:45 /home/arvind/.thunderbird/odi5mrka.default/ImapMail/imap.neosys-2.com/INBOX&lt;br /&gt;
-rw------- 1 arvind arvind 755M May 25 12:39 /home/arvind/.thunderbird/odi5mrka.default/ImapMail/imap.neosys-3.com/INBOX&lt;br /&gt;
-rw------- 1 arvind arvind 420M Apr 24 10:27 /home/arvind/.thunderbird/odi5mrka.default/ImapMail/imap.neosys-4.com/INBOX&lt;br /&gt;
-rw------- 1 arvind arvind  13G May 28 14:37 /home/arvind/.thunderbird/odi5mrka.default/ImapMail/imap.neosys.com/INBOX&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Check the dates, which indicate the date of the last message received, to get a rough idea of what accounts are in use and not in use&lt;br /&gt;
&lt;br /&gt;
Check which of the folders are currently in use by looking in Thunderbird settings for each account one by one, &amp;quot;Server Settings&amp;quot;, &amp;quot;Local Directory&amp;quot;&lt;br /&gt;
&lt;br /&gt;
Delete the folders and files which are not in use using whatever method you like.&lt;br /&gt;
&lt;br /&gt;
&amp;quot;.thunderbird&amp;quot;, like all files and folders which start with a dot, is a hidden folder which you can make visible in Nautilus File Manager by pressing Ctrl+h&lt;/div&gt;</summary>
		<author><name>Gregory</name></author>
	</entry>
	<entry>
		<id>https://techwiki.neosys.com/index.php?title=Configuring_Thunderbird&amp;diff=3964</id>
		<title>Configuring Thunderbird</title>
		<link rel="alternate" type="text/html" href="https://techwiki.neosys.com/index.php?title=Configuring_Thunderbird&amp;diff=3964"/>
		<updated>2022-03-14T07:25:31Z</updated>

		<summary type="html">&lt;p&gt;Gregory: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
==Setting Up the Inbox Accounts==&lt;br /&gt;
&lt;br /&gt;
The instructions given below explain how to set up the &amp;quot;Support&amp;quot; account on Thunderbird.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
1. Open Mozilla Thunderbird. Choose the &amp;quot;Create a new account&amp;quot; option. Click on &amp;quot;Skip this and use my existing email&amp;quot; option on the &amp;quot;Welcome to Thunderbird&amp;quot; window.&lt;br /&gt;
&lt;br /&gt;
[[File:Thunderbird_1.jpg]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
2. In the Mail Account Setup window, enter &amp;quot;support@neosys.com&amp;quot; for Your Name, &amp;quot;support@neosys.com&amp;quot; for Email Address and the password provided by Neosys staff. Click on continue.&lt;br /&gt;
&lt;br /&gt;
[[File:Thunderbird_2.jpg]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
3. Click on &amp;quot;Manual Config&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
[[File:Thunderbird_3.jpg]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
4. Key in &amp;quot;imap.neosys.com&amp;quot; for incoming IMAP host name, server hostname &amp;quot;smtp.neosys.com&amp;quot; and port &amp;quot;587&amp;quot; for outgoing SMTP and &amp;quot;support.neosys&amp;quot; as username. For SMTP, change the SSL to &amp;quot;STARTTLS&amp;quot; and authentication to &amp;quot;No authentication&amp;quot;. Click on the &amp;quot;Re-test&amp;quot; button and then click &amp;quot;Done&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
[[File:Thunderbird_4.jpg]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
BEFORE clicking on inbox and BEFORE adding other inboxes, you MUST refer to [[Configuring_Thunderbird#Adding_email_accounts_with_large_numbers_of_emails | Adding email accounts with large numbers of emails]]. This is because if you add all the accounts together at once, they will all sync together and it will take 1-2 days for the sync to complete.&lt;br /&gt;
&lt;br /&gt;
For backups@neosys.com, support2@neosys.com (Nagios), name.neosys@gmail.com repeat the steps mentioned above, with the below-mentioned replacements.&lt;br /&gt;
&lt;br /&gt;
1. For backups@neosys.com, enter &amp;quot;backups@neosys.com&amp;quot; for Your Name, &amp;quot;backups@neosys.com&amp;quot; for Email address and enter the password provided by Neosys staff.&lt;br /&gt;
Enter the username as &amp;quot;backups.neosys&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
2. For support2@neosys.com, enter &amp;quot;support2@neosys.com&amp;quot; for Your Name, &amp;quot;support2@neosys.com&amp;quot; for Email address and enter the password provided by Neosys staff.&lt;br /&gt;
Enter the username as &amp;quot;support2.neosys&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
3. For name.neosys@gmail.com, enter your full name for Your Name, &amp;quot;name.neosys@gmail.com&amp;quot; for Email address and enter the password. You do not need to follow the steps for manual config as the settings will be automatically configured.&lt;br /&gt;
&lt;br /&gt;
[[File:thunderbird_6.jpg]]&lt;br /&gt;
&lt;br /&gt;
[[File:thunderbird_7.jpg]]&lt;br /&gt;
&lt;br /&gt;
==Account Settings==&lt;br /&gt;
&lt;br /&gt;
Verify that the account settings for all the accounts are entered as shown below.&lt;br /&gt;
&lt;br /&gt;
[[File:acsettings1.jpg]]&lt;br /&gt;
&lt;br /&gt;
[[File:acsettings2.jpg]]&lt;br /&gt;
&lt;br /&gt;
[[File:acsettings3.jpg]]&lt;br /&gt;
&lt;br /&gt;
[[File:acsettings4.jpg]]&lt;br /&gt;
&lt;br /&gt;
[[File:Account junk.jpg|500px]]&lt;br /&gt;
&lt;br /&gt;
For backups@neosys.com account, under &amp;quot;Synchronization and Storage&amp;quot;, change the setting to &amp;quot;Delete messages more than 365 days old&amp;quot;&lt;br /&gt;
&lt;br /&gt;
The Synchronisation &amp;amp; Storage settings should be changed to the settings shown below only at a convenient time, since downloading all the emails will take a lot of time for accounts with large number of emails. Also see [[Configuring_Thunderbird#Adding_email_accounts_with_large_numbers_of_emails |Adding email accounts with large number of emails]]&lt;br /&gt;
&lt;br /&gt;
[[File:acsettings6.jpg]]&lt;br /&gt;
&lt;br /&gt;
[[File:acsettings7.jpg]]&lt;br /&gt;
&lt;br /&gt;
[[File:acsettings8.jpg]]&lt;br /&gt;
&lt;br /&gt;
===Adding email accounts with large numbers of emails===&lt;br /&gt;
&lt;br /&gt;
After adding email accounts with large numbers of emails, in order to avoid long wait while downloading all the emails, it is best to change the account settings - BEFORE clicking on INBOX, which triggers the download/sync - to download the bodies of only the last 30 days of emails. The email headings are always synced but that does not take long.&lt;br /&gt;
&lt;br /&gt;
See Account Settings, Synchronisation and Storage.&lt;br /&gt;
&lt;br /&gt;
Since searching of emails only works when the bodies of emails have been downloaded, if you need to text search all emails, then, at a convenient time, you can remove or increase the number of days in the setting and somehow trigger the full sync.&lt;br /&gt;
&lt;br /&gt;
[[File:thla.jpg]]&lt;br /&gt;
&lt;br /&gt;
===Configuring Outgoing SMTP Mail Servers===&lt;br /&gt;
&lt;br /&gt;
By default Thunderbird adds a new smtp profile with each Inbox added.&lt;br /&gt;
&lt;br /&gt;
However you only need two, main and backup. &lt;br /&gt;
&lt;br /&gt;
1. Right click on any Inbox &amp;gt; Settings.&lt;br /&gt;
&lt;br /&gt;
2. Scroll down and click &amp;quot;Outgoing Server (SMTP)&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
3. Delete all smtp server profiles except the default and ensure your settings match below screenshot.&lt;br /&gt;
[[File:Smtpsettings.png]]&lt;br /&gt;
&lt;br /&gt;
4. Add a new profile with settings in below screenshot.&lt;br /&gt;
&lt;br /&gt;
TODO - setup backup imap2 container and add settings screenshot here. (old imap2 smtp port 2500)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Add-ons==&lt;br /&gt;
&lt;br /&gt;
#Install addons: General settings menu (Top right 3 bars) &amp;gt; Addons &lt;br /&gt;
#Search and install the addons in below screenshot.&lt;br /&gt;
#Configure Mailbox Alert by Right e.g support inbox &amp;gt; Mailbox Alert: &lt;br /&gt;
##Check default sound and message.&lt;br /&gt;
[[File:Addon2.png]]&lt;br /&gt;
&lt;br /&gt;
==Other General Configurations==&lt;br /&gt;
&lt;br /&gt;
===Configure inbox to display selected columns===&lt;br /&gt;
&lt;br /&gt;
The below options MUST be set in Support Inbox. To do so Right click on a column heading and select the below options:  &lt;br /&gt;
&lt;br /&gt;
#Thread&lt;br /&gt;
#Starred&lt;br /&gt;
#Attachment&lt;br /&gt;
#Subject&lt;br /&gt;
#Correspondents&lt;br /&gt;
#Received: You MUST add column RECEIVED which is the email date received to email inbox because the default Date seems to be the DATE SENT whereas we are primarily interested in the date we received the email. The difference is due to delays in email servers or spam tricks.&lt;br /&gt;
&lt;br /&gt;
The below options MUST NOT be set in Support Inbox&lt;br /&gt;
&lt;br /&gt;
#Junk status: Emails will automatically be moved to Junk folder if the junk icon in this column is clicked. Hence remove Junk Status column so that emails are not accidentally moved to junk. To remove, right-click on a column heading and untick &amp;quot;Junk Status&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
===Configure Mail Content===&lt;br /&gt;
&lt;br /&gt;
Preferences &amp;gt; Privacy &amp;gt; untick &amp;quot;Allow remote content in messages&amp;quot;&lt;br /&gt;
&lt;br /&gt;
Support MUST set the &amp;quot;Allow remote content in messages&amp;quot; as blocked in Thunderbird without adding any exceptions for any email id. The reason is remote content i.e embedded images, stylesheets etc is a privacy concern as it sends your private information to the mail sender. We do not know the source of these embedded content in emails so cannot trust them as they can be web bugs.&lt;br /&gt;
&lt;br /&gt;
===Configure Layout View===&lt;br /&gt;
&lt;br /&gt;
Layout view should be set as Vertical view.&lt;br /&gt;
&lt;br /&gt;
===Thunderbird Preferences===&lt;br /&gt;
&lt;br /&gt;
#Preferences &amp;gt; Display &amp;gt; Advanced &amp;gt; untick &amp;quot; Automatically mark messages as read&amp;quot;.&lt;br /&gt;
#Keep settings as below for Preferences &amp;gt; Security.&lt;br /&gt;
#Keep settings as below for Preferences &amp;gt; Composition &amp;gt; Spelling.&lt;br /&gt;
&lt;br /&gt;
[[File:Globaljunk.jpg|500px]]&lt;br /&gt;
&lt;br /&gt;
[[File:Composition.png|500px]]&lt;br /&gt;
&lt;br /&gt;
===Configure MailAlert===&lt;br /&gt;
&lt;br /&gt;
Right click Inbox &amp;gt; Mailbox Alert &amp;gt; Edit Mailbox Alert alerts &amp;gt; Select Default message. Set as below. Once set Right click Inbox &amp;gt; Mailbox Alert &amp;gt; check Default message&lt;br /&gt;
&lt;br /&gt;
[[file:thsh.jpg]]&lt;br /&gt;
&lt;br /&gt;
===Configure Auto Resize Image===&lt;br /&gt;
&lt;br /&gt;
Set the preferences for the Auto Resize Image add-on as shown in the screenshot at the end of this section.&lt;br /&gt;
&lt;br /&gt;
To handle different scenarios when resizing images in emails, follow the below steps:&lt;br /&gt;
&lt;br /&gt;
*Resize all images in the email: Click &amp;quot;Send&amp;quot; followed by &amp;quot;Confirm&amp;quot; on the Auto resize screen.&lt;br /&gt;
&lt;br /&gt;
*Skip resize all images in the email: Click &amp;quot;Send&amp;quot; followed by &amp;quot;Cancel Resizing&amp;quot; on the Auto resize screen.&lt;br /&gt;
&lt;br /&gt;
*Resize Images only in the email trail and skip resizing new images: Click &amp;quot;Resize&amp;quot; on top of your screen and proceed with writing the email/adding new images. When ready to send the email, follow above step for skipping resize all images in the email.&lt;br /&gt;
&lt;br /&gt;
[[File:Resize2.png]]&lt;br /&gt;
&lt;br /&gt;
===Configure Header Tools Lite===&lt;br /&gt;
&lt;br /&gt;
Set the preferences for the Header Tools Lite add-on as shown in the screenshot below.&lt;br /&gt;
&lt;br /&gt;
[[File:headertoolslite.jpg]]&lt;br /&gt;
&lt;br /&gt;
===Configure Dorando Keyconfig===&lt;br /&gt;
&lt;br /&gt;
Menu &amp;gt; Add-ons &amp;gt; Edit Keyconfig Preferences &amp;gt; Disable shortcuts for &#039;Archive&#039; and &#039;Junk&#039; as shown in the screenshots below.&lt;br /&gt;
&lt;br /&gt;
[[File:Keyconfig1.png]]&lt;br /&gt;
&lt;br /&gt;
[[File:Keyconfig2.png]]&lt;br /&gt;
&lt;br /&gt;
===Getting access to NEOSYS support calendar===&lt;br /&gt;
&lt;br /&gt;
After confirming that the steps below are successfully done, delete your local personal calendar and make the shared support calendar the default.&lt;br /&gt;
&lt;br /&gt;
In Thunderbird, add a new CalDAV network calendar by navigating to File (Alt+f) -&amp;gt; New -&amp;gt; Calendar.&lt;br /&gt;
&lt;br /&gt;
You will have to enter your nextcloud user and pass.&lt;br /&gt;
&lt;br /&gt;
[[File:Cal1.png]]&lt;br /&gt;
&lt;br /&gt;
Location: https://nextcloud.hosts.neosys.com:44318/remote.php/dav/calendars/support/support_shared_by_steve/&lt;br /&gt;
&lt;br /&gt;
[[File:Cal2.png]]&lt;br /&gt;
&lt;br /&gt;
[[File:Cal3.png]]&lt;br /&gt;
&lt;br /&gt;
It should show a tick if successful, otherwise you will have to Unsubscribe and try again.&lt;br /&gt;
&lt;br /&gt;
[[File:Cal4.png]]&lt;br /&gt;
&lt;br /&gt;
Change the new calendar properties to Refresh every 5 mins.&lt;br /&gt;
&lt;br /&gt;
[[File:Cal5.png]]&lt;br /&gt;
&lt;br /&gt;
===Applying filter for backup failure emails===&lt;br /&gt;
&lt;br /&gt;
In order to filter any backup failure emails as Important, go to Tools &amp;gt; Message Filters and create a new filter with settings as shown below:&lt;br /&gt;
&lt;br /&gt;
Refer to filters list of other staff members.&lt;br /&gt;
&lt;br /&gt;
===Tags===&lt;br /&gt;
&lt;br /&gt;
find ~/.thunderbird/ -name prefs.js (use the one that looks like this /home/gregory/.thunderbird/s3bqjf24.default/prefs.js)&lt;br /&gt;
&lt;br /&gt;
edit the prefs.js in e.g /home/gregory/.thunderbird/&amp;lt;your profile code&amp;gt;.default/prefs.js&lt;br /&gt;
&lt;br /&gt;
nano /home/gregory/.thunderbird/s3bqjf24.dsfaefawe/prefs.js&lt;br /&gt;
&lt;br /&gt;
Replace the all the &amp;quot;user_pref(&amp;quot;mailnews.tags.&amp;quot; with the new set of tag configurations below:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
user_pref(&amp;quot;mailnews.tags.$label1.color&amp;quot;, &amp;quot;#FF0000&amp;quot;);&lt;br /&gt;
user_pref(&amp;quot;mailnews.tags.$label1.tag&amp;quot;, &amp;quot;Important&amp;quot;);&lt;br /&gt;
user_pref(&amp;quot;mailnews.tags.$label2.color&amp;quot;, &amp;quot;#FF9900&amp;quot;);&lt;br /&gt;
user_pref(&amp;quot;mailnews.tags.$label2.tag&amp;quot;, &amp;quot;Work&amp;quot;);&lt;br /&gt;
user_pref(&amp;quot;mailnews.tags.$label3.color&amp;quot;, &amp;quot;#009900&amp;quot;);&lt;br /&gt;
user_pref(&amp;quot;mailnews.tags.$label3.tag&amp;quot;, &amp;quot;Joel&amp;quot;);&lt;br /&gt;
user_pref(&amp;quot;mailnews.tags.$label4.color&amp;quot;, &amp;quot;#3333ff&amp;quot;);&lt;br /&gt;
user_pref(&amp;quot;mailnews.tags.$label4.tag&amp;quot;, &amp;quot;Greg&amp;quot;);&lt;br /&gt;
user_pref(&amp;quot;mailnews.tags.$label5.color&amp;quot;, &amp;quot;#993399&amp;quot;);&lt;br /&gt;
user_pref(&amp;quot;mailnews.tags.$label5.tag&amp;quot;, &amp;quot;Arvind&amp;quot;);&lt;br /&gt;
user_pref(&amp;quot;mailnews.tags.$label6.color&amp;quot;, &amp;quot;#ff6e6e&amp;quot;);&lt;br /&gt;
user_pref(&amp;quot;mailnews.tags.$label6.tag&amp;quot;, &amp;quot;Follow up&amp;quot;);&lt;br /&gt;
user_pref(&amp;quot;mailnews.tags.$label7.color&amp;quot;, &amp;quot;#eb007b&amp;quot;);&lt;br /&gt;
user_pref(&amp;quot;mailnews.tags.$label7.tag&amp;quot;, &amp;quot;Client issue&amp;quot;);&lt;br /&gt;
user_pref(&amp;quot;mailnews.tags.$label8.color&amp;quot;, &amp;quot;#28e2d8&amp;quot;);&lt;br /&gt;
user_pref(&amp;quot;mailnews.tags.$label8.tag&amp;quot;, &amp;quot;Delay support&amp;quot;);&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==[[Procedures#Email_Retention_Policy| Email Retention Policy]]==&lt;br /&gt;
&lt;br /&gt;
==[[Procedures#Handling_junk.2Fspam_email| Handling junk/spam emails]]==&lt;br /&gt;
&lt;br /&gt;
==Viewing long running processes on Thunderbird==&lt;br /&gt;
When setting up and configuring Thunderbird, using its Activity Manager (Tools &amp;gt; Activity Manager) and possibly using the header bar &amp;quot;Always on top&amp;quot; option on the Activity Manager window may be helpful to know what long running processes are being performed.&lt;br /&gt;
&lt;br /&gt;
[[File:Activity manager.jpg]]&lt;br /&gt;
&lt;br /&gt;
==Deleting Thunderbird accounts==&lt;br /&gt;
Check the option &amp;quot;Remove Message Data&amp;quot; when removing accounts from Thunderbird. Otherwise, the old messages stay forever taking space on the disk.&lt;br /&gt;
&lt;br /&gt;
[[File:dt2.png]]&lt;br /&gt;
&lt;br /&gt;
Select Remove Message Data option as shown below.&lt;br /&gt;
&lt;br /&gt;
[[File:dt.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Clearing out old improperly deleted Thunderbird Accounts==&lt;br /&gt;
&lt;br /&gt;
If you delete Thunderbird accounts without checking the option &amp;quot;Remove Message Data&amp;quot; the old messages stay forever taking space on the disk.&lt;br /&gt;
&lt;br /&gt;
To locate any such unnecessary files&lt;br /&gt;
&lt;br /&gt;
 ls -l -h /home/*/.thunderbird/*.default/ImapMail/*/INBOX&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
-rw------- 1 arvind arvind  16M May 25 16:36 /home/arvind/.thunderbird/odi5mrka.default/ImapMail/imap.gmail.com/INBOX&lt;br /&gt;
-rw------- 1 arvind arvind 668M Mar 29 08:54 /home/arvind/.thunderbird/odi5mrka.default/ImapMail/imap.neosys-1.com/INBOX&lt;br /&gt;
-rw------- 1 arvind arvind 242M May 28 14:45 /home/arvind/.thunderbird/odi5mrka.default/ImapMail/imap.neosys-2.com/INBOX&lt;br /&gt;
-rw------- 1 arvind arvind 755M May 25 12:39 /home/arvind/.thunderbird/odi5mrka.default/ImapMail/imap.neosys-3.com/INBOX&lt;br /&gt;
-rw------- 1 arvind arvind 420M Apr 24 10:27 /home/arvind/.thunderbird/odi5mrka.default/ImapMail/imap.neosys-4.com/INBOX&lt;br /&gt;
-rw------- 1 arvind arvind  13G May 28 14:37 /home/arvind/.thunderbird/odi5mrka.default/ImapMail/imap.neosys.com/INBOX&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Check the dates, which indicate the date of the last message received, to get a rough idea of what accounts are in use and not in use&lt;br /&gt;
&lt;br /&gt;
Check which of the folders are currently in use by looking in Thunderbird settings for each account one by one, &amp;quot;Server Settings&amp;quot;, &amp;quot;Local Directory&amp;quot;&lt;br /&gt;
&lt;br /&gt;
Delete the folders and files which are not in use using whatever method you like.&lt;br /&gt;
&lt;br /&gt;
&amp;quot;.thunderbird&amp;quot;, like all files and folders which start with a dot, is a hidden folder which you can make visible in Nautilus File Manager by pressing Ctrl+h&lt;/div&gt;</summary>
		<author><name>Gregory</name></author>
	</entry>
	<entry>
		<id>https://techwiki.neosys.com/index.php?title=EXODUS_Knowledge&amp;diff=3963</id>
		<title>EXODUS Knowledge</title>
		<link rel="alternate" type="text/html" href="https://techwiki.neosys.com/index.php?title=EXODUS_Knowledge&amp;diff=3963"/>
		<updated>2022-03-07T10:43:24Z</updated>

		<summary type="html">&lt;p&gt;Gregory: /* Speedup postgresql importing databases */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==TMUX Screens==&lt;br /&gt;
&lt;br /&gt;
To create the EXODUS maintenance/programming environment&lt;br /&gt;
 exodus#: ./tmux.exodus&lt;br /&gt;
&lt;br /&gt;
===Screens===&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
0: /&lt;br /&gt;
    Work regarding exodus server. i.e /etc/nagios or general networking or /var/log/mail.log&lt;br /&gt;
&lt;br /&gt;
1: /root/exodus/&lt;br /&gt;
    Exodus core is installed Contains build and make libraries here ./libexodus&lt;br /&gt;
&lt;br /&gt;
2: /root/exodus/libexodus/exodus&lt;br /&gt;
    Core exodus (libraries that emulate the AREV system e.g mv.h )&lt;br /&gt;
    &lt;br /&gt;
3: /root/exodus/cli/src&lt;br /&gt;
    Exodus Command Line Interface e.g edir, edic, list, listfiles, delete, createdb&lt;br /&gt;
    &lt;br /&gt;
4: root/exodus/service&lt;br /&gt;
    EXODUS core default host directory but also contains scripts that create/manage requirements of a service (create_service, create_db, create_site, backup_db, restore_db, start, stop, status)&lt;br /&gt;
    One exception is NEOSYS www files are in ./www, which pulled from NEOSYS www git.&lt;br /&gt;
&lt;br /&gt;
5: /root/exodus/service/src&lt;br /&gt;
    Exodus core service programs (programs that are not related to NEOSYS agency operations and can be used to support other non-NEOSYS services) eg listen, usersubs, sendmail, openfile, select, sort, list,.&lt;br /&gt;
&lt;br /&gt;
    Extra info:    &lt;br /&gt;
    sql directory contains basic dictiorary files converted to sql instructions used when creating a EXODUS psql database&lt;br /&gt;
    e.g dict_voc.sql is a file that describes what to expect in certain fields of the voc file.&lt;br /&gt;
    TODO: compall currently throws few warnings. Read them and familiarise. In case new warnings appear, notify Steve.    &lt;br /&gt;
        &lt;br /&gt;
6: /root/neosys&lt;br /&gt;
    NEOSYS specific client installation management scripts e.g .doall, import_db and import_files (from AREV), ./run ./test (see below for these two commands)&lt;br /&gt;
    &lt;br /&gt;
7: /root/neosys/src&lt;br /&gt;
    NEOSYS Agency programs (see section How AREV programs are distributed in EXODUS src/*.cpp&lt;br /&gt;
    ../ has .git&lt;br /&gt;
&lt;br /&gt;
8: /root/hosts&lt;br /&gt;
    client specific files  e.g logs, images, (shared ./www -&amp;gt; root/exodus/service/www&lt;br /&gt;
&lt;br /&gt;
9: /root/exodus/test/src&lt;br /&gt;
    series of programs that test whether subroutines (specifically Exodus core libraries) work as they should eg for the var lib - &amp;quot;assert( var(&amp;quot;11111&amp;quot;).isnum());&amp;quot;&lt;br /&gt;
&lt;br /&gt;
10: bash /bin/top&lt;br /&gt;
    Monitor for NEOSYS client processes&lt;br /&gt;
    Displays customised format: sorted by total time spend and by processor time.&lt;br /&gt;
     Press &amp;quot;=&amp;quot; : to change to standard top format&lt;br /&gt;
     Press shift + w : to save format settings, replacing the old customised top format&lt;br /&gt;
     To go back to the customised format do:&lt;br /&gt;
        Press &amp;quot;o&amp;quot;&lt;br /&gt;
        Type &amp;quot;COMMAND=serve_agy&amp;quot;&lt;br /&gt;
        shift + t : this sorts by total time spent&lt;br /&gt;
        shift + p : this sorts by processor time&lt;br /&gt;
        shift + w : to save this setting and enter  &#039;y&#039; to confirm&lt;br /&gt;
&lt;br /&gt;
11: /var/log/syslog&lt;br /&gt;
     Log of NEOSYS client requests&lt;br /&gt;
&lt;br /&gt;
12: /root/exodus/service/quick&lt;br /&gt;
     Displays the last time the svr file (in /root/hosts/&amp;lt;client&amp;gt;/data/&amp;lt;dbname&amp;gt;) was updated.&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Object Code/Libraries==&lt;br /&gt;
LIVE and TEST processes use different sets of object code.&lt;br /&gt;
TEST processes use libraries in ~/lib/, whereas LIVE processes use object code in ~/neo/lib&lt;br /&gt;
&lt;br /&gt;
This means development &amp;amp; testing can be done stress free on TEST database, as opposed to testing on production databases.&lt;br /&gt;
&lt;br /&gt;
When compiling using edic, the TEST object code is updated if the compilation is successful. (~/lib)&lt;br /&gt;
In order to apply a tested patch to LIVE see [[Update LIVE programs]].&lt;br /&gt;
&lt;br /&gt;
==Dictionaries==&lt;br /&gt;
Dictionaries, the files used to describe the fields of a file&#039;s record.&lt;br /&gt;
Unlike in AREV, there is a copy of all dictionaries in each pgsql database (In AREV, updating a dictionary would affect all the databases).&lt;br /&gt;
&lt;br /&gt;
==Processes==&lt;br /&gt;
The TEST process for all database use the same object code stored in /root/lib, whereas all LIVE process use the object code in /root/neo/.&lt;br /&gt;
&lt;br /&gt;
==Postgres==&lt;br /&gt;
Connect into postgres shell:&lt;br /&gt;
 alias psql=&#039;sudo -u postgres psql&#039;&lt;br /&gt;
&lt;br /&gt;
Delete a database:&lt;br /&gt;
 sudo -u postgres dropdb &amp;lt;dbcode&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Debugging Exodus==&lt;br /&gt;
&lt;br /&gt;
===Debugging Live/Test services===&lt;br /&gt;
&lt;br /&gt;
./test &amp;lt;dbname&amp;gt; - execute test programs on _test database.&lt;br /&gt;
&lt;br /&gt;
./run &amp;lt;dbname&amp;gt;  - execute test programs on live database.&lt;br /&gt;
&lt;br /&gt;
===Debugging var values===&lt;br /&gt;
&lt;br /&gt;
Explanation of var flag value in gdb debug mode.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
(gdb) p varx                                                           &lt;br /&gt;
$2 = {var_str = &amp;quot;&amp;quot;, var_int = 0, var_dbl = 0, var_typ = {flags_ = 2}}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Each exodus var object contains 3 variables of type string, int and double.&lt;br /&gt;
&lt;br /&gt;
All 3 may be unassigned or only the string be assigned or just the int and double e.t.&lt;br /&gt;
&lt;br /&gt;
You can tell which variable type of a var object are set based on the var&#039;s flag value.&lt;br /&gt;
&lt;br /&gt;
1 = Means the string is assigned&lt;br /&gt;
2 = Means the int is assigned&lt;br /&gt;
4 = Means the double is assigned&lt;br /&gt;
&lt;br /&gt;
Example: If the flag is 7 (1+2+4), then all types are assigned.&lt;br /&gt;
&lt;br /&gt;
===Process Hung or consuming +100% CPU===&lt;br /&gt;
If process is consuming +100% CPU then it is likely stuck in an infinite loop.&lt;br /&gt;
&lt;br /&gt;
 ./doall &amp;lt;CLIENT&amp;gt; stop&lt;br /&gt;
&lt;br /&gt;
 ./run &amp;lt;CLIENT&amp;gt; &lt;br /&gt;
&lt;br /&gt;
 ./test &amp;lt;CLIENT&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Search through recent logs for &amp;lt;CLIENT&amp;gt; looking for requests that didn&#039;t return OK at the time nagios alerted of Hung process.&lt;br /&gt;
&lt;br /&gt;
A user may also instigate the error again, so monitor the CLIENT&#039;s service CPU usage.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
If cause found recreate it in test and once test process hit +100% break in test debugger.&lt;br /&gt;
&lt;br /&gt;
If cause not found, you will have to continue checking logs for the request that caused it or hope a user recreates the issue in live debugged service.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Once you&#039;ve broken in the debugged with the error, enter &amp;quot;n&amp;quot; and hold the enter key until you just seeing line repeat.&lt;br /&gt;
&lt;br /&gt;
Pay attention to start of loops code. E.g WHILE or FOR. (there is likely an error is there)&lt;br /&gt;
&lt;br /&gt;
==./doall==&lt;br /&gt;
====General====&lt;br /&gt;
&lt;br /&gt;
~/neosys/doall [LIVE|TEST] &amp;lt;DBCODE|ALL&amp;gt; &amp;lt; ACTION [OPTIONS,..]  | bash -- COMMAND ]&lt;br /&gt;
&lt;br /&gt;
Example: &lt;br /&gt;
 ./doall TEST ALL create_site t-&lt;br /&gt;
Result:&lt;br /&gt;
Create site for ALL TEST databases, using domain name prefix option &amp;quot;t-&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Screen 6: ./doall script contains all the necessary information(codes) to setup an installation.&lt;br /&gt;
It includes scripts to backup, restore, create an Apache site, create/start/stop/status a service, import an AREV database into postgres and more.&lt;br /&gt;
&lt;br /&gt;
====backup_db====&lt;br /&gt;
&lt;br /&gt;
*Does a backup &amp;amp; restore of a LIVE database into the corresponding TEST database.&lt;br /&gt;
*Backup &amp;lt;dbcode&amp;gt;.sql file is written to /root/backups/sql; which is rsynced to nl19:/backups/current/exodus/&lt;br /&gt;
*Unlike AREV, postgres can perform a &amp;quot;backup&amp;quot; of a database whilst the system is in use.&lt;br /&gt;
&lt;br /&gt;
==Git==&lt;br /&gt;
&lt;br /&gt;
There are two repositories, one for EXODUS and the other for NEOSYS.&lt;br /&gt;
&lt;br /&gt;
===Using git to make changes===&lt;br /&gt;
&lt;br /&gt;
Before following steps you must have a tested updated to a program/file/script. Do not commit untested changes to avoid a messy git history of reverts.&lt;br /&gt;
&lt;br /&gt;
Update your local repo before committing to local repo using the g alias for &amp;quot;git pull --ff-only ; git push &amp;amp;&amp;amp; git status&#039;&amp;quot;:&lt;br /&gt;
&amp;lt;pre&amp;gt;g&amp;lt;/pre&amp;gt;&lt;br /&gt;
Check which updates/files have not yet been staged and/or committed:&lt;br /&gt;
Add your updates to the staged area:&lt;br /&gt;
&amp;lt;pre&amp;gt;git add &amp;lt;filename&amp;gt;&amp;lt;/pre&amp;gt;&lt;br /&gt;
or if all the changes made need to be staged:&lt;br /&gt;
&amp;lt;pre&amp;gt;git add -a&amp;lt;/pre&amp;gt;&lt;br /&gt;
Make a commit with a descriptive message on purpose of updates:&lt;br /&gt;
&amp;lt;pre&amp;gt;git commit -m &amp;lt;description n purpose of changes&amp;gt;&amp;lt;/pre&amp;gt;&lt;br /&gt;
Again use g alias:&lt;br /&gt;
&amp;lt;pre&amp;gt;g&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Other useful git cmds===&lt;br /&gt;
&lt;br /&gt;
Do not use this commands unless you know what WILL happen. &lt;br /&gt;
*git pull - Instead use the safe &amp;quot;git pull --ff-only&amp;quot;&lt;br /&gt;
Stick to the alias &amp;quot;g&amp;quot; which does &amp;quot;git pull --ff-only ; git push &amp;amp;&amp;amp; git status&#039;&amp;quot;&lt;br /&gt;
&lt;br /&gt;
*git log - display history of commits to master branch&lt;br /&gt;
*git diff - display the differences in files between working files and files in local repo.&lt;br /&gt;
*git status - display: which updated files are staged/not staged(tracked)&lt;br /&gt;
*git stash - &lt;br /&gt;
*git branch - switch to a new branch&lt;br /&gt;
*git branch &amp;lt;branchname&amp;gt; - will switch to this branch only if it exists&lt;br /&gt;
*git checkout - DESTROYS/Updates the state of local working directory with the state of the files in the local repo. (YOU WILL LOSE non staged updates)&lt;br /&gt;
*git restore &amp;lt;filename&amp;gt; - DESTROYS/Updates the file with the version in the local repo. (like with git checkout but for a specific file)&lt;br /&gt;
*git checkin - &lt;br /&gt;
*git revert &amp;lt;commitHash&amp;gt; - reverses a specific commit (use git log to get the chosen commit hash)&lt;br /&gt;
*git ..&lt;br /&gt;
&lt;br /&gt;
==Converting AREV programs to EXODUS==&lt;br /&gt;
===Decompile AREV to C++===&lt;br /&gt;
&lt;br /&gt;
Do in Master AREV Installation Maintenance mode: (win7)&lt;br /&gt;
&lt;br /&gt;
#ATTACH ADECOMC &lt;br /&gt;
#*ADECOM &amp;lt;programname&amp;gt;   *single program&lt;br /&gt;
#*ADECOM &amp;lt;prog1&amp;gt; &amp;lt;prog2&amp;gt; &lt;br /&gt;
#*ADECOMALL              *all programs   (CHECK FIRST)&lt;br /&gt;
&lt;br /&gt;
Include the option &amp;quot;(V)&amp;quot; in the command to print the C++ to a notepad, which can easily be copy and pasted.&lt;br /&gt;
&lt;br /&gt;
===Getting C++ program to Exodus Installation===&lt;br /&gt;
&lt;br /&gt;
Two methods: (use the first for one off programs)&lt;br /&gt;
&lt;br /&gt;
====Copy &amp;amp; Paste====&lt;br /&gt;
&lt;br /&gt;
Compile program and open source code in notepad&lt;br /&gt;
&lt;br /&gt;
 ADECOM &amp;lt;programname&amp;gt; (V)&lt;br /&gt;
&lt;br /&gt;
Find which directory the program belongs. e.g fin/med/job/sys e.t&lt;br /&gt;
&lt;br /&gt;
 find /cygdrive/d/exodus/pickos | grep &amp;lt;program name&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If cpp in SYS, the program belongs in ~/exodus/service/src OR if in MED JOB FIN GEN AGY the program belongs in ~/neosys/src&lt;br /&gt;
&lt;br /&gt;
Copy the source code in the text file from the first command.&lt;br /&gt;
&lt;br /&gt;
In Exodus, create a new .cpp (in correct directory) and paste the source code.&lt;br /&gt;
&lt;br /&gt;
Compile &amp;amp; Test&lt;br /&gt;
&lt;br /&gt;
====Rsync====&lt;br /&gt;
&lt;br /&gt;
 /d/exodus/arev/syncup.sh&lt;br /&gt;
&lt;br /&gt;
If cpp in SYS then: ~/exodus/service/src ./getpickos&lt;br /&gt;
&lt;br /&gt;
If cpp in MED JOB FIN GEN AGY then: *~/neosys/src&lt;br /&gt;
&lt;br /&gt;
===Compile C++ files to TEST system===&lt;br /&gt;
&lt;br /&gt;
#*./test &amp;lt;DBNAME&amp;gt;&lt;br /&gt;
#*~/neosys ./doall TEST &amp;lt;DBNAME&amp;gt; restart    #to get one service to start start using the new lib files&lt;br /&gt;
#*~/neosys ./doall TEST all restart         #to get all the services to start start using the new lib files&lt;br /&gt;
&lt;br /&gt;
===Install C++ files to LIVE System===&lt;br /&gt;
&lt;br /&gt;
#~/exodus/service/ ./copyall            #to copy all the ~/lib and bin files to ~/live/lib and bin ... which is used by all exodus/live services&lt;br /&gt;
&lt;br /&gt;
==Writing Standard Exodus Core Function/Method Testing==&lt;br /&gt;
Screen 9: ~/exodus/test/src/&lt;br /&gt;
There are a series of test programs that check whether methods/functions behave as intended.&lt;br /&gt;
They do this using the function, assert.. a 1 or more argument values produce one and only one output)&lt;br /&gt;
&lt;br /&gt;
e.g test_multilang.cpp or test_sort.cpp&lt;br /&gt;
&lt;br /&gt;
Two methods of running test programs:&lt;br /&gt;
*Screen 9: make test&lt;br /&gt;
*after compiling using edic/compile/c, enter test_prog_name. (Since compile has moved it to ~/bin)&lt;br /&gt;
&lt;br /&gt;
Difference between the two methods is make calls gdb directly;&lt;br /&gt;
whereas ~/bin/test_prog_name uses exodus compile program&lt;br /&gt;
#~/neosys ./doall LIVE all restart&lt;br /&gt;
&lt;br /&gt;
==Updating a pgsql function in an exodus dictionary==&lt;br /&gt;
&lt;br /&gt;
PENDING&lt;br /&gt;
&lt;br /&gt;
==Development and deployment using &#039;dat&#039; files==&lt;br /&gt;
&lt;br /&gt;
===Rationale===&lt;br /&gt;
&lt;br /&gt;
Part of system development is the creation of various data that is neither programs nor layout i.e. not cpp, h, html, js, php files etc.&lt;br /&gt;
&lt;br /&gt;
For example:&lt;br /&gt;
&lt;br /&gt;
*Dictionaries are data about data.&lt;br /&gt;
*Language files are data about text to use for various languages.&lt;br /&gt;
*“Change logs” are data about changes in the system.&lt;br /&gt;
&lt;br /&gt;
Historically, in EXODUS and NEOSYS, the above data has been deployed in exodus database files using SQL text files. However SQL files are not convenient for development.&lt;br /&gt;
&lt;br /&gt;
Therefore, &#039;dat&#039; text files will be used now so that standard development tools including editors and git can be fully exploited.&lt;br /&gt;
&lt;br /&gt;
===&#039;dat&#039; files===&lt;br /&gt;
&lt;br /&gt;
Each database file is represented by an os directory of the same name.&lt;br /&gt;
&lt;br /&gt;
Each record in the database file is represented by an os text file where filename is the primary key.&lt;br /&gt;
&lt;br /&gt;
For example a record with key &#039;&#039;&#039;DEADLINE&#039;&#039;&#039; in a dat file &#039;&#039;&#039;dict.materials&#039;&#039;&#039; would be represented as an os text file &#039;&#039;&#039;dat/dict.materials/DEADLINE&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Each line in the os text file represents one field in the db record. In other words, db record FM characters are represented by new line characters in &#039;dat&#039; files. Any actual new line characters required in the record, and any backslashes, are escaped and appear as &#039;\n&#039; and &#039;\\&#039; in &#039;dat&#039; files. Other database field separator characters such as VM, SM, TM and STM are stored without any conversion.&lt;br /&gt;
&lt;br /&gt;
===Location of dat files===&lt;br /&gt;
&lt;br /&gt;
The development versions are stored in exodus and neosys src/dat dirs. They form part of the standard git repositories in parallel with cpp files.&lt;br /&gt;
&lt;br /&gt;
The operational versions are stored in ~/dat and ~/live/dat alongside bin and lib dirs and are automatically installed into databases as database files on service startup. Any database functions embedded in the text files (pgsql) are also automatically installed at the same time.&lt;br /&gt;
&lt;br /&gt;
===Editing and deploying a &#039;dat&#039; file===&lt;br /&gt;
&lt;br /&gt;
It is currently a three step process to edit and deploy such &#039;dat&#039; files. &lt;br /&gt;
&lt;br /&gt;
====Edit the &#039;dat&#039; file====&lt;br /&gt;
&lt;br /&gt;
Note that EXODUS service and NEOSYS service have different src/dat folders.&lt;br /&gt;
&lt;br /&gt;
Editing language items:&lt;br /&gt;
&lt;br /&gt;
 edir dat/alanguage/SCHEDULES*ARABIC&lt;br /&gt;
&lt;br /&gt;
Editing a dictionary item:&lt;br /&gt;
&lt;br /&gt;
 edir dat/dict.materials/DEADLINE&lt;br /&gt;
&lt;br /&gt;
Editing a pgsql function in a dictionary:&lt;br /&gt;
&lt;br /&gt;
 edir dat/dict.materials/DEADLINE 8&lt;br /&gt;
&lt;br /&gt;
====Copy all &#039;dat&#039; files to ~/dat ====&lt;br /&gt;
&lt;br /&gt;
This step might be removed at a later date.&lt;br /&gt;
&lt;br /&gt;
This will cause all test databases to immediately restart and load any &#039;dat&#039; file changes into dictionaries and data files and also create any new or modified pgsql functions.&lt;br /&gt;
&lt;br /&gt;
If any ~/neosys/src/dat files were edited:&lt;br /&gt;
&lt;br /&gt;
 cd ~/neosys/src&lt;br /&gt;
 &lt;br /&gt;
 ./compall dat&lt;br /&gt;
&lt;br /&gt;
and/or, if exodus/service/dat files were edited&lt;br /&gt;
&lt;br /&gt;
 cd ~/exodus/service/src&lt;br /&gt;
 &lt;br /&gt;
 ./compall dat&lt;br /&gt;
&lt;br /&gt;
====Copy all programs and &#039;dat&#039; files to ~/live/bin|lib|dat====&lt;br /&gt;
&lt;br /&gt;
This should only be run after testing. It will cause all live databases to automatically restart and do the same as the test databases mentioned above.&lt;br /&gt;
&lt;br /&gt;
 cd ~/exodus/service&lt;br /&gt;
 &lt;br /&gt;
 ./copyall CONFIRM&lt;br /&gt;
​&lt;br /&gt;
&lt;br /&gt;
==Upgrading Exodus==&lt;br /&gt;
&lt;br /&gt;
#Inform clients.&lt;br /&gt;
#*Client hosted - Schedule a planned upgrade with client.&lt;br /&gt;
#*NEOSYS hosted - Inform all clients/users of planned morning upgrade, 24hours in advanced.      (TODO: &#039;What&#039;s New in NEOSYS&#039;) AND (emailallusers.cpp)&lt;br /&gt;
#If the morning&#039;s USB backup failed, do NOT continue upgrade procedure because if upgrade fails, we need a way to roll back system to last working state.&lt;br /&gt;
#Check upgrade works on test service using:/root/neosys/upgrade.all.sh test&lt;br /&gt;
#Check the latest patch is working.&lt;br /&gt;
#Run/root/neosys/upgrade.all.sh live&lt;br /&gt;
#Inform users their system has been upgraded and they can login.&lt;br /&gt;
&lt;br /&gt;
===Roll Back Upgrade===&lt;br /&gt;
&lt;br /&gt;
If for any reason the entire upgrade needs to be reverted (excludes clients database), follow steps below:&lt;br /&gt;
&lt;br /&gt;
#Inform users that there is a problem and services need to be stopped.&lt;br /&gt;
#Stop all exodus processes.&lt;br /&gt;
#Restore the morning&#039;s USB backup by: (Note this backup contains:  source/obj code, /etc, neosys scripts but not client data)&lt;br /&gt;
##Login into container&#039;s host and rsync the morning&#039;s usb backup to the container&#039;s /:&lt;br /&gt;
#*&amp;lt;pre&amp;gt;rsync --dry-run -avz -e &#039;ssh -p &amp;lt;C_SSHPORT&amp;gt;&#039; /backups/usb/&amp;lt;C_CODE&amp;gt; &amp;lt;C_CODE&amp;gt;:/      (Example: rsync --dry-run -avz -e &#039;ssh -p 19582&#039; /backups/usb/ad1 ad1:/&amp;lt;/pre&amp;gt;)&lt;br /&gt;
#Quick sane check, the latest git commit is not the latest git commit in the remote repo.&lt;br /&gt;
#Inform users they can login.&lt;br /&gt;
&lt;br /&gt;
==Configuring services to autostart during login==&lt;br /&gt;
For Ptcy.&lt;br /&gt;
&lt;br /&gt;
#Create a file &#039;autostart.cfg&#039; in the data folder &lt;br /&gt;
&lt;br /&gt;
 touch /root/hosts/&amp;lt;dbname&amp;gt;/data/autostart.cfg&lt;br /&gt;
&lt;br /&gt;
This will autostart a database service as long as at least one database service in that directory is running.&lt;br /&gt;
&lt;br /&gt;
For example, demo service will autostart during login if,&lt;br /&gt;
#/root/hosts/demo/data/autostart.cfg exists and&lt;br /&gt;
#demo_test service is running&lt;br /&gt;
&lt;br /&gt;
==Speedup postgresql importing databases==&lt;br /&gt;
&lt;br /&gt;
Can be sped up by a factor of 10 BUT may result in corrupt files in case of hard OS crash where the dirty memory is not flushed to storage.&lt;br /&gt;
&lt;br /&gt;
Therefore it is advisable to use this feature only briefly and REMEMBER TO REMOVE IT! &lt;br /&gt;
&lt;br /&gt;
Email to support@neosys.com whenever using it or use personal notes not memory.&lt;br /&gt;
&lt;br /&gt;
nano /etc/postgresql/12/main/postgresql.conf&lt;br /&gt;
&lt;br /&gt;
Uncomment or add a line&lt;br /&gt;
 fsync = off&lt;br /&gt;
Restart postgres … will break any neosys/exodus running processes.&lt;br /&gt;
 r postgresql&lt;br /&gt;
or reload postgres may also work&lt;/div&gt;</summary>
		<author><name>Gregory</name></author>
	</entry>
	<entry>
		<id>https://techwiki.neosys.com/index.php?title=EXODUS_Knowledge&amp;diff=3962</id>
		<title>EXODUS Knowledge</title>
		<link rel="alternate" type="text/html" href="https://techwiki.neosys.com/index.php?title=EXODUS_Knowledge&amp;diff=3962"/>
		<updated>2022-03-02T08:08:40Z</updated>

		<summary type="html">&lt;p&gt;Gregory: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==TMUX Screens==&lt;br /&gt;
&lt;br /&gt;
To create the EXODUS maintenance/programming environment&lt;br /&gt;
 exodus#: ./tmux.exodus&lt;br /&gt;
&lt;br /&gt;
===Screens===&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
0: /&lt;br /&gt;
    Work regarding exodus server. i.e /etc/nagios or general networking or /var/log/mail.log&lt;br /&gt;
&lt;br /&gt;
1: /root/exodus/&lt;br /&gt;
    Exodus core is installed Contains build and make libraries here ./libexodus&lt;br /&gt;
&lt;br /&gt;
2: /root/exodus/libexodus/exodus&lt;br /&gt;
    Core exodus (libraries that emulate the AREV system e.g mv.h )&lt;br /&gt;
    &lt;br /&gt;
3: /root/exodus/cli/src&lt;br /&gt;
    Exodus Command Line Interface e.g edir, edic, list, listfiles, delete, createdb&lt;br /&gt;
    &lt;br /&gt;
4: root/exodus/service&lt;br /&gt;
    EXODUS core default host directory but also contains scripts that create/manage requirements of a service (create_service, create_db, create_site, backup_db, restore_db, start, stop, status)&lt;br /&gt;
    One exception is NEOSYS www files are in ./www, which pulled from NEOSYS www git.&lt;br /&gt;
&lt;br /&gt;
5: /root/exodus/service/src&lt;br /&gt;
    Exodus core service programs (programs that are not related to NEOSYS agency operations and can be used to support other non-NEOSYS services) eg listen, usersubs, sendmail, openfile, select, sort, list,.&lt;br /&gt;
&lt;br /&gt;
    Extra info:    &lt;br /&gt;
    sql directory contains basic dictiorary files converted to sql instructions used when creating a EXODUS psql database&lt;br /&gt;
    e.g dict_voc.sql is a file that describes what to expect in certain fields of the voc file.&lt;br /&gt;
    TODO: compall currently throws few warnings. Read them and familiarise. In case new warnings appear, notify Steve.    &lt;br /&gt;
        &lt;br /&gt;
6: /root/neosys&lt;br /&gt;
    NEOSYS specific client installation management scripts e.g .doall, import_db and import_files (from AREV), ./run ./test (see below for these two commands)&lt;br /&gt;
    &lt;br /&gt;
7: /root/neosys/src&lt;br /&gt;
    NEOSYS Agency programs (see section How AREV programs are distributed in EXODUS src/*.cpp&lt;br /&gt;
    ../ has .git&lt;br /&gt;
&lt;br /&gt;
8: /root/hosts&lt;br /&gt;
    client specific files  e.g logs, images, (shared ./www -&amp;gt; root/exodus/service/www&lt;br /&gt;
&lt;br /&gt;
9: /root/exodus/test/src&lt;br /&gt;
    series of programs that test whether subroutines (specifically Exodus core libraries) work as they should eg for the var lib - &amp;quot;assert( var(&amp;quot;11111&amp;quot;).isnum());&amp;quot;&lt;br /&gt;
&lt;br /&gt;
10: bash /bin/top&lt;br /&gt;
    Monitor for NEOSYS client processes&lt;br /&gt;
    Displays customised format: sorted by total time spend and by processor time.&lt;br /&gt;
     Press &amp;quot;=&amp;quot; : to change to standard top format&lt;br /&gt;
     Press shift + w : to save format settings, replacing the old customised top format&lt;br /&gt;
     To go back to the customised format do:&lt;br /&gt;
        Press &amp;quot;o&amp;quot;&lt;br /&gt;
        Type &amp;quot;COMMAND=serve_agy&amp;quot;&lt;br /&gt;
        shift + t : this sorts by total time spent&lt;br /&gt;
        shift + p : this sorts by processor time&lt;br /&gt;
        shift + w : to save this setting and enter  &#039;y&#039; to confirm&lt;br /&gt;
&lt;br /&gt;
11: /var/log/syslog&lt;br /&gt;
     Log of NEOSYS client requests&lt;br /&gt;
&lt;br /&gt;
12: /root/exodus/service/quick&lt;br /&gt;
     Displays the last time the svr file (in /root/hosts/&amp;lt;client&amp;gt;/data/&amp;lt;dbname&amp;gt;) was updated.&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Object Code/Libraries==&lt;br /&gt;
LIVE and TEST processes use different sets of object code.&lt;br /&gt;
TEST processes use libraries in ~/lib/, whereas LIVE processes use object code in ~/neo/lib&lt;br /&gt;
&lt;br /&gt;
This means development &amp;amp; testing can be done stress free on TEST database, as opposed to testing on production databases.&lt;br /&gt;
&lt;br /&gt;
When compiling using edic, the TEST object code is updated if the compilation is successful. (~/lib)&lt;br /&gt;
In order to apply a tested patch to LIVE see [[Update LIVE programs]].&lt;br /&gt;
&lt;br /&gt;
==Dictionaries==&lt;br /&gt;
Dictionaries, the files used to describe the fields of a file&#039;s record.&lt;br /&gt;
Unlike in AREV, there is a copy of all dictionaries in each pgsql database (In AREV, updating a dictionary would affect all the databases).&lt;br /&gt;
&lt;br /&gt;
==Processes==&lt;br /&gt;
The TEST process for all database use the same object code stored in /root/lib, whereas all LIVE process use the object code in /root/neo/.&lt;br /&gt;
&lt;br /&gt;
==Postgres==&lt;br /&gt;
Connect into postgres shell:&lt;br /&gt;
 alias psql=&#039;sudo -u postgres psql&#039;&lt;br /&gt;
&lt;br /&gt;
Delete a database:&lt;br /&gt;
 sudo -u postgres dropdb &amp;lt;dbcode&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Debugging Exodus==&lt;br /&gt;
&lt;br /&gt;
===Debugging Live/Test services===&lt;br /&gt;
&lt;br /&gt;
./test &amp;lt;dbname&amp;gt; - execute test programs on _test database.&lt;br /&gt;
&lt;br /&gt;
./run &amp;lt;dbname&amp;gt;  - execute test programs on live database.&lt;br /&gt;
&lt;br /&gt;
===Debugging var values===&lt;br /&gt;
&lt;br /&gt;
Explanation of var flag value in gdb debug mode.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
(gdb) p varx                                                           &lt;br /&gt;
$2 = {var_str = &amp;quot;&amp;quot;, var_int = 0, var_dbl = 0, var_typ = {flags_ = 2}}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Each exodus var object contains 3 variables of type string, int and double.&lt;br /&gt;
&lt;br /&gt;
All 3 may be unassigned or only the string be assigned or just the int and double e.t.&lt;br /&gt;
&lt;br /&gt;
You can tell which variable type of a var object are set based on the var&#039;s flag value.&lt;br /&gt;
&lt;br /&gt;
1 = Means the string is assigned&lt;br /&gt;
2 = Means the int is assigned&lt;br /&gt;
4 = Means the double is assigned&lt;br /&gt;
&lt;br /&gt;
Example: If the flag is 7 (1+2+4), then all types are assigned.&lt;br /&gt;
&lt;br /&gt;
===Process Hung or consuming +100% CPU===&lt;br /&gt;
If process is consuming +100% CPU then it is likely stuck in an infinite loop.&lt;br /&gt;
&lt;br /&gt;
 ./doall &amp;lt;CLIENT&amp;gt; stop&lt;br /&gt;
&lt;br /&gt;
 ./run &amp;lt;CLIENT&amp;gt; &lt;br /&gt;
&lt;br /&gt;
 ./test &amp;lt;CLIENT&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Search through recent logs for &amp;lt;CLIENT&amp;gt; looking for requests that didn&#039;t return OK at the time nagios alerted of Hung process.&lt;br /&gt;
&lt;br /&gt;
A user may also instigate the error again, so monitor the CLIENT&#039;s service CPU usage.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
If cause found recreate it in test and once test process hit +100% break in test debugger.&lt;br /&gt;
&lt;br /&gt;
If cause not found, you will have to continue checking logs for the request that caused it or hope a user recreates the issue in live debugged service.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Once you&#039;ve broken in the debugged with the error, enter &amp;quot;n&amp;quot; and hold the enter key until you just seeing line repeat.&lt;br /&gt;
&lt;br /&gt;
Pay attention to start of loops code. E.g WHILE or FOR. (there is likely an error is there)&lt;br /&gt;
&lt;br /&gt;
==./doall==&lt;br /&gt;
====General====&lt;br /&gt;
&lt;br /&gt;
~/neosys/doall [LIVE|TEST] &amp;lt;DBCODE|ALL&amp;gt; &amp;lt; ACTION [OPTIONS,..]  | bash -- COMMAND ]&lt;br /&gt;
&lt;br /&gt;
Example: &lt;br /&gt;
 ./doall TEST ALL create_site t-&lt;br /&gt;
Result:&lt;br /&gt;
Create site for ALL TEST databases, using domain name prefix option &amp;quot;t-&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Screen 6: ./doall script contains all the necessary information(codes) to setup an installation.&lt;br /&gt;
It includes scripts to backup, restore, create an Apache site, create/start/stop/status a service, import an AREV database into postgres and more.&lt;br /&gt;
&lt;br /&gt;
====backup_db====&lt;br /&gt;
&lt;br /&gt;
*Does a backup &amp;amp; restore of a LIVE database into the corresponding TEST database.&lt;br /&gt;
*Backup &amp;lt;dbcode&amp;gt;.sql file is written to /root/backups/sql; which is rsynced to nl19:/backups/current/exodus/&lt;br /&gt;
*Unlike AREV, postgres can perform a &amp;quot;backup&amp;quot; of a database whilst the system is in use.&lt;br /&gt;
&lt;br /&gt;
==Git==&lt;br /&gt;
&lt;br /&gt;
There are two repositories, one for EXODUS and the other for NEOSYS.&lt;br /&gt;
&lt;br /&gt;
===Using git to make changes===&lt;br /&gt;
&lt;br /&gt;
Before following steps you must have a tested updated to a program/file/script. Do not commit untested changes to avoid a messy git history of reverts.&lt;br /&gt;
&lt;br /&gt;
Update your local repo before committing to local repo using the g alias for &amp;quot;git pull --ff-only ; git push &amp;amp;&amp;amp; git status&#039;&amp;quot;:&lt;br /&gt;
&amp;lt;pre&amp;gt;g&amp;lt;/pre&amp;gt;&lt;br /&gt;
Check which updates/files have not yet been staged and/or committed:&lt;br /&gt;
Add your updates to the staged area:&lt;br /&gt;
&amp;lt;pre&amp;gt;git add &amp;lt;filename&amp;gt;&amp;lt;/pre&amp;gt;&lt;br /&gt;
or if all the changes made need to be staged:&lt;br /&gt;
&amp;lt;pre&amp;gt;git add -a&amp;lt;/pre&amp;gt;&lt;br /&gt;
Make a commit with a descriptive message on purpose of updates:&lt;br /&gt;
&amp;lt;pre&amp;gt;git commit -m &amp;lt;description n purpose of changes&amp;gt;&amp;lt;/pre&amp;gt;&lt;br /&gt;
Again use g alias:&lt;br /&gt;
&amp;lt;pre&amp;gt;g&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Other useful git cmds===&lt;br /&gt;
&lt;br /&gt;
Do not use this commands unless you know what WILL happen. &lt;br /&gt;
*git pull - Instead use the safe &amp;quot;git pull --ff-only&amp;quot;&lt;br /&gt;
Stick to the alias &amp;quot;g&amp;quot; which does &amp;quot;git pull --ff-only ; git push &amp;amp;&amp;amp; git status&#039;&amp;quot;&lt;br /&gt;
&lt;br /&gt;
*git log - display history of commits to master branch&lt;br /&gt;
*git diff - display the differences in files between working files and files in local repo.&lt;br /&gt;
*git status - display: which updated files are staged/not staged(tracked)&lt;br /&gt;
*git stash - &lt;br /&gt;
*git branch - switch to a new branch&lt;br /&gt;
*git branch &amp;lt;branchname&amp;gt; - will switch to this branch only if it exists&lt;br /&gt;
*git checkout - DESTROYS/Updates the state of local working directory with the state of the files in the local repo. (YOU WILL LOSE non staged updates)&lt;br /&gt;
*git restore &amp;lt;filename&amp;gt; - DESTROYS/Updates the file with the version in the local repo. (like with git checkout but for a specific file)&lt;br /&gt;
*git checkin - &lt;br /&gt;
*git revert &amp;lt;commitHash&amp;gt; - reverses a specific commit (use git log to get the chosen commit hash)&lt;br /&gt;
*git ..&lt;br /&gt;
&lt;br /&gt;
==Converting AREV programs to EXODUS==&lt;br /&gt;
===Decompile AREV to C++===&lt;br /&gt;
&lt;br /&gt;
Do in Master AREV Installation Maintenance mode: (win7)&lt;br /&gt;
&lt;br /&gt;
#ATTACH ADECOMC &lt;br /&gt;
#*ADECOM &amp;lt;programname&amp;gt;   *single program&lt;br /&gt;
#*ADECOM &amp;lt;prog1&amp;gt; &amp;lt;prog2&amp;gt; &lt;br /&gt;
#*ADECOMALL              *all programs   (CHECK FIRST)&lt;br /&gt;
&lt;br /&gt;
Include the option &amp;quot;(V)&amp;quot; in the command to print the C++ to a notepad, which can easily be copy and pasted.&lt;br /&gt;
&lt;br /&gt;
===Getting C++ program to Exodus Installation===&lt;br /&gt;
&lt;br /&gt;
Two methods: (use the first for one off programs)&lt;br /&gt;
&lt;br /&gt;
====Copy &amp;amp; Paste====&lt;br /&gt;
&lt;br /&gt;
Compile program and open source code in notepad&lt;br /&gt;
&lt;br /&gt;
 ADECOM &amp;lt;programname&amp;gt; (V)&lt;br /&gt;
&lt;br /&gt;
Find which directory the program belongs. e.g fin/med/job/sys e.t&lt;br /&gt;
&lt;br /&gt;
 find /cygdrive/d/exodus/pickos | grep &amp;lt;program name&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If cpp in SYS, the program belongs in ~/exodus/service/src OR if in MED JOB FIN GEN AGY the program belongs in ~/neosys/src&lt;br /&gt;
&lt;br /&gt;
Copy the source code in the text file from the first command.&lt;br /&gt;
&lt;br /&gt;
In Exodus, create a new .cpp (in correct directory) and paste the source code.&lt;br /&gt;
&lt;br /&gt;
Compile &amp;amp; Test&lt;br /&gt;
&lt;br /&gt;
====Rsync====&lt;br /&gt;
&lt;br /&gt;
 /d/exodus/arev/syncup.sh&lt;br /&gt;
&lt;br /&gt;
If cpp in SYS then: ~/exodus/service/src ./getpickos&lt;br /&gt;
&lt;br /&gt;
If cpp in MED JOB FIN GEN AGY then: *~/neosys/src&lt;br /&gt;
&lt;br /&gt;
===Compile C++ files to TEST system===&lt;br /&gt;
&lt;br /&gt;
#*./test &amp;lt;DBNAME&amp;gt;&lt;br /&gt;
#*~/neosys ./doall TEST &amp;lt;DBNAME&amp;gt; restart    #to get one service to start start using the new lib files&lt;br /&gt;
#*~/neosys ./doall TEST all restart         #to get all the services to start start using the new lib files&lt;br /&gt;
&lt;br /&gt;
===Install C++ files to LIVE System===&lt;br /&gt;
&lt;br /&gt;
#~/exodus/service/ ./copyall            #to copy all the ~/lib and bin files to ~/live/lib and bin ... which is used by all exodus/live services&lt;br /&gt;
&lt;br /&gt;
==Writing Standard Exodus Core Function/Method Testing==&lt;br /&gt;
Screen 9: ~/exodus/test/src/&lt;br /&gt;
There are a series of test programs that check whether methods/functions behave as intended.&lt;br /&gt;
They do this using the function, assert.. a 1 or more argument values produce one and only one output)&lt;br /&gt;
&lt;br /&gt;
e.g test_multilang.cpp or test_sort.cpp&lt;br /&gt;
&lt;br /&gt;
Two methods of running test programs:&lt;br /&gt;
*Screen 9: make test&lt;br /&gt;
*after compiling using edic/compile/c, enter test_prog_name. (Since compile has moved it to ~/bin)&lt;br /&gt;
&lt;br /&gt;
Difference between the two methods is make calls gdb directly;&lt;br /&gt;
whereas ~/bin/test_prog_name uses exodus compile program&lt;br /&gt;
#~/neosys ./doall LIVE all restart&lt;br /&gt;
&lt;br /&gt;
==Updating a pgsql function in an exodus dictionary==&lt;br /&gt;
&lt;br /&gt;
PENDING&lt;br /&gt;
&lt;br /&gt;
==Development and deployment using &#039;dat&#039; files==&lt;br /&gt;
&lt;br /&gt;
===Rationale===&lt;br /&gt;
&lt;br /&gt;
Part of system development is the creation of various data that is neither programs nor layout i.e. not cpp, h, html, js, php files etc.&lt;br /&gt;
&lt;br /&gt;
For example:&lt;br /&gt;
&lt;br /&gt;
*Dictionaries are data about data.&lt;br /&gt;
*Language files are data about text to use for various languages.&lt;br /&gt;
*“Change logs” are data about changes in the system.&lt;br /&gt;
&lt;br /&gt;
Historically, in EXODUS and NEOSYS, the above data has been deployed in exodus database files using SQL text files. However SQL files are not convenient for development.&lt;br /&gt;
&lt;br /&gt;
Therefore, &#039;dat&#039; text files will be used now so that standard development tools including editors and git can be fully exploited.&lt;br /&gt;
&lt;br /&gt;
===&#039;dat&#039; files===&lt;br /&gt;
&lt;br /&gt;
Each database file is represented by an os directory of the same name.&lt;br /&gt;
&lt;br /&gt;
Each record in the database file is represented by an os text file where filename is the primary key.&lt;br /&gt;
&lt;br /&gt;
For example a record with key &#039;&#039;&#039;DEADLINE&#039;&#039;&#039; in a dat file &#039;&#039;&#039;dict.materials&#039;&#039;&#039; would be represented as an os text file &#039;&#039;&#039;dat/dict.materials/DEADLINE&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Each line in the os text file represents one field in the db record. In other words, db record FM characters are represented by new line characters in &#039;dat&#039; files. Any actual new line characters required in the record, and any backslashes, are escaped and appear as &#039;\n&#039; and &#039;\\&#039; in &#039;dat&#039; files. Other database field separator characters such as VM, SM, TM and STM are stored without any conversion.&lt;br /&gt;
&lt;br /&gt;
===Location of dat files===&lt;br /&gt;
&lt;br /&gt;
The development versions are stored in exodus and neosys src/dat dirs. They form part of the standard git repositories in parallel with cpp files.&lt;br /&gt;
&lt;br /&gt;
The operational versions are stored in ~/dat and ~/live/dat alongside bin and lib dirs and are automatically installed into databases as database files on service startup. Any database functions embedded in the text files (pgsql) are also automatically installed at the same time.&lt;br /&gt;
&lt;br /&gt;
===Editing and deploying a &#039;dat&#039; file===&lt;br /&gt;
&lt;br /&gt;
It is currently a three step process to edit and deploy such &#039;dat&#039; files. &lt;br /&gt;
&lt;br /&gt;
====Edit the &#039;dat&#039; file====&lt;br /&gt;
&lt;br /&gt;
Note that EXODUS service and NEOSYS service have different src/dat folders.&lt;br /&gt;
&lt;br /&gt;
Editing language items:&lt;br /&gt;
&lt;br /&gt;
 edir dat/alanguage/SCHEDULES*ARABIC&lt;br /&gt;
&lt;br /&gt;
Editing a dictionary item:&lt;br /&gt;
&lt;br /&gt;
 edir dat/dict.materials/DEADLINE&lt;br /&gt;
&lt;br /&gt;
Editing a pgsql function in a dictionary:&lt;br /&gt;
&lt;br /&gt;
 edir dat/dict.materials/DEADLINE 8&lt;br /&gt;
&lt;br /&gt;
====Copy all &#039;dat&#039; files to ~/dat ====&lt;br /&gt;
&lt;br /&gt;
This step might be removed at a later date.&lt;br /&gt;
&lt;br /&gt;
This will cause all test databases to immediately restart and load any &#039;dat&#039; file changes into dictionaries and data files and also create any new or modified pgsql functions.&lt;br /&gt;
&lt;br /&gt;
If any ~/neosys/src/dat files were edited:&lt;br /&gt;
&lt;br /&gt;
 cd ~/neosys/src&lt;br /&gt;
 &lt;br /&gt;
 ./compall dat&lt;br /&gt;
&lt;br /&gt;
and/or, if exodus/service/dat files were edited&lt;br /&gt;
&lt;br /&gt;
 cd ~/exodus/service/src&lt;br /&gt;
 &lt;br /&gt;
 ./compall dat&lt;br /&gt;
&lt;br /&gt;
====Copy all programs and &#039;dat&#039; files to ~/live/bin|lib|dat====&lt;br /&gt;
&lt;br /&gt;
This should only be run after testing. It will cause all live databases to automatically restart and do the same as the test databases mentioned above.&lt;br /&gt;
&lt;br /&gt;
 cd ~/exodus/service&lt;br /&gt;
 &lt;br /&gt;
 ./copyall CONFIRM&lt;br /&gt;
​&lt;br /&gt;
&lt;br /&gt;
==Upgrading Exodus==&lt;br /&gt;
&lt;br /&gt;
#Inform clients.&lt;br /&gt;
#*Client hosted - Schedule a planned upgrade with client.&lt;br /&gt;
#*NEOSYS hosted - Inform all clients/users of planned morning upgrade, 24hours in advanced.      (TODO: &#039;What&#039;s New in NEOSYS&#039;) AND (emailallusers.cpp)&lt;br /&gt;
#If the morning&#039;s USB backup failed, do NOT continue upgrade procedure because if upgrade fails, we need a way to roll back system to last working state.&lt;br /&gt;
#Check upgrade works on test service using:/root/neosys/upgrade.all.sh test&lt;br /&gt;
#Check the latest patch is working.&lt;br /&gt;
#Run/root/neosys/upgrade.all.sh live&lt;br /&gt;
#Inform users their system has been upgraded and they can login.&lt;br /&gt;
&lt;br /&gt;
===Roll Back Upgrade===&lt;br /&gt;
&lt;br /&gt;
If for any reason the entire upgrade needs to be reverted (excludes clients database), follow steps below:&lt;br /&gt;
&lt;br /&gt;
#Inform users that there is a problem and services need to be stopped.&lt;br /&gt;
#Stop all exodus processes.&lt;br /&gt;
#Restore the morning&#039;s USB backup by: (Note this backup contains:  source/obj code, /etc, neosys scripts but not client data)&lt;br /&gt;
##Login into container&#039;s host and rsync the morning&#039;s usb backup to the container&#039;s /:&lt;br /&gt;
#*&amp;lt;pre&amp;gt;rsync --dry-run -avz -e &#039;ssh -p &amp;lt;C_SSHPORT&amp;gt;&#039; /backups/usb/&amp;lt;C_CODE&amp;gt; &amp;lt;C_CODE&amp;gt;:/      (Example: rsync --dry-run -avz -e &#039;ssh -p 19582&#039; /backups/usb/ad1 ad1:/&amp;lt;/pre&amp;gt;)&lt;br /&gt;
#Quick sane check, the latest git commit is not the latest git commit in the remote repo.&lt;br /&gt;
#Inform users they can login.&lt;br /&gt;
&lt;br /&gt;
==Configuring services to autostart during login==&lt;br /&gt;
For Ptcy.&lt;br /&gt;
&lt;br /&gt;
#Create a file &#039;autostart.cfg&#039; in the data folder &lt;br /&gt;
&lt;br /&gt;
 touch /root/hosts/&amp;lt;dbname&amp;gt;/data/autostart.cfg&lt;br /&gt;
&lt;br /&gt;
This will autostart a database service as long as at least one database service in that directory is running.&lt;br /&gt;
&lt;br /&gt;
For example, demo service will autostart during login if,&lt;br /&gt;
#/root/hosts/demo/data/autostart.cfg exists and&lt;br /&gt;
#demo_test service is running&lt;br /&gt;
&lt;br /&gt;
==Speedup postgresql importing databases==&lt;br /&gt;
&lt;br /&gt;
Can be sped up by a factor of 10 BUT may result in corrupt files in case of hard OS crash where the dirty memory is not flushed to storage.&lt;br /&gt;
&lt;br /&gt;
Therefore it is advisable to use this feature only briefly and REMEMBER TO REMOVE IT! &lt;br /&gt;
&lt;br /&gt;
Email to support@neosys.com whenever using it or use personal notes not memory.&lt;br /&gt;
&lt;br /&gt;
nano /etc/postgresql/12/main/postgresql.conf&lt;br /&gt;
&lt;br /&gt;
Uncomment or add a line&lt;br /&gt;
 fsync = off&lt;br /&gt;
Restart postgres … will break any neosys/exodus running processes.&lt;br /&gt;
 r postgresql&lt;br /&gt;
OR&lt;br /&gt;
 service postgresql reload&lt;br /&gt;
&lt;br /&gt;
​&lt;/div&gt;</summary>
		<author><name>Gregory</name></author>
	</entry>
	<entry>
		<id>https://techwiki.neosys.com/index.php?title=EXODUS_Knowledge&amp;diff=3960</id>
		<title>EXODUS Knowledge</title>
		<link rel="alternate" type="text/html" href="https://techwiki.neosys.com/index.php?title=EXODUS_Knowledge&amp;diff=3960"/>
		<updated>2022-02-07T08:30:12Z</updated>

		<summary type="html">&lt;p&gt;Gregory: /* General */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==TMUX Screens==&lt;br /&gt;
&lt;br /&gt;
To create the EXODUS maintenance/programming environment&lt;br /&gt;
 exodus#: ./tmux.exodus&lt;br /&gt;
&lt;br /&gt;
===Screens===&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
0: /&lt;br /&gt;
    Work regarding exodus server. i.e /etc/nagios or general networking or /var/log/mail.log&lt;br /&gt;
&lt;br /&gt;
1: /root/exodus/&lt;br /&gt;
    Exodus core is installed Contains build and make libraries here ./libexodus&lt;br /&gt;
&lt;br /&gt;
2: /root/exodus/libexodus/exodus&lt;br /&gt;
    Core exodus (libraries that emulate the AREV system e.g mv.h )&lt;br /&gt;
    &lt;br /&gt;
3: /root/exodus/cli/src&lt;br /&gt;
    Exodus Command Line Interface e.g edir, edic, list, listfiles, delete, createdb&lt;br /&gt;
    &lt;br /&gt;
4: root/exodus/service&lt;br /&gt;
    EXODUS core default host directory but also contains scripts that create/manage requirements of a service (create_service, create_db, create_site, backup_db, restore_db, start, stop, status)&lt;br /&gt;
    One exception is NEOSYS www files are in ./www, which pulled from NEOSYS www git.&lt;br /&gt;
&lt;br /&gt;
5: /root/exodus/service/src&lt;br /&gt;
    Exodus core service programs (programs that are not related to NEOSYS agency operations and can be used to support other non-NEOSYS services) eg listen, usersubs, sendmail, openfile, select, sort, list,.&lt;br /&gt;
&lt;br /&gt;
    Extra info:    &lt;br /&gt;
    sql directory contains basic dictiorary files converted to sql instructions used when creating a EXODUS psql database&lt;br /&gt;
    e.g dict_voc.sql is a file that describes what to expect in certain fields of the voc file.&lt;br /&gt;
    TODO: compall currently throws few warnings. Read them and familiarise. In case new warnings appear, notify Steve.    &lt;br /&gt;
        &lt;br /&gt;
6: /root/neosys&lt;br /&gt;
    NEOSYS specific client installation management scripts e.g .doall, import_db and import_files (from AREV), ./run ./test (see below for these two commands)&lt;br /&gt;
    &lt;br /&gt;
7: /root/neosys/src&lt;br /&gt;
    NEOSYS Agency programs (see section How AREV programs are distributed in EXODUS src/*.cpp&lt;br /&gt;
    ../ has .git&lt;br /&gt;
&lt;br /&gt;
8: /root/hosts&lt;br /&gt;
    client specific files  e.g logs, images, (shared ./www -&amp;gt; root/exodus/service/www&lt;br /&gt;
&lt;br /&gt;
9: /root/exodus/test/src&lt;br /&gt;
    series of programs that test whether subroutines (specifically Exodus core libraries) work as they should eg for the var lib - &amp;quot;assert( var(&amp;quot;11111&amp;quot;).isnum());&amp;quot;&lt;br /&gt;
&lt;br /&gt;
10: bash /bin/top&lt;br /&gt;
    Monitor for NEOSYS client processes&lt;br /&gt;
    Displays customised format: sorted by total time spend and by processor time.&lt;br /&gt;
     Press &amp;quot;=&amp;quot; : to change to standard top format&lt;br /&gt;
     Press shift + w : to save format settings, replacing the old customised top format&lt;br /&gt;
     To go back to the customised format do:&lt;br /&gt;
        Press &amp;quot;o&amp;quot;&lt;br /&gt;
        Type &amp;quot;COMMAND=serve_agy&amp;quot;&lt;br /&gt;
        shift + t : this sorts by total time spent&lt;br /&gt;
        shift + p : this sorts by processor time&lt;br /&gt;
        shift + w : to save this setting and enter  &#039;y&#039; to confirm&lt;br /&gt;
&lt;br /&gt;
11: /var/log/syslog&lt;br /&gt;
     Log of NEOSYS client requests&lt;br /&gt;
&lt;br /&gt;
12: /root/exodus/service/quick&lt;br /&gt;
     Displays the last time the svr file (in /root/hosts/&amp;lt;client&amp;gt;/data/&amp;lt;dbname&amp;gt;) was updated.&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Object Code/Libraries==&lt;br /&gt;
LIVE and TEST processes use different sets of object code.&lt;br /&gt;
TEST processes use libraries in ~/lib/, whereas LIVE processes use object code in ~/neo/lib&lt;br /&gt;
&lt;br /&gt;
This means development &amp;amp; testing can be done stress free on TEST database, as opposed to testing on production databases.&lt;br /&gt;
&lt;br /&gt;
When compiling using edic, the TEST object code is updated if the compilation is successful. (~/lib)&lt;br /&gt;
In order to apply a tested patch to LIVE see [[Update LIVE programs]].&lt;br /&gt;
&lt;br /&gt;
==Dictionaries==&lt;br /&gt;
Dictionaries, the files used to describe the fields of a file&#039;s record.&lt;br /&gt;
Unlike in AREV, there is a copy of all dictionaries in each pgsql database (In AREV, updating a dictionary would affect all the databases).&lt;br /&gt;
&lt;br /&gt;
==Processes==&lt;br /&gt;
The TEST process for all database use the same object code stored in /root/lib, whereas all LIVE process use the object code in /root/neo/.&lt;br /&gt;
&lt;br /&gt;
==Postgres==&lt;br /&gt;
Connect into postgres shell:&lt;br /&gt;
 alias psql=&#039;sudo -u postgres psql&#039;&lt;br /&gt;
&lt;br /&gt;
Delete a database:&lt;br /&gt;
 sudo -u postgres dropdb &amp;lt;dbcode&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Debugging Exodus==&lt;br /&gt;
&lt;br /&gt;
===Debugging Live/Test services===&lt;br /&gt;
&lt;br /&gt;
./test &amp;lt;dbname&amp;gt; - execute test programs on _test database.&lt;br /&gt;
&lt;br /&gt;
./run &amp;lt;dbname&amp;gt;  - execute test programs on live database.&lt;br /&gt;
&lt;br /&gt;
===Debugging var values===&lt;br /&gt;
&lt;br /&gt;
Explanation of var flag value in gdb debug mode.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
(gdb) p varx                                                           &lt;br /&gt;
$2 = {var_str = &amp;quot;&amp;quot;, var_int = 0, var_dbl = 0, var_typ = {flags_ = 2}}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Each exodus var object contains 3 variables of type string, int and double.&lt;br /&gt;
&lt;br /&gt;
All 3 may be unassigned or only the string be assigned or just the int and double e.t.&lt;br /&gt;
&lt;br /&gt;
You can tell which variable type of a var object are set based on the var&#039;s flag value.&lt;br /&gt;
&lt;br /&gt;
1 = Means the string is assigned&lt;br /&gt;
2 = Means the int is assigned&lt;br /&gt;
4 = Means the double is assigned&lt;br /&gt;
&lt;br /&gt;
Example: If the flag is 7 (1+2+4), then all types are assigned.&lt;br /&gt;
&lt;br /&gt;
===Process Hung or consuming +100% CPU===&lt;br /&gt;
If process is consuming +100% CPU then it is likely stuck in an infinite loop.&lt;br /&gt;
&lt;br /&gt;
 ./doall &amp;lt;CLIENT&amp;gt; stop&lt;br /&gt;
&lt;br /&gt;
 ./run &amp;lt;CLIENT&amp;gt; &lt;br /&gt;
&lt;br /&gt;
 ./test &amp;lt;CLIENT&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Search through recent logs for &amp;lt;CLIENT&amp;gt; looking for requests that didn&#039;t return OK at the time nagios alerted of Hung process.&lt;br /&gt;
&lt;br /&gt;
A user may also instigate the error again, so monitor the CLIENT&#039;s service CPU usage.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
If cause found recreate it in test and once test process hit +100% break in test debugger.&lt;br /&gt;
&lt;br /&gt;
If cause not found, you will have to continue checking logs for the request that caused it or hope a user recreates the issue in live debugged service.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Once you&#039;ve broken in the debugged with the error, enter &amp;quot;n&amp;quot; and hold the enter key until you just seeing line repeat.&lt;br /&gt;
&lt;br /&gt;
Pay attention to start of loops code. E.g WHILE or FOR. (there is likely an error is there)&lt;br /&gt;
&lt;br /&gt;
==./doall==&lt;br /&gt;
====General====&lt;br /&gt;
&lt;br /&gt;
~/neosys/doall [LIVE|TEST] &amp;lt;DBCODE|ALL&amp;gt; &amp;lt; ACTION [OPTIONS,..]  | bash -- COMMAND ]&lt;br /&gt;
&lt;br /&gt;
Example: &lt;br /&gt;
 ./doall TEST ALL create_site t-&lt;br /&gt;
Result:&lt;br /&gt;
Create site for ALL TEST databases, using domain name prefix option &amp;quot;t-&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Screen 6: ./doall script contains all the necessary information(codes) to setup an installation.&lt;br /&gt;
It includes scripts to backup, restore, create an Apache site, create/start/stop/status a service, import an AREV database into postgres and more.&lt;br /&gt;
&lt;br /&gt;
====backup_db====&lt;br /&gt;
&lt;br /&gt;
*Does a backup &amp;amp; restore of a LIVE database into the corresponding TEST database.&lt;br /&gt;
*Backup &amp;lt;dbcode&amp;gt;.sql file is written to /root/backups/sql; which is rsynced to nl19:/backups/current/exodus/&lt;br /&gt;
*Unlike AREV, postgres can perform a &amp;quot;backup&amp;quot; of a database whilst the system is in use.&lt;br /&gt;
&lt;br /&gt;
==Git==&lt;br /&gt;
&lt;br /&gt;
There are two repositories, one for EXODUS and the other for NEOSYS.&lt;br /&gt;
&lt;br /&gt;
===Using git to make changes===&lt;br /&gt;
&lt;br /&gt;
Before following steps you must have a tested updated to a program/file/script. Do not commit untested changes to avoid a messy git history of reverts.&lt;br /&gt;
&lt;br /&gt;
Update your local repo before committing to local repo using the g alias for &amp;quot;git pull --ff-only ; git push &amp;amp;&amp;amp; git status&#039;&amp;quot;:&lt;br /&gt;
&amp;lt;pre&amp;gt;g&amp;lt;/pre&amp;gt;&lt;br /&gt;
Check which updates/files have not yet been staged and/or committed:&lt;br /&gt;
Add your updates to the staged area:&lt;br /&gt;
&amp;lt;pre&amp;gt;git add &amp;lt;filename&amp;gt;&amp;lt;/pre&amp;gt;&lt;br /&gt;
or if all the changes made need to be staged:&lt;br /&gt;
&amp;lt;pre&amp;gt;git add -a&amp;lt;/pre&amp;gt;&lt;br /&gt;
Make a commit with a descriptive message on purpose of updates:&lt;br /&gt;
&amp;lt;pre&amp;gt;git commit -m &amp;lt;description n purpose of changes&amp;gt;&amp;lt;/pre&amp;gt;&lt;br /&gt;
Again use g alias:&lt;br /&gt;
&amp;lt;pre&amp;gt;g&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Other useful git cmds===&lt;br /&gt;
&lt;br /&gt;
Do not use this commands unless you know what WILL happen. &lt;br /&gt;
*git pull - Instead use the safe &amp;quot;git pull --ff-only&amp;quot;&lt;br /&gt;
Stick to the alias &amp;quot;g&amp;quot; which does &amp;quot;git pull --ff-only ; git push &amp;amp;&amp;amp; git status&#039;&amp;quot;&lt;br /&gt;
&lt;br /&gt;
*git log - display history of commits to master branch&lt;br /&gt;
*git diff - display the differences in files between working files and files in local repo.&lt;br /&gt;
*git status - display: which updated files are staged/not staged(tracked)&lt;br /&gt;
*git stash - &lt;br /&gt;
*git branch - switch to a new branch&lt;br /&gt;
*git branch &amp;lt;branchname&amp;gt; - will switch to this branch only if it exists&lt;br /&gt;
*git checkout - DESTROYS/Updates the state of local working directory with the state of the files in the local repo. (YOU WILL LOSE non staged updates)&lt;br /&gt;
*git restore &amp;lt;filename&amp;gt; - DESTROYS/Updates the file with the version in the local repo. (like with git checkout but for a specific file)&lt;br /&gt;
*git checkin - &lt;br /&gt;
*git revert &amp;lt;commitHash&amp;gt; - reverses a specific commit (use git log to get the chosen commit hash)&lt;br /&gt;
*git ..&lt;br /&gt;
&lt;br /&gt;
==Converting AREV programs to EXODUS==&lt;br /&gt;
===Decompile AREV to C++===&lt;br /&gt;
&lt;br /&gt;
Do in Master AREV Installation Maintenance mode: (win7)&lt;br /&gt;
&lt;br /&gt;
#ATTACH ADECOMC &lt;br /&gt;
#*ADECOM &amp;lt;programname&amp;gt;   *single program&lt;br /&gt;
#*ADECOM &amp;lt;prog1&amp;gt; &amp;lt;prog2&amp;gt; &lt;br /&gt;
#*ADECOMALL              *all programs   (CHECK FIRST)&lt;br /&gt;
&lt;br /&gt;
Include the option &amp;quot;(V)&amp;quot; in the command to print the C++ to a notepad, which can easily be copy and pasted.&lt;br /&gt;
&lt;br /&gt;
===Getting C++ program to Exodus Installation===&lt;br /&gt;
&lt;br /&gt;
Two methods: (use the first for one off programs)&lt;br /&gt;
&lt;br /&gt;
====Copy &amp;amp; Paste====&lt;br /&gt;
&lt;br /&gt;
Compile program and open source code in notepad&lt;br /&gt;
&lt;br /&gt;
 ADECOM &amp;lt;programname&amp;gt; (V)&lt;br /&gt;
&lt;br /&gt;
Find which directory the program belongs. e.g fin/med/job/sys e.t&lt;br /&gt;
&lt;br /&gt;
 find /cygdrive/d/exodus/pickos | grep &amp;lt;program name&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If cpp in SYS, the program belongs in ~/exodus/service/src OR if in MED JOB FIN GEN AGY the program belongs in ~/neosys/src&lt;br /&gt;
&lt;br /&gt;
Copy the source code in the text file from the first command.&lt;br /&gt;
&lt;br /&gt;
In Exodus, create a new .cpp (in correct directory) and paste the source code.&lt;br /&gt;
&lt;br /&gt;
Compile &amp;amp; Test&lt;br /&gt;
&lt;br /&gt;
====Rsync====&lt;br /&gt;
&lt;br /&gt;
 /d/exodus/arev/syncup.sh&lt;br /&gt;
&lt;br /&gt;
If cpp in SYS then: ~/exodus/service/src ./getpickos&lt;br /&gt;
&lt;br /&gt;
If cpp in MED JOB FIN GEN AGY then: *~/neosys/src&lt;br /&gt;
&lt;br /&gt;
===Compile C++ files to TEST system===&lt;br /&gt;
&lt;br /&gt;
#*./test &amp;lt;DBNAME&amp;gt;&lt;br /&gt;
#*~/neosys ./doall TEST &amp;lt;DBNAME&amp;gt; restart    #to get one service to start start using the new lib files&lt;br /&gt;
#*~/neosys ./doall TEST all restart         #to get all the services to start start using the new lib files&lt;br /&gt;
&lt;br /&gt;
===Install C++ files to LIVE System===&lt;br /&gt;
&lt;br /&gt;
#~/exodus/service/ ./copyall            #to copy all the ~/lib and bin files to ~/live/lib and bin ... which is used by all exodus/live services&lt;br /&gt;
&lt;br /&gt;
==Writing Standard Exodus Core Function/Method Testing==&lt;br /&gt;
Screen 9: ~/exodus/test/src/&lt;br /&gt;
There are a series of test programs that check whether methods/functions behave as intended.&lt;br /&gt;
They do this using the function, assert.. a 1 or more argument values produce one and only one output)&lt;br /&gt;
&lt;br /&gt;
e.g test_multilang.cpp or test_sort.cpp&lt;br /&gt;
&lt;br /&gt;
Two methods of running test programs:&lt;br /&gt;
*Screen 9: make test&lt;br /&gt;
*after compiling using edic/compile/c, enter test_prog_name. (Since compile has moved it to ~/bin)&lt;br /&gt;
&lt;br /&gt;
Difference between the two methods is make calls gdb directly;&lt;br /&gt;
whereas ~/bin/test_prog_name uses exodus compile program&lt;br /&gt;
#~/neosys ./doall LIVE all restart&lt;br /&gt;
&lt;br /&gt;
==Updating a pgsql function in an exodus dictionary==&lt;br /&gt;
&lt;br /&gt;
PENDING&lt;br /&gt;
&lt;br /&gt;
==Development and deployment using &#039;dat&#039; files==&lt;br /&gt;
&lt;br /&gt;
===Rationale===&lt;br /&gt;
&lt;br /&gt;
Part of system development is the creation of various data that is neither programs nor layout i.e. not cpp, h, html, js, php files etc.&lt;br /&gt;
&lt;br /&gt;
For example:&lt;br /&gt;
&lt;br /&gt;
*Dictionaries are data about data.&lt;br /&gt;
*Language files are data about text to use for various languages.&lt;br /&gt;
*“Change logs” are data about changes in the system.&lt;br /&gt;
&lt;br /&gt;
Historically, in EXODUS and NEOSYS, the above data has been deployed in exodus database files using SQL text files. However SQL files are not convenient for development.&lt;br /&gt;
&lt;br /&gt;
Therefore, &#039;dat&#039; text files will be used now so that standard development tools including editors and git can be fully exploited.&lt;br /&gt;
&lt;br /&gt;
===&#039;dat&#039; files===&lt;br /&gt;
&lt;br /&gt;
Each database file is represented by an os directory of the same name.&lt;br /&gt;
&lt;br /&gt;
Each record in the database file is represented by an os text file where filename is the primary key.&lt;br /&gt;
&lt;br /&gt;
For example a record with key &#039;&#039;&#039;DEADLINE&#039;&#039;&#039; in a dat file &#039;&#039;&#039;dict.materials&#039;&#039;&#039; would be represented as an os text file &#039;&#039;&#039;dat/dict.materials/DEADLINE&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Each line in the os text file represents one field in the db record. In other words, db record FM characters are represented by new line characters in &#039;dat&#039; files. Any actual new line characters required in the record, and any backslashes, are escaped and appear as &#039;\n&#039; and &#039;\\&#039; in &#039;dat&#039; files. Other database field separator characters such as VM, SM, TM and STM are stored without any conversion.&lt;br /&gt;
&lt;br /&gt;
===Location of dat files===&lt;br /&gt;
&lt;br /&gt;
The development versions are stored in exodus and neosys src/dat dirs. They form part of the standard git repositories in parallel with cpp files.&lt;br /&gt;
&lt;br /&gt;
The operational versions are stored in ~/dat and ~/live/dat alongside bin and lib dirs and are automatically installed into databases as database files on service startup. Any database functions embedded in the text files (pgsql) are also automatically installed at the same time.&lt;br /&gt;
&lt;br /&gt;
===Editing and deploying a &#039;dat&#039; file===&lt;br /&gt;
&lt;br /&gt;
It is currently a three step process to edit and deploy such &#039;dat&#039; files. &lt;br /&gt;
&lt;br /&gt;
====Edit the &#039;dat&#039; file====&lt;br /&gt;
&lt;br /&gt;
Note that EXODUS service and NEOSYS service have different src/dat folders.&lt;br /&gt;
&lt;br /&gt;
Editing language items:&lt;br /&gt;
&lt;br /&gt;
 edir dat/alanguage/SCHEDULES*ARABIC&lt;br /&gt;
&lt;br /&gt;
Editing a dictionary item:&lt;br /&gt;
&lt;br /&gt;
 edir dat/dict.materials/DEADLINE&lt;br /&gt;
&lt;br /&gt;
Editing a pgsql function in a dictionary:&lt;br /&gt;
&lt;br /&gt;
 edir dat/dict.materials/DEADLINE 8&lt;br /&gt;
&lt;br /&gt;
====Copy all &#039;dat&#039; files to ~/dat ====&lt;br /&gt;
&lt;br /&gt;
This step might be removed at a later date.&lt;br /&gt;
&lt;br /&gt;
This will cause all test databases to immediately restart and load any &#039;dat&#039; file changes into dictionaries and data files and also create any new or modified pgsql functions.&lt;br /&gt;
&lt;br /&gt;
If any ~/neosys/src/dat files were edited:&lt;br /&gt;
&lt;br /&gt;
 cd ~/neosys/src&lt;br /&gt;
 &lt;br /&gt;
 ./compall dat&lt;br /&gt;
&lt;br /&gt;
and/or, if exodus/service/dat files were edited&lt;br /&gt;
&lt;br /&gt;
 cd ~/exodus/service/src&lt;br /&gt;
 &lt;br /&gt;
 ./compall dat&lt;br /&gt;
&lt;br /&gt;
====Copy all programs and &#039;dat&#039; files to ~/live/bin|lib|dat====&lt;br /&gt;
&lt;br /&gt;
This should only be run after testing. It will cause all live databases to automatically restart and do the same as the test databases mentioned above.&lt;br /&gt;
&lt;br /&gt;
 cd ~/exodus/service&lt;br /&gt;
 &lt;br /&gt;
 ./copyall CONFIRM&lt;br /&gt;
​&lt;br /&gt;
&lt;br /&gt;
==Upgrading Exodus==&lt;br /&gt;
&lt;br /&gt;
#Inform clients.&lt;br /&gt;
#*Client hosted - Schedule a planned upgrade with client.&lt;br /&gt;
#*NEOSYS hosted - Inform all clients/users of planned morning upgrade, 24hours in advanced.      (TODO: &#039;What&#039;s New in NEOSYS&#039;) AND (emailallusers.cpp)&lt;br /&gt;
#If the morning&#039;s USB backup failed, do NOT continue upgrade procedure because if upgrade fails, we need a way to roll back system to last working state.&lt;br /&gt;
#Check upgrade works on test service using:/root/neosys/upgrade.all.sh test&lt;br /&gt;
#Check the latest patch is working.&lt;br /&gt;
#Run/root/neosys/upgrade.all.sh live&lt;br /&gt;
#Inform users their system has been upgraded and they can login.&lt;br /&gt;
&lt;br /&gt;
===Roll Back Upgrade===&lt;br /&gt;
&lt;br /&gt;
If for any reason the entire upgrade needs to be reverted (excludes clients database), follow steps below:&lt;br /&gt;
&lt;br /&gt;
#Inform users that there is a problem and services need to be stopped.&lt;br /&gt;
#Stop all exodus processes.&lt;br /&gt;
#Restore the morning&#039;s USB backup by: (Note this backup contains:  source/obj code, /etc, neosys scripts but not client data)&lt;br /&gt;
##Login into container&#039;s host and rsync the morning&#039;s usb backup to the container&#039;s /:&lt;br /&gt;
#*&amp;lt;pre&amp;gt;rsync --dry-run -avz -e &#039;ssh -p &amp;lt;C_SSHPORT&amp;gt;&#039; /backups/usb/&amp;lt;C_CODE&amp;gt; &amp;lt;C_CODE&amp;gt;:/      (Example: rsync --dry-run -avz -e &#039;ssh -p 19582&#039; /backups/usb/ad1 ad1:/&amp;lt;/pre&amp;gt;)&lt;br /&gt;
#Quick sane check, the latest git commit is not the latest git commit in the remote repo.&lt;br /&gt;
#Inform users they can login.&lt;br /&gt;
&lt;br /&gt;
==Configuring services to autostart during login==&lt;br /&gt;
&lt;br /&gt;
Create a file &#039;autostart.cfg&#039; in the data folder &lt;br /&gt;
&lt;br /&gt;
 touch /root/hosts/&amp;lt;dbname&amp;gt;/data/autostart.cfg&lt;br /&gt;
&lt;br /&gt;
This will autostart a database service as long as at least one database service in that directory is running.&lt;br /&gt;
&lt;br /&gt;
For example, demo service will autostart during login if,&lt;br /&gt;
#/root/hosts/demo/data/autostart.cfg exists and&lt;br /&gt;
#demo_test service is running&lt;/div&gt;</summary>
		<author><name>Gregory</name></author>
	</entry>
	<entry>
		<id>https://techwiki.neosys.com/index.php?title=EXODUS_Knowledge&amp;diff=3959</id>
		<title>EXODUS Knowledge</title>
		<link rel="alternate" type="text/html" href="https://techwiki.neosys.com/index.php?title=EXODUS_Knowledge&amp;diff=3959"/>
		<updated>2022-02-07T08:25:26Z</updated>

		<summary type="html">&lt;p&gt;Gregory: /* Process Hung or consuming 100%+ CPU */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==TMUX Screens==&lt;br /&gt;
&lt;br /&gt;
To create the EXODUS maintenance/programming environment&lt;br /&gt;
 exodus#: ./tmux.exodus&lt;br /&gt;
&lt;br /&gt;
===Screens===&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
0: /&lt;br /&gt;
    Work regarding exodus server. i.e /etc/nagios or general networking or /var/log/mail.log&lt;br /&gt;
&lt;br /&gt;
1: /root/exodus/&lt;br /&gt;
    Exodus core is installed Contains build and make libraries here ./libexodus&lt;br /&gt;
&lt;br /&gt;
2: /root/exodus/libexodus/exodus&lt;br /&gt;
    Core exodus (libraries that emulate the AREV system e.g mv.h )&lt;br /&gt;
    &lt;br /&gt;
3: /root/exodus/cli/src&lt;br /&gt;
    Exodus Command Line Interface e.g edir, edic, list, listfiles, delete, createdb&lt;br /&gt;
    &lt;br /&gt;
4: root/exodus/service&lt;br /&gt;
    EXODUS core default host directory but also contains scripts that create/manage requirements of a service (create_service, create_db, create_site, backup_db, restore_db, start, stop, status)&lt;br /&gt;
    One exception is NEOSYS www files are in ./www, which pulled from NEOSYS www git.&lt;br /&gt;
&lt;br /&gt;
5: /root/exodus/service/src&lt;br /&gt;
    Exodus core service programs (programs that are not related to NEOSYS agency operations and can be used to support other non-NEOSYS services) eg listen, usersubs, sendmail, openfile, select, sort, list,.&lt;br /&gt;
&lt;br /&gt;
    Extra info:    &lt;br /&gt;
    sql directory contains basic dictiorary files converted to sql instructions used when creating a EXODUS psql database&lt;br /&gt;
    e.g dict_voc.sql is a file that describes what to expect in certain fields of the voc file.&lt;br /&gt;
    TODO: compall currently throws few warnings. Read them and familiarise. In case new warnings appear, notify Steve.    &lt;br /&gt;
        &lt;br /&gt;
6: /root/neosys&lt;br /&gt;
    NEOSYS specific client installation management scripts e.g .doall, import_db and import_files (from AREV), ./run ./test (see below for these two commands)&lt;br /&gt;
    &lt;br /&gt;
7: /root/neosys/src&lt;br /&gt;
    NEOSYS Agency programs (see section How AREV programs are distributed in EXODUS src/*.cpp&lt;br /&gt;
    ../ has .git&lt;br /&gt;
&lt;br /&gt;
8: /root/hosts&lt;br /&gt;
    client specific files  e.g logs, images, (shared ./www -&amp;gt; root/exodus/service/www&lt;br /&gt;
&lt;br /&gt;
9: /root/exodus/test/src&lt;br /&gt;
    series of programs that test whether subroutines (specifically Exodus core libraries) work as they should eg for the var lib - &amp;quot;assert( var(&amp;quot;11111&amp;quot;).isnum());&amp;quot;&lt;br /&gt;
&lt;br /&gt;
10: bash /bin/top&lt;br /&gt;
    Monitor for NEOSYS client processes&lt;br /&gt;
    Displays customised format: sorted by total time spend and by processor time.&lt;br /&gt;
     Press &amp;quot;=&amp;quot; : to change to standard top format&lt;br /&gt;
     Press shift + w : to save format settings, replacing the old customised top format&lt;br /&gt;
     To go back to the customised format do:&lt;br /&gt;
        Press &amp;quot;o&amp;quot;&lt;br /&gt;
        Type &amp;quot;COMMAND=serve_agy&amp;quot;&lt;br /&gt;
        shift + t : this sorts by total time spent&lt;br /&gt;
        shift + p : this sorts by processor time&lt;br /&gt;
        shift + w : to save this setting and enter  &#039;y&#039; to confirm&lt;br /&gt;
&lt;br /&gt;
11: /var/log/syslog&lt;br /&gt;
     Log of NEOSYS client requests&lt;br /&gt;
&lt;br /&gt;
12: /root/exodus/service/quick&lt;br /&gt;
     Displays the last time the svr file (in /root/hosts/&amp;lt;client&amp;gt;/data/&amp;lt;dbname&amp;gt;) was updated.&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Object Code/Libraries==&lt;br /&gt;
LIVE and TEST processes use different sets of object code.&lt;br /&gt;
TEST processes use libraries in ~/lib/, whereas LIVE processes use object code in ~/neo/lib&lt;br /&gt;
&lt;br /&gt;
This means development &amp;amp; testing can be done stress free on TEST database, as opposed to testing on production databases.&lt;br /&gt;
&lt;br /&gt;
When compiling using edic, the TEST object code is updated if the compilation is successful. (~/lib)&lt;br /&gt;
In order to apply a tested patch to LIVE see [[Update LIVE programs]].&lt;br /&gt;
&lt;br /&gt;
==Dictionaries==&lt;br /&gt;
Dictionaries, the files used to describe the fields of a file&#039;s record.&lt;br /&gt;
Unlike in AREV, there is a copy of all dictionaries in each pgsql database (In AREV, updating a dictionary would affect all the databases).&lt;br /&gt;
&lt;br /&gt;
==Processes==&lt;br /&gt;
The TEST process for all database use the same object code stored in /root/lib, whereas all LIVE process use the object code in /root/neo/.&lt;br /&gt;
&lt;br /&gt;
==Postgres==&lt;br /&gt;
Connect into postgres shell:&lt;br /&gt;
 alias psql=&#039;sudo -u postgres psql&#039;&lt;br /&gt;
&lt;br /&gt;
Delete a database:&lt;br /&gt;
 sudo -u postgres dropdb &amp;lt;dbcode&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Debugging Exodus==&lt;br /&gt;
&lt;br /&gt;
===Debugging Live/Test services===&lt;br /&gt;
&lt;br /&gt;
./test &amp;lt;dbname&amp;gt; - execute test programs on _test database.&lt;br /&gt;
&lt;br /&gt;
./run &amp;lt;dbname&amp;gt;  - execute test programs on live database.&lt;br /&gt;
&lt;br /&gt;
===Debugging var values===&lt;br /&gt;
&lt;br /&gt;
Explanation of var flag value in gdb debug mode.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
(gdb) p varx                                                           &lt;br /&gt;
$2 = {var_str = &amp;quot;&amp;quot;, var_int = 0, var_dbl = 0, var_typ = {flags_ = 2}}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Each exodus var object contains 3 variables of type string, int and double.&lt;br /&gt;
&lt;br /&gt;
All 3 may be unassigned or only the string be assigned or just the int and double e.t.&lt;br /&gt;
&lt;br /&gt;
You can tell which variable type of a var object are set based on the var&#039;s flag value.&lt;br /&gt;
&lt;br /&gt;
1 = Means the string is assigned&lt;br /&gt;
2 = Means the int is assigned&lt;br /&gt;
4 = Means the double is assigned&lt;br /&gt;
&lt;br /&gt;
Example: If the flag is 7 (1+2+4), then all types are assigned.&lt;br /&gt;
&lt;br /&gt;
===Process Hung or consuming +100% CPU===&lt;br /&gt;
If process is consuming +100% CPU then it is likely stuck in an infinite loop.&lt;br /&gt;
&lt;br /&gt;
 ./doall &amp;lt;CLIENT&amp;gt; stop&lt;br /&gt;
&lt;br /&gt;
 ./run &amp;lt;CLIENT&amp;gt; &lt;br /&gt;
&lt;br /&gt;
 ./test &amp;lt;CLIENT&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Search through recent logs for &amp;lt;CLIENT&amp;gt; looking for requests that didn&#039;t return OK at the time nagios alerted of Hung process.&lt;br /&gt;
&lt;br /&gt;
A user may also instigate the error again, so monitor the CLIENT&#039;s service CPU usage.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
If cause found recreate it in test and once test process hit +100% break in test debugger.&lt;br /&gt;
&lt;br /&gt;
If cause not found, you will have to continue checking logs for the request that caused it or hope a user recreates the issue in live debugged service.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Once you&#039;ve broken in the debugged with the error, enter &amp;quot;n&amp;quot; and hold the enter key until you just seeing line repeat.&lt;br /&gt;
&lt;br /&gt;
Pay attention to start of loops code. E.g WHILE or FOR. (there is likely an error is there)&lt;br /&gt;
&lt;br /&gt;
==./doall==&lt;br /&gt;
====General====&lt;br /&gt;
Screen 6: ./doall script contains all the necessary information(codes) to setup an installation.&lt;br /&gt;
It includes scripts to backup, restore, create an Apache site, create/start/stop/status a service, import an AREV database into postgres and more.&lt;br /&gt;
&lt;br /&gt;
====backup_db====&lt;br /&gt;
&lt;br /&gt;
*Does a backup &amp;amp; restore of a LIVE database into the corresponding TEST database.&lt;br /&gt;
*Backup &amp;lt;dbcode&amp;gt;.sql file is written to /root/backups/sql; which is rsynced to nl19:/backups/current/exodus/&lt;br /&gt;
*Unlike AREV, postgres can perform a &amp;quot;backup&amp;quot; of a database whilst the system is in use.&lt;br /&gt;
&lt;br /&gt;
==Git==&lt;br /&gt;
&lt;br /&gt;
There are two repositories, one for EXODUS and the other for NEOSYS.&lt;br /&gt;
&lt;br /&gt;
===Using git to make changes===&lt;br /&gt;
&lt;br /&gt;
Before following steps you must have a tested updated to a program/file/script. Do not commit untested changes to avoid a messy git history of reverts.&lt;br /&gt;
&lt;br /&gt;
Update your local repo before committing to local repo using the g alias for &amp;quot;git pull --ff-only ; git push &amp;amp;&amp;amp; git status&#039;&amp;quot;:&lt;br /&gt;
&amp;lt;pre&amp;gt;g&amp;lt;/pre&amp;gt;&lt;br /&gt;
Check which updates/files have not yet been staged and/or committed:&lt;br /&gt;
Add your updates to the staged area:&lt;br /&gt;
&amp;lt;pre&amp;gt;git add &amp;lt;filename&amp;gt;&amp;lt;/pre&amp;gt;&lt;br /&gt;
or if all the changes made need to be staged:&lt;br /&gt;
&amp;lt;pre&amp;gt;git add -a&amp;lt;/pre&amp;gt;&lt;br /&gt;
Make a commit with a descriptive message on purpose of updates:&lt;br /&gt;
&amp;lt;pre&amp;gt;git commit -m &amp;lt;description n purpose of changes&amp;gt;&amp;lt;/pre&amp;gt;&lt;br /&gt;
Again use g alias:&lt;br /&gt;
&amp;lt;pre&amp;gt;g&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Other useful git cmds===&lt;br /&gt;
&lt;br /&gt;
Do not use this commands unless you know what WILL happen. &lt;br /&gt;
*git pull - Instead use the safe &amp;quot;git pull --ff-only&amp;quot;&lt;br /&gt;
Stick to the alias &amp;quot;g&amp;quot; which does &amp;quot;git pull --ff-only ; git push &amp;amp;&amp;amp; git status&#039;&amp;quot;&lt;br /&gt;
&lt;br /&gt;
*git log - display history of commits to master branch&lt;br /&gt;
*git diff - display the differences in files between working files and files in local repo.&lt;br /&gt;
*git status - display: which updated files are staged/not staged(tracked)&lt;br /&gt;
*git stash - &lt;br /&gt;
*git branch - switch to a new branch&lt;br /&gt;
*git branch &amp;lt;branchname&amp;gt; - will switch to this branch only if it exists&lt;br /&gt;
*git checkout - DESTROYS/Updates the state of local working directory with the state of the files in the local repo. (YOU WILL LOSE non staged updates)&lt;br /&gt;
*git restore &amp;lt;filename&amp;gt; - DESTROYS/Updates the file with the version in the local repo. (like with git checkout but for a specific file)&lt;br /&gt;
*git checkin - &lt;br /&gt;
*git revert &amp;lt;commitHash&amp;gt; - reverses a specific commit (use git log to get the chosen commit hash)&lt;br /&gt;
*git ..&lt;br /&gt;
&lt;br /&gt;
==Converting AREV programs to EXODUS==&lt;br /&gt;
===Decompile AREV to C++===&lt;br /&gt;
&lt;br /&gt;
Do in Master AREV Installation Maintenance mode: (win7)&lt;br /&gt;
&lt;br /&gt;
#ATTACH ADECOMC &lt;br /&gt;
#*ADECOM &amp;lt;programname&amp;gt;   *single program&lt;br /&gt;
#*ADECOM &amp;lt;prog1&amp;gt; &amp;lt;prog2&amp;gt; &lt;br /&gt;
#*ADECOMALL              *all programs   (CHECK FIRST)&lt;br /&gt;
&lt;br /&gt;
Include the option &amp;quot;(V)&amp;quot; in the command to print the C++ to a notepad, which can easily be copy and pasted.&lt;br /&gt;
&lt;br /&gt;
===Getting C++ program to Exodus Installation===&lt;br /&gt;
&lt;br /&gt;
Two methods: (use the first for one off programs)&lt;br /&gt;
&lt;br /&gt;
====Copy &amp;amp; Paste====&lt;br /&gt;
&lt;br /&gt;
Compile program and open source code in notepad&lt;br /&gt;
&lt;br /&gt;
 ADECOM &amp;lt;programname&amp;gt; (V)&lt;br /&gt;
&lt;br /&gt;
Find which directory the program belongs. e.g fin/med/job/sys e.t&lt;br /&gt;
&lt;br /&gt;
 find /cygdrive/d/exodus/pickos | grep &amp;lt;program name&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If cpp in SYS, the program belongs in ~/exodus/service/src OR if in MED JOB FIN GEN AGY the program belongs in ~/neosys/src&lt;br /&gt;
&lt;br /&gt;
Copy the source code in the text file from the first command.&lt;br /&gt;
&lt;br /&gt;
In Exodus, create a new .cpp (in correct directory) and paste the source code.&lt;br /&gt;
&lt;br /&gt;
Compile &amp;amp; Test&lt;br /&gt;
&lt;br /&gt;
====Rsync====&lt;br /&gt;
&lt;br /&gt;
 /d/exodus/arev/syncup.sh&lt;br /&gt;
&lt;br /&gt;
If cpp in SYS then: ~/exodus/service/src ./getpickos&lt;br /&gt;
&lt;br /&gt;
If cpp in MED JOB FIN GEN AGY then: *~/neosys/src&lt;br /&gt;
&lt;br /&gt;
===Compile C++ files to TEST system===&lt;br /&gt;
&lt;br /&gt;
#*./test &amp;lt;DBNAME&amp;gt;&lt;br /&gt;
#*~/neosys ./doall TEST &amp;lt;DBNAME&amp;gt; restart    #to get one service to start start using the new lib files&lt;br /&gt;
#*~/neosys ./doall TEST all restart         #to get all the services to start start using the new lib files&lt;br /&gt;
&lt;br /&gt;
===Install C++ files to LIVE System===&lt;br /&gt;
&lt;br /&gt;
#~/exodus/service/ ./copyall            #to copy all the ~/lib and bin files to ~/live/lib and bin ... which is used by all exodus/live services&lt;br /&gt;
&lt;br /&gt;
==Writing Standard Exodus Core Function/Method Testing==&lt;br /&gt;
Screen 9: ~/exodus/test/src/&lt;br /&gt;
There are a series of test programs that check whether methods/functions behave as intended.&lt;br /&gt;
They do this using the function, assert.. a 1 or more argument values produce one and only one output)&lt;br /&gt;
&lt;br /&gt;
e.g test_multilang.cpp or test_sort.cpp&lt;br /&gt;
&lt;br /&gt;
Two methods of running test programs:&lt;br /&gt;
*Screen 9: make test&lt;br /&gt;
*after compiling using edic/compile/c, enter test_prog_name. (Since compile has moved it to ~/bin)&lt;br /&gt;
&lt;br /&gt;
Difference between the two methods is make calls gdb directly;&lt;br /&gt;
whereas ~/bin/test_prog_name uses exodus compile program&lt;br /&gt;
#~/neosys ./doall LIVE all restart&lt;br /&gt;
&lt;br /&gt;
==Updating a pgsql function in an exodus dictionary==&lt;br /&gt;
&lt;br /&gt;
PENDING&lt;br /&gt;
&lt;br /&gt;
==Development and deployment using &#039;dat&#039; files==&lt;br /&gt;
&lt;br /&gt;
===Rationale===&lt;br /&gt;
&lt;br /&gt;
Part of system development is the creation of various data that is neither programs nor layout i.e. not cpp, h, html, js, php files etc.&lt;br /&gt;
&lt;br /&gt;
For example:&lt;br /&gt;
&lt;br /&gt;
*Dictionaries are data about data.&lt;br /&gt;
*Language files are data about text to use for various languages.&lt;br /&gt;
*“Change logs” are data about changes in the system.&lt;br /&gt;
&lt;br /&gt;
Historically, in EXODUS and NEOSYS, the above data has been deployed in exodus database files using SQL text files. However SQL files are not convenient for development.&lt;br /&gt;
&lt;br /&gt;
Therefore, &#039;dat&#039; text files will be used now so that standard development tools including editors and git can be fully exploited.&lt;br /&gt;
&lt;br /&gt;
===&#039;dat&#039; files===&lt;br /&gt;
&lt;br /&gt;
Each database file is represented by an os directory of the same name.&lt;br /&gt;
&lt;br /&gt;
Each record in the database file is represented by an os text file where filename is the primary key.&lt;br /&gt;
&lt;br /&gt;
For example a record with key &#039;&#039;&#039;DEADLINE&#039;&#039;&#039; in a dat file &#039;&#039;&#039;dict.materials&#039;&#039;&#039; would be represented as an os text file &#039;&#039;&#039;dat/dict.materials/DEADLINE&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Each line in the os text file represents one field in the db record. In other words, db record FM characters are represented by new line characters in &#039;dat&#039; files. Any actual new line characters required in the record, and any backslashes, are escaped and appear as &#039;\n&#039; and &#039;\\&#039; in &#039;dat&#039; files. Other database field separator characters such as VM, SM, TM and STM are stored without any conversion.&lt;br /&gt;
&lt;br /&gt;
===Location of dat files===&lt;br /&gt;
&lt;br /&gt;
The development versions are stored in exodus and neosys src/dat dirs. They form part of the standard git repositories in parallel with cpp files.&lt;br /&gt;
&lt;br /&gt;
The operational versions are stored in ~/dat and ~/live/dat alongside bin and lib dirs and are automatically installed into databases as database files on service startup. Any database functions embedded in the text files (pgsql) are also automatically installed at the same time.&lt;br /&gt;
&lt;br /&gt;
===Editing and deploying a &#039;dat&#039; file===&lt;br /&gt;
&lt;br /&gt;
It is currently a three step process to edit and deploy such &#039;dat&#039; files. &lt;br /&gt;
&lt;br /&gt;
====Edit the &#039;dat&#039; file====&lt;br /&gt;
&lt;br /&gt;
Note that EXODUS service and NEOSYS service have different src/dat folders.&lt;br /&gt;
&lt;br /&gt;
Editing language items:&lt;br /&gt;
&lt;br /&gt;
 edir dat/alanguage/SCHEDULES*ARABIC&lt;br /&gt;
&lt;br /&gt;
Editing a dictionary item:&lt;br /&gt;
&lt;br /&gt;
 edir dat/dict.materials/DEADLINE&lt;br /&gt;
&lt;br /&gt;
Editing a pgsql function in a dictionary:&lt;br /&gt;
&lt;br /&gt;
 edir dat/dict.materials/DEADLINE 8&lt;br /&gt;
&lt;br /&gt;
====Copy all &#039;dat&#039; files to ~/dat ====&lt;br /&gt;
&lt;br /&gt;
This step might be removed at a later date.&lt;br /&gt;
&lt;br /&gt;
This will cause all test databases to immediately restart and load any &#039;dat&#039; file changes into dictionaries and data files and also create any new or modified pgsql functions.&lt;br /&gt;
&lt;br /&gt;
If any ~/neosys/src/dat files were edited:&lt;br /&gt;
&lt;br /&gt;
 cd ~/neosys/src&lt;br /&gt;
 &lt;br /&gt;
 ./compall dat&lt;br /&gt;
&lt;br /&gt;
and/or, if exodus/service/dat files were edited&lt;br /&gt;
&lt;br /&gt;
 cd ~/exodus/service/src&lt;br /&gt;
 &lt;br /&gt;
 ./compall dat&lt;br /&gt;
&lt;br /&gt;
====Copy all programs and &#039;dat&#039; files to ~/live/bin|lib|dat====&lt;br /&gt;
&lt;br /&gt;
This should only be run after testing. It will cause all live databases to automatically restart and do the same as the test databases mentioned above.&lt;br /&gt;
&lt;br /&gt;
 cd ~/exodus/service&lt;br /&gt;
 &lt;br /&gt;
 ./copyall CONFIRM&lt;br /&gt;
​&lt;br /&gt;
&lt;br /&gt;
==Upgrading Exodus==&lt;br /&gt;
&lt;br /&gt;
#Inform clients.&lt;br /&gt;
#*Client hosted - Schedule a planned upgrade with client.&lt;br /&gt;
#*NEOSYS hosted - Inform all clients/users of planned morning upgrade, 24hours in advanced.      (TODO: &#039;What&#039;s New in NEOSYS&#039;) AND (emailallusers.cpp)&lt;br /&gt;
#If the morning&#039;s USB backup failed, do NOT continue upgrade procedure because if upgrade fails, we need a way to roll back system to last working state.&lt;br /&gt;
#Check upgrade works on test service using:/root/neosys/upgrade.all.sh test&lt;br /&gt;
#Check the latest patch is working.&lt;br /&gt;
#Run/root/neosys/upgrade.all.sh live&lt;br /&gt;
#Inform users their system has been upgraded and they can login.&lt;br /&gt;
&lt;br /&gt;
===Roll Back Upgrade===&lt;br /&gt;
&lt;br /&gt;
If for any reason the entire upgrade needs to be reverted (excludes clients database), follow steps below:&lt;br /&gt;
&lt;br /&gt;
#Inform users that there is a problem and services need to be stopped.&lt;br /&gt;
#Stop all exodus processes.&lt;br /&gt;
#Restore the morning&#039;s USB backup by: (Note this backup contains:  source/obj code, /etc, neosys scripts but not client data)&lt;br /&gt;
##Login into container&#039;s host and rsync the morning&#039;s usb backup to the container&#039;s /:&lt;br /&gt;
#*&amp;lt;pre&amp;gt;rsync --dry-run -avz -e &#039;ssh -p &amp;lt;C_SSHPORT&amp;gt;&#039; /backups/usb/&amp;lt;C_CODE&amp;gt; &amp;lt;C_CODE&amp;gt;:/      (Example: rsync --dry-run -avz -e &#039;ssh -p 19582&#039; /backups/usb/ad1 ad1:/&amp;lt;/pre&amp;gt;)&lt;br /&gt;
#Quick sane check, the latest git commit is not the latest git commit in the remote repo.&lt;br /&gt;
#Inform users they can login.&lt;br /&gt;
&lt;br /&gt;
==Configuring services to autostart during login==&lt;br /&gt;
&lt;br /&gt;
Create a file &#039;autostart.cfg&#039; in the data folder &lt;br /&gt;
&lt;br /&gt;
 touch /root/hosts/&amp;lt;dbname&amp;gt;/data/autostart.cfg&lt;br /&gt;
&lt;br /&gt;
This will autostart a database service as long as at least one database service in that directory is running.&lt;br /&gt;
&lt;br /&gt;
For example, demo service will autostart during login if,&lt;br /&gt;
#/root/hosts/demo/data/autostart.cfg exists and&lt;br /&gt;
#demo_test service is running&lt;/div&gt;</summary>
		<author><name>Gregory</name></author>
	</entry>
	<entry>
		<id>https://techwiki.neosys.com/index.php?title=EXODUS_Knowledge&amp;diff=3958</id>
		<title>EXODUS Knowledge</title>
		<link rel="alternate" type="text/html" href="https://techwiki.neosys.com/index.php?title=EXODUS_Knowledge&amp;diff=3958"/>
		<updated>2022-02-07T08:24:45Z</updated>

		<summary type="html">&lt;p&gt;Gregory: /* Process Hung or consuming 100%+ CPU */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==TMUX Screens==&lt;br /&gt;
&lt;br /&gt;
To create the EXODUS maintenance/programming environment&lt;br /&gt;
 exodus#: ./tmux.exodus&lt;br /&gt;
&lt;br /&gt;
===Screens===&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
0: /&lt;br /&gt;
    Work regarding exodus server. i.e /etc/nagios or general networking or /var/log/mail.log&lt;br /&gt;
&lt;br /&gt;
1: /root/exodus/&lt;br /&gt;
    Exodus core is installed Contains build and make libraries here ./libexodus&lt;br /&gt;
&lt;br /&gt;
2: /root/exodus/libexodus/exodus&lt;br /&gt;
    Core exodus (libraries that emulate the AREV system e.g mv.h )&lt;br /&gt;
    &lt;br /&gt;
3: /root/exodus/cli/src&lt;br /&gt;
    Exodus Command Line Interface e.g edir, edic, list, listfiles, delete, createdb&lt;br /&gt;
    &lt;br /&gt;
4: root/exodus/service&lt;br /&gt;
    EXODUS core default host directory but also contains scripts that create/manage requirements of a service (create_service, create_db, create_site, backup_db, restore_db, start, stop, status)&lt;br /&gt;
    One exception is NEOSYS www files are in ./www, which pulled from NEOSYS www git.&lt;br /&gt;
&lt;br /&gt;
5: /root/exodus/service/src&lt;br /&gt;
    Exodus core service programs (programs that are not related to NEOSYS agency operations and can be used to support other non-NEOSYS services) eg listen, usersubs, sendmail, openfile, select, sort, list,.&lt;br /&gt;
&lt;br /&gt;
    Extra info:    &lt;br /&gt;
    sql directory contains basic dictiorary files converted to sql instructions used when creating a EXODUS psql database&lt;br /&gt;
    e.g dict_voc.sql is a file that describes what to expect in certain fields of the voc file.&lt;br /&gt;
    TODO: compall currently throws few warnings. Read them and familiarise. In case new warnings appear, notify Steve.    &lt;br /&gt;
        &lt;br /&gt;
6: /root/neosys&lt;br /&gt;
    NEOSYS specific client installation management scripts e.g .doall, import_db and import_files (from AREV), ./run ./test (see below for these two commands)&lt;br /&gt;
    &lt;br /&gt;
7: /root/neosys/src&lt;br /&gt;
    NEOSYS Agency programs (see section How AREV programs are distributed in EXODUS src/*.cpp&lt;br /&gt;
    ../ has .git&lt;br /&gt;
&lt;br /&gt;
8: /root/hosts&lt;br /&gt;
    client specific files  e.g logs, images, (shared ./www -&amp;gt; root/exodus/service/www&lt;br /&gt;
&lt;br /&gt;
9: /root/exodus/test/src&lt;br /&gt;
    series of programs that test whether subroutines (specifically Exodus core libraries) work as they should eg for the var lib - &amp;quot;assert( var(&amp;quot;11111&amp;quot;).isnum());&amp;quot;&lt;br /&gt;
&lt;br /&gt;
10: bash /bin/top&lt;br /&gt;
    Monitor for NEOSYS client processes&lt;br /&gt;
    Displays customised format: sorted by total time spend and by processor time.&lt;br /&gt;
     Press &amp;quot;=&amp;quot; : to change to standard top format&lt;br /&gt;
     Press shift + w : to save format settings, replacing the old customised top format&lt;br /&gt;
     To go back to the customised format do:&lt;br /&gt;
        Press &amp;quot;o&amp;quot;&lt;br /&gt;
        Type &amp;quot;COMMAND=serve_agy&amp;quot;&lt;br /&gt;
        shift + t : this sorts by total time spent&lt;br /&gt;
        shift + p : this sorts by processor time&lt;br /&gt;
        shift + w : to save this setting and enter  &#039;y&#039; to confirm&lt;br /&gt;
&lt;br /&gt;
11: /var/log/syslog&lt;br /&gt;
     Log of NEOSYS client requests&lt;br /&gt;
&lt;br /&gt;
12: /root/exodus/service/quick&lt;br /&gt;
     Displays the last time the svr file (in /root/hosts/&amp;lt;client&amp;gt;/data/&amp;lt;dbname&amp;gt;) was updated.&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Object Code/Libraries==&lt;br /&gt;
LIVE and TEST processes use different sets of object code.&lt;br /&gt;
TEST processes use libraries in ~/lib/, whereas LIVE processes use object code in ~/neo/lib&lt;br /&gt;
&lt;br /&gt;
This means development &amp;amp; testing can be done stress free on TEST database, as opposed to testing on production databases.&lt;br /&gt;
&lt;br /&gt;
When compiling using edic, the TEST object code is updated if the compilation is successful. (~/lib)&lt;br /&gt;
In order to apply a tested patch to LIVE see [[Update LIVE programs]].&lt;br /&gt;
&lt;br /&gt;
==Dictionaries==&lt;br /&gt;
Dictionaries, the files used to describe the fields of a file&#039;s record.&lt;br /&gt;
Unlike in AREV, there is a copy of all dictionaries in each pgsql database (In AREV, updating a dictionary would affect all the databases).&lt;br /&gt;
&lt;br /&gt;
==Processes==&lt;br /&gt;
The TEST process for all database use the same object code stored in /root/lib, whereas all LIVE process use the object code in /root/neo/.&lt;br /&gt;
&lt;br /&gt;
==Postgres==&lt;br /&gt;
Connect into postgres shell:&lt;br /&gt;
 alias psql=&#039;sudo -u postgres psql&#039;&lt;br /&gt;
&lt;br /&gt;
Delete a database:&lt;br /&gt;
 sudo -u postgres dropdb &amp;lt;dbcode&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Debugging Exodus==&lt;br /&gt;
&lt;br /&gt;
===Debugging Live/Test services===&lt;br /&gt;
&lt;br /&gt;
./test &amp;lt;dbname&amp;gt; - execute test programs on _test database.&lt;br /&gt;
&lt;br /&gt;
./run &amp;lt;dbname&amp;gt;  - execute test programs on live database.&lt;br /&gt;
&lt;br /&gt;
===Debugging var values===&lt;br /&gt;
&lt;br /&gt;
Explanation of var flag value in gdb debug mode.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
(gdb) p varx                                                           &lt;br /&gt;
$2 = {var_str = &amp;quot;&amp;quot;, var_int = 0, var_dbl = 0, var_typ = {flags_ = 2}}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Each exodus var object contains 3 variables of type string, int and double.&lt;br /&gt;
&lt;br /&gt;
All 3 may be unassigned or only the string be assigned or just the int and double e.t.&lt;br /&gt;
&lt;br /&gt;
You can tell which variable type of a var object are set based on the var&#039;s flag value.&lt;br /&gt;
&lt;br /&gt;
1 = Means the string is assigned&lt;br /&gt;
2 = Means the int is assigned&lt;br /&gt;
4 = Means the double is assigned&lt;br /&gt;
&lt;br /&gt;
Example: If the flag is 7 (1+2+4), then all types are assigned.&lt;br /&gt;
&lt;br /&gt;
===Process Hung or consuming 100%+ CPU===&lt;br /&gt;
If process is consuming 100%+ CPU then it is likely stuck in an infinite loop.&lt;br /&gt;
&lt;br /&gt;
 ./doall &amp;lt;CLIENT&amp;gt; stop&lt;br /&gt;
&lt;br /&gt;
 ./run &amp;lt;CLIENT&amp;gt; &lt;br /&gt;
&lt;br /&gt;
 ./test &amp;lt;CLIENT&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Search through recent logs for &amp;lt;CLIENT&amp;gt; looking for requests that didn&#039;t return OK at the time nagios alerted of Hung process.&lt;br /&gt;
&lt;br /&gt;
A user may also instigate the error again, so monitor the CLIENT&#039;s service CPU usage.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
If cause found recreate it in test and once test process hit 100%+ break in test debugger.&lt;br /&gt;
&lt;br /&gt;
If cause not found, you will have to continue checking logs for the request that caused it or hope a user recreates the issue in live debugged service.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Once you&#039;ve broken in the debugged with the error, enter &amp;quot;n&amp;quot; and hold the enter key until you just seeing line repeat.&lt;br /&gt;
&lt;br /&gt;
Pay attention to start of loops code. E.g WHILE or FOR. (there is likely an error is there)&lt;br /&gt;
&lt;br /&gt;
==./doall==&lt;br /&gt;
====General====&lt;br /&gt;
Screen 6: ./doall script contains all the necessary information(codes) to setup an installation.&lt;br /&gt;
It includes scripts to backup, restore, create an Apache site, create/start/stop/status a service, import an AREV database into postgres and more.&lt;br /&gt;
&lt;br /&gt;
====backup_db====&lt;br /&gt;
&lt;br /&gt;
*Does a backup &amp;amp; restore of a LIVE database into the corresponding TEST database.&lt;br /&gt;
*Backup &amp;lt;dbcode&amp;gt;.sql file is written to /root/backups/sql; which is rsynced to nl19:/backups/current/exodus/&lt;br /&gt;
*Unlike AREV, postgres can perform a &amp;quot;backup&amp;quot; of a database whilst the system is in use.&lt;br /&gt;
&lt;br /&gt;
==Git==&lt;br /&gt;
&lt;br /&gt;
There are two repositories, one for EXODUS and the other for NEOSYS.&lt;br /&gt;
&lt;br /&gt;
===Using git to make changes===&lt;br /&gt;
&lt;br /&gt;
Before following steps you must have a tested updated to a program/file/script. Do not commit untested changes to avoid a messy git history of reverts.&lt;br /&gt;
&lt;br /&gt;
Update your local repo before committing to local repo using the g alias for &amp;quot;git pull --ff-only ; git push &amp;amp;&amp;amp; git status&#039;&amp;quot;:&lt;br /&gt;
&amp;lt;pre&amp;gt;g&amp;lt;/pre&amp;gt;&lt;br /&gt;
Check which updates/files have not yet been staged and/or committed:&lt;br /&gt;
Add your updates to the staged area:&lt;br /&gt;
&amp;lt;pre&amp;gt;git add &amp;lt;filename&amp;gt;&amp;lt;/pre&amp;gt;&lt;br /&gt;
or if all the changes made need to be staged:&lt;br /&gt;
&amp;lt;pre&amp;gt;git add -a&amp;lt;/pre&amp;gt;&lt;br /&gt;
Make a commit with a descriptive message on purpose of updates:&lt;br /&gt;
&amp;lt;pre&amp;gt;git commit -m &amp;lt;description n purpose of changes&amp;gt;&amp;lt;/pre&amp;gt;&lt;br /&gt;
Again use g alias:&lt;br /&gt;
&amp;lt;pre&amp;gt;g&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Other useful git cmds===&lt;br /&gt;
&lt;br /&gt;
Do not use this commands unless you know what WILL happen. &lt;br /&gt;
*git pull - Instead use the safe &amp;quot;git pull --ff-only&amp;quot;&lt;br /&gt;
Stick to the alias &amp;quot;g&amp;quot; which does &amp;quot;git pull --ff-only ; git push &amp;amp;&amp;amp; git status&#039;&amp;quot;&lt;br /&gt;
&lt;br /&gt;
*git log - display history of commits to master branch&lt;br /&gt;
*git diff - display the differences in files between working files and files in local repo.&lt;br /&gt;
*git status - display: which updated files are staged/not staged(tracked)&lt;br /&gt;
*git stash - &lt;br /&gt;
*git branch - switch to a new branch&lt;br /&gt;
*git branch &amp;lt;branchname&amp;gt; - will switch to this branch only if it exists&lt;br /&gt;
*git checkout - DESTROYS/Updates the state of local working directory with the state of the files in the local repo. (YOU WILL LOSE non staged updates)&lt;br /&gt;
*git restore &amp;lt;filename&amp;gt; - DESTROYS/Updates the file with the version in the local repo. (like with git checkout but for a specific file)&lt;br /&gt;
*git checkin - &lt;br /&gt;
*git revert &amp;lt;commitHash&amp;gt; - reverses a specific commit (use git log to get the chosen commit hash)&lt;br /&gt;
*git ..&lt;br /&gt;
&lt;br /&gt;
==Converting AREV programs to EXODUS==&lt;br /&gt;
===Decompile AREV to C++===&lt;br /&gt;
&lt;br /&gt;
Do in Master AREV Installation Maintenance mode: (win7)&lt;br /&gt;
&lt;br /&gt;
#ATTACH ADECOMC &lt;br /&gt;
#*ADECOM &amp;lt;programname&amp;gt;   *single program&lt;br /&gt;
#*ADECOM &amp;lt;prog1&amp;gt; &amp;lt;prog2&amp;gt; &lt;br /&gt;
#*ADECOMALL              *all programs   (CHECK FIRST)&lt;br /&gt;
&lt;br /&gt;
Include the option &amp;quot;(V)&amp;quot; in the command to print the C++ to a notepad, which can easily be copy and pasted.&lt;br /&gt;
&lt;br /&gt;
===Getting C++ program to Exodus Installation===&lt;br /&gt;
&lt;br /&gt;
Two methods: (use the first for one off programs)&lt;br /&gt;
&lt;br /&gt;
====Copy &amp;amp; Paste====&lt;br /&gt;
&lt;br /&gt;
Compile program and open source code in notepad&lt;br /&gt;
&lt;br /&gt;
 ADECOM &amp;lt;programname&amp;gt; (V)&lt;br /&gt;
&lt;br /&gt;
Find which directory the program belongs. e.g fin/med/job/sys e.t&lt;br /&gt;
&lt;br /&gt;
 find /cygdrive/d/exodus/pickos | grep &amp;lt;program name&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If cpp in SYS, the program belongs in ~/exodus/service/src OR if in MED JOB FIN GEN AGY the program belongs in ~/neosys/src&lt;br /&gt;
&lt;br /&gt;
Copy the source code in the text file from the first command.&lt;br /&gt;
&lt;br /&gt;
In Exodus, create a new .cpp (in correct directory) and paste the source code.&lt;br /&gt;
&lt;br /&gt;
Compile &amp;amp; Test&lt;br /&gt;
&lt;br /&gt;
====Rsync====&lt;br /&gt;
&lt;br /&gt;
 /d/exodus/arev/syncup.sh&lt;br /&gt;
&lt;br /&gt;
If cpp in SYS then: ~/exodus/service/src ./getpickos&lt;br /&gt;
&lt;br /&gt;
If cpp in MED JOB FIN GEN AGY then: *~/neosys/src&lt;br /&gt;
&lt;br /&gt;
===Compile C++ files to TEST system===&lt;br /&gt;
&lt;br /&gt;
#*./test &amp;lt;DBNAME&amp;gt;&lt;br /&gt;
#*~/neosys ./doall TEST &amp;lt;DBNAME&amp;gt; restart    #to get one service to start start using the new lib files&lt;br /&gt;
#*~/neosys ./doall TEST all restart         #to get all the services to start start using the new lib files&lt;br /&gt;
&lt;br /&gt;
===Install C++ files to LIVE System===&lt;br /&gt;
&lt;br /&gt;
#~/exodus/service/ ./copyall            #to copy all the ~/lib and bin files to ~/live/lib and bin ... which is used by all exodus/live services&lt;br /&gt;
&lt;br /&gt;
==Writing Standard Exodus Core Function/Method Testing==&lt;br /&gt;
Screen 9: ~/exodus/test/src/&lt;br /&gt;
There are a series of test programs that check whether methods/functions behave as intended.&lt;br /&gt;
They do this using the function, assert.. a 1 or more argument values produce one and only one output)&lt;br /&gt;
&lt;br /&gt;
e.g test_multilang.cpp or test_sort.cpp&lt;br /&gt;
&lt;br /&gt;
Two methods of running test programs:&lt;br /&gt;
*Screen 9: make test&lt;br /&gt;
*after compiling using edic/compile/c, enter test_prog_name. (Since compile has moved it to ~/bin)&lt;br /&gt;
&lt;br /&gt;
Difference between the two methods is make calls gdb directly;&lt;br /&gt;
whereas ~/bin/test_prog_name uses exodus compile program&lt;br /&gt;
#~/neosys ./doall LIVE all restart&lt;br /&gt;
&lt;br /&gt;
==Updating a pgsql function in an exodus dictionary==&lt;br /&gt;
&lt;br /&gt;
PENDING&lt;br /&gt;
&lt;br /&gt;
==Development and deployment using &#039;dat&#039; files==&lt;br /&gt;
&lt;br /&gt;
===Rationale===&lt;br /&gt;
&lt;br /&gt;
Part of system development is the creation of various data that is neither programs nor layout i.e. not cpp, h, html, js, php files etc.&lt;br /&gt;
&lt;br /&gt;
For example:&lt;br /&gt;
&lt;br /&gt;
*Dictionaries are data about data.&lt;br /&gt;
*Language files are data about text to use for various languages.&lt;br /&gt;
*“Change logs” are data about changes in the system.&lt;br /&gt;
&lt;br /&gt;
Historically, in EXODUS and NEOSYS, the above data has been deployed in exodus database files using SQL text files. However SQL files are not convenient for development.&lt;br /&gt;
&lt;br /&gt;
Therefore, &#039;dat&#039; text files will be used now so that standard development tools including editors and git can be fully exploited.&lt;br /&gt;
&lt;br /&gt;
===&#039;dat&#039; files===&lt;br /&gt;
&lt;br /&gt;
Each database file is represented by an os directory of the same name.&lt;br /&gt;
&lt;br /&gt;
Each record in the database file is represented by an os text file where filename is the primary key.&lt;br /&gt;
&lt;br /&gt;
For example a record with key &#039;&#039;&#039;DEADLINE&#039;&#039;&#039; in a dat file &#039;&#039;&#039;dict.materials&#039;&#039;&#039; would be represented as an os text file &#039;&#039;&#039;dat/dict.materials/DEADLINE&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Each line in the os text file represents one field in the db record. In other words, db record FM characters are represented by new line characters in &#039;dat&#039; files. Any actual new line characters required in the record, and any backslashes, are escaped and appear as &#039;\n&#039; and &#039;\\&#039; in &#039;dat&#039; files. Other database field separator characters such as VM, SM, TM and STM are stored without any conversion.&lt;br /&gt;
&lt;br /&gt;
===Location of dat files===&lt;br /&gt;
&lt;br /&gt;
The development versions are stored in exodus and neosys src/dat dirs. They form part of the standard git repositories in parallel with cpp files.&lt;br /&gt;
&lt;br /&gt;
The operational versions are stored in ~/dat and ~/live/dat alongside bin and lib dirs and are automatically installed into databases as database files on service startup. Any database functions embedded in the text files (pgsql) are also automatically installed at the same time.&lt;br /&gt;
&lt;br /&gt;
===Editing and deploying a &#039;dat&#039; file===&lt;br /&gt;
&lt;br /&gt;
It is currently a three step process to edit and deploy such &#039;dat&#039; files. &lt;br /&gt;
&lt;br /&gt;
====Edit the &#039;dat&#039; file====&lt;br /&gt;
&lt;br /&gt;
Note that EXODUS service and NEOSYS service have different src/dat folders.&lt;br /&gt;
&lt;br /&gt;
Editing language items:&lt;br /&gt;
&lt;br /&gt;
 edir dat/alanguage/SCHEDULES*ARABIC&lt;br /&gt;
&lt;br /&gt;
Editing a dictionary item:&lt;br /&gt;
&lt;br /&gt;
 edir dat/dict.materials/DEADLINE&lt;br /&gt;
&lt;br /&gt;
Editing a pgsql function in a dictionary:&lt;br /&gt;
&lt;br /&gt;
 edir dat/dict.materials/DEADLINE 8&lt;br /&gt;
&lt;br /&gt;
====Copy all &#039;dat&#039; files to ~/dat ====&lt;br /&gt;
&lt;br /&gt;
This step might be removed at a later date.&lt;br /&gt;
&lt;br /&gt;
This will cause all test databases to immediately restart and load any &#039;dat&#039; file changes into dictionaries and data files and also create any new or modified pgsql functions.&lt;br /&gt;
&lt;br /&gt;
If any ~/neosys/src/dat files were edited:&lt;br /&gt;
&lt;br /&gt;
 cd ~/neosys/src&lt;br /&gt;
 &lt;br /&gt;
 ./compall dat&lt;br /&gt;
&lt;br /&gt;
and/or, if exodus/service/dat files were edited&lt;br /&gt;
&lt;br /&gt;
 cd ~/exodus/service/src&lt;br /&gt;
 &lt;br /&gt;
 ./compall dat&lt;br /&gt;
&lt;br /&gt;
====Copy all programs and &#039;dat&#039; files to ~/live/bin|lib|dat====&lt;br /&gt;
&lt;br /&gt;
This should only be run after testing. It will cause all live databases to automatically restart and do the same as the test databases mentioned above.&lt;br /&gt;
&lt;br /&gt;
 cd ~/exodus/service&lt;br /&gt;
 &lt;br /&gt;
 ./copyall CONFIRM&lt;br /&gt;
​&lt;br /&gt;
&lt;br /&gt;
==Upgrading Exodus==&lt;br /&gt;
&lt;br /&gt;
#Inform clients.&lt;br /&gt;
#*Client hosted - Schedule a planned upgrade with client.&lt;br /&gt;
#*NEOSYS hosted - Inform all clients/users of planned morning upgrade, 24hours in advanced.      (TODO: &#039;What&#039;s New in NEOSYS&#039;) AND (emailallusers.cpp)&lt;br /&gt;
#If the morning&#039;s USB backup failed, do NOT continue upgrade procedure because if upgrade fails, we need a way to roll back system to last working state.&lt;br /&gt;
#Check upgrade works on test service using:/root/neosys/upgrade.all.sh test&lt;br /&gt;
#Check the latest patch is working.&lt;br /&gt;
#Run/root/neosys/upgrade.all.sh live&lt;br /&gt;
#Inform users their system has been upgraded and they can login.&lt;br /&gt;
&lt;br /&gt;
===Roll Back Upgrade===&lt;br /&gt;
&lt;br /&gt;
If for any reason the entire upgrade needs to be reverted (excludes clients database), follow steps below:&lt;br /&gt;
&lt;br /&gt;
#Inform users that there is a problem and services need to be stopped.&lt;br /&gt;
#Stop all exodus processes.&lt;br /&gt;
#Restore the morning&#039;s USB backup by: (Note this backup contains:  source/obj code, /etc, neosys scripts but not client data)&lt;br /&gt;
##Login into container&#039;s host and rsync the morning&#039;s usb backup to the container&#039;s /:&lt;br /&gt;
#*&amp;lt;pre&amp;gt;rsync --dry-run -avz -e &#039;ssh -p &amp;lt;C_SSHPORT&amp;gt;&#039; /backups/usb/&amp;lt;C_CODE&amp;gt; &amp;lt;C_CODE&amp;gt;:/      (Example: rsync --dry-run -avz -e &#039;ssh -p 19582&#039; /backups/usb/ad1 ad1:/&amp;lt;/pre&amp;gt;)&lt;br /&gt;
#Quick sane check, the latest git commit is not the latest git commit in the remote repo.&lt;br /&gt;
#Inform users they can login.&lt;br /&gt;
&lt;br /&gt;
==Configuring services to autostart during login==&lt;br /&gt;
&lt;br /&gt;
Create a file &#039;autostart.cfg&#039; in the data folder &lt;br /&gt;
&lt;br /&gt;
 touch /root/hosts/&amp;lt;dbname&amp;gt;/data/autostart.cfg&lt;br /&gt;
&lt;br /&gt;
This will autostart a database service as long as at least one database service in that directory is running.&lt;br /&gt;
&lt;br /&gt;
For example, demo service will autostart during login if,&lt;br /&gt;
#/root/hosts/demo/data/autostart.cfg exists and&lt;br /&gt;
#demo_test service is running&lt;/div&gt;</summary>
		<author><name>Gregory</name></author>
	</entry>
	<entry>
		<id>https://techwiki.neosys.com/index.php?title=EXODUS_Knowledge&amp;diff=3957</id>
		<title>EXODUS Knowledge</title>
		<link rel="alternate" type="text/html" href="https://techwiki.neosys.com/index.php?title=EXODUS_Knowledge&amp;diff=3957"/>
		<updated>2022-02-07T08:24:03Z</updated>

		<summary type="html">&lt;p&gt;Gregory: /* Debugging Exodus */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==TMUX Screens==&lt;br /&gt;
&lt;br /&gt;
To create the EXODUS maintenance/programming environment&lt;br /&gt;
 exodus#: ./tmux.exodus&lt;br /&gt;
&lt;br /&gt;
===Screens===&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
0: /&lt;br /&gt;
    Work regarding exodus server. i.e /etc/nagios or general networking or /var/log/mail.log&lt;br /&gt;
&lt;br /&gt;
1: /root/exodus/&lt;br /&gt;
    Exodus core is installed Contains build and make libraries here ./libexodus&lt;br /&gt;
&lt;br /&gt;
2: /root/exodus/libexodus/exodus&lt;br /&gt;
    Core exodus (libraries that emulate the AREV system e.g mv.h )&lt;br /&gt;
    &lt;br /&gt;
3: /root/exodus/cli/src&lt;br /&gt;
    Exodus Command Line Interface e.g edir, edic, list, listfiles, delete, createdb&lt;br /&gt;
    &lt;br /&gt;
4: root/exodus/service&lt;br /&gt;
    EXODUS core default host directory but also contains scripts that create/manage requirements of a service (create_service, create_db, create_site, backup_db, restore_db, start, stop, status)&lt;br /&gt;
    One exception is NEOSYS www files are in ./www, which pulled from NEOSYS www git.&lt;br /&gt;
&lt;br /&gt;
5: /root/exodus/service/src&lt;br /&gt;
    Exodus core service programs (programs that are not related to NEOSYS agency operations and can be used to support other non-NEOSYS services) eg listen, usersubs, sendmail, openfile, select, sort, list,.&lt;br /&gt;
&lt;br /&gt;
    Extra info:    &lt;br /&gt;
    sql directory contains basic dictiorary files converted to sql instructions used when creating a EXODUS psql database&lt;br /&gt;
    e.g dict_voc.sql is a file that describes what to expect in certain fields of the voc file.&lt;br /&gt;
    TODO: compall currently throws few warnings. Read them and familiarise. In case new warnings appear, notify Steve.    &lt;br /&gt;
        &lt;br /&gt;
6: /root/neosys&lt;br /&gt;
    NEOSYS specific client installation management scripts e.g .doall, import_db and import_files (from AREV), ./run ./test (see below for these two commands)&lt;br /&gt;
    &lt;br /&gt;
7: /root/neosys/src&lt;br /&gt;
    NEOSYS Agency programs (see section How AREV programs are distributed in EXODUS src/*.cpp&lt;br /&gt;
    ../ has .git&lt;br /&gt;
&lt;br /&gt;
8: /root/hosts&lt;br /&gt;
    client specific files  e.g logs, images, (shared ./www -&amp;gt; root/exodus/service/www&lt;br /&gt;
&lt;br /&gt;
9: /root/exodus/test/src&lt;br /&gt;
    series of programs that test whether subroutines (specifically Exodus core libraries) work as they should eg for the var lib - &amp;quot;assert( var(&amp;quot;11111&amp;quot;).isnum());&amp;quot;&lt;br /&gt;
&lt;br /&gt;
10: bash /bin/top&lt;br /&gt;
    Monitor for NEOSYS client processes&lt;br /&gt;
    Displays customised format: sorted by total time spend and by processor time.&lt;br /&gt;
     Press &amp;quot;=&amp;quot; : to change to standard top format&lt;br /&gt;
     Press shift + w : to save format settings, replacing the old customised top format&lt;br /&gt;
     To go back to the customised format do:&lt;br /&gt;
        Press &amp;quot;o&amp;quot;&lt;br /&gt;
        Type &amp;quot;COMMAND=serve_agy&amp;quot;&lt;br /&gt;
        shift + t : this sorts by total time spent&lt;br /&gt;
        shift + p : this sorts by processor time&lt;br /&gt;
        shift + w : to save this setting and enter  &#039;y&#039; to confirm&lt;br /&gt;
&lt;br /&gt;
11: /var/log/syslog&lt;br /&gt;
     Log of NEOSYS client requests&lt;br /&gt;
&lt;br /&gt;
12: /root/exodus/service/quick&lt;br /&gt;
     Displays the last time the svr file (in /root/hosts/&amp;lt;client&amp;gt;/data/&amp;lt;dbname&amp;gt;) was updated.&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Object Code/Libraries==&lt;br /&gt;
LIVE and TEST processes use different sets of object code.&lt;br /&gt;
TEST processes use libraries in ~/lib/, whereas LIVE processes use object code in ~/neo/lib&lt;br /&gt;
&lt;br /&gt;
This means development &amp;amp; testing can be done stress free on TEST database, as opposed to testing on production databases.&lt;br /&gt;
&lt;br /&gt;
When compiling using edic, the TEST object code is updated if the compilation is successful. (~/lib)&lt;br /&gt;
In order to apply a tested patch to LIVE see [[Update LIVE programs]].&lt;br /&gt;
&lt;br /&gt;
==Dictionaries==&lt;br /&gt;
Dictionaries, the files used to describe the fields of a file&#039;s record.&lt;br /&gt;
Unlike in AREV, there is a copy of all dictionaries in each pgsql database (In AREV, updating a dictionary would affect all the databases).&lt;br /&gt;
&lt;br /&gt;
==Processes==&lt;br /&gt;
The TEST process for all database use the same object code stored in /root/lib, whereas all LIVE process use the object code in /root/neo/.&lt;br /&gt;
&lt;br /&gt;
==Postgres==&lt;br /&gt;
Connect into postgres shell:&lt;br /&gt;
 alias psql=&#039;sudo -u postgres psql&#039;&lt;br /&gt;
&lt;br /&gt;
Delete a database:&lt;br /&gt;
 sudo -u postgres dropdb &amp;lt;dbcode&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Debugging Exodus==&lt;br /&gt;
&lt;br /&gt;
===Debugging Live/Test services===&lt;br /&gt;
&lt;br /&gt;
./test &amp;lt;dbname&amp;gt; - execute test programs on _test database.&lt;br /&gt;
&lt;br /&gt;
./run &amp;lt;dbname&amp;gt;  - execute test programs on live database.&lt;br /&gt;
&lt;br /&gt;
===Debugging var values===&lt;br /&gt;
&lt;br /&gt;
Explanation of var flag value in gdb debug mode.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
(gdb) p varx                                                           &lt;br /&gt;
$2 = {var_str = &amp;quot;&amp;quot;, var_int = 0, var_dbl = 0, var_typ = {flags_ = 2}}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Each exodus var object contains 3 variables of type string, int and double.&lt;br /&gt;
&lt;br /&gt;
All 3 may be unassigned or only the string be assigned or just the int and double e.t.&lt;br /&gt;
&lt;br /&gt;
You can tell which variable type of a var object are set based on the var&#039;s flag value.&lt;br /&gt;
&lt;br /&gt;
1 = Means the string is assigned&lt;br /&gt;
2 = Means the int is assigned&lt;br /&gt;
4 = Means the double is assigned&lt;br /&gt;
&lt;br /&gt;
Example: If the flag is 7 (1+2+4), then all types are assigned.&lt;br /&gt;
&lt;br /&gt;
===Process Hung or consuming 100%+ CPU===&lt;br /&gt;
If process is consuming 100%+ CPU then it is likely stuck in an infinite loop.&lt;br /&gt;
&lt;br /&gt;
 ./doall &amp;lt;CLIENT&amp;gt; stop&lt;br /&gt;
&lt;br /&gt;
 ./run &amp;lt;CLIENT&amp;gt; &lt;br /&gt;
&lt;br /&gt;
 ./test &amp;lt;CLIENT&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Search through recent logs for &amp;lt;CLIENT&amp;gt; looking for requests that didn&#039;t return OK at the time nagios alerted of Hung process.&lt;br /&gt;
A user may also instigate the error again, so monitor the CLIENT&#039;s service CPU usage.&lt;br /&gt;
&lt;br /&gt;
If cause found recreate it in test and once test process hit 100%+ break in test debugger.&lt;br /&gt;
If cause not found, you will have to continue checking logs for the request that caused it or hope a user recreates the issue in live debugged service.&lt;br /&gt;
&lt;br /&gt;
Once you&#039;ve broken in the debugged with the error, enter &amp;quot;n&amp;quot; and hold the enter key until you just seeing line repeat.&lt;br /&gt;
Pay attention to start of loops code. E.g WHILE or FOR. (there is likely an error is there)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
#&lt;br /&gt;
&lt;br /&gt;
==./doall==&lt;br /&gt;
====General====&lt;br /&gt;
Screen 6: ./doall script contains all the necessary information(codes) to setup an installation.&lt;br /&gt;
It includes scripts to backup, restore, create an Apache site, create/start/stop/status a service, import an AREV database into postgres and more.&lt;br /&gt;
&lt;br /&gt;
====backup_db====&lt;br /&gt;
&lt;br /&gt;
*Does a backup &amp;amp; restore of a LIVE database into the corresponding TEST database.&lt;br /&gt;
*Backup &amp;lt;dbcode&amp;gt;.sql file is written to /root/backups/sql; which is rsynced to nl19:/backups/current/exodus/&lt;br /&gt;
*Unlike AREV, postgres can perform a &amp;quot;backup&amp;quot; of a database whilst the system is in use.&lt;br /&gt;
&lt;br /&gt;
==Git==&lt;br /&gt;
&lt;br /&gt;
There are two repositories, one for EXODUS and the other for NEOSYS.&lt;br /&gt;
&lt;br /&gt;
===Using git to make changes===&lt;br /&gt;
&lt;br /&gt;
Before following steps you must have a tested updated to a program/file/script. Do not commit untested changes to avoid a messy git history of reverts.&lt;br /&gt;
&lt;br /&gt;
Update your local repo before committing to local repo using the g alias for &amp;quot;git pull --ff-only ; git push &amp;amp;&amp;amp; git status&#039;&amp;quot;:&lt;br /&gt;
&amp;lt;pre&amp;gt;g&amp;lt;/pre&amp;gt;&lt;br /&gt;
Check which updates/files have not yet been staged and/or committed:&lt;br /&gt;
Add your updates to the staged area:&lt;br /&gt;
&amp;lt;pre&amp;gt;git add &amp;lt;filename&amp;gt;&amp;lt;/pre&amp;gt;&lt;br /&gt;
or if all the changes made need to be staged:&lt;br /&gt;
&amp;lt;pre&amp;gt;git add -a&amp;lt;/pre&amp;gt;&lt;br /&gt;
Make a commit with a descriptive message on purpose of updates:&lt;br /&gt;
&amp;lt;pre&amp;gt;git commit -m &amp;lt;description n purpose of changes&amp;gt;&amp;lt;/pre&amp;gt;&lt;br /&gt;
Again use g alias:&lt;br /&gt;
&amp;lt;pre&amp;gt;g&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Other useful git cmds===&lt;br /&gt;
&lt;br /&gt;
Do not use this commands unless you know what WILL happen. &lt;br /&gt;
*git pull - Instead use the safe &amp;quot;git pull --ff-only&amp;quot;&lt;br /&gt;
Stick to the alias &amp;quot;g&amp;quot; which does &amp;quot;git pull --ff-only ; git push &amp;amp;&amp;amp; git status&#039;&amp;quot;&lt;br /&gt;
&lt;br /&gt;
*git log - display history of commits to master branch&lt;br /&gt;
*git diff - display the differences in files between working files and files in local repo.&lt;br /&gt;
*git status - display: which updated files are staged/not staged(tracked)&lt;br /&gt;
*git stash - &lt;br /&gt;
*git branch - switch to a new branch&lt;br /&gt;
*git branch &amp;lt;branchname&amp;gt; - will switch to this branch only if it exists&lt;br /&gt;
*git checkout - DESTROYS/Updates the state of local working directory with the state of the files in the local repo. (YOU WILL LOSE non staged updates)&lt;br /&gt;
*git restore &amp;lt;filename&amp;gt; - DESTROYS/Updates the file with the version in the local repo. (like with git checkout but for a specific file)&lt;br /&gt;
*git checkin - &lt;br /&gt;
*git revert &amp;lt;commitHash&amp;gt; - reverses a specific commit (use git log to get the chosen commit hash)&lt;br /&gt;
*git ..&lt;br /&gt;
&lt;br /&gt;
==Converting AREV programs to EXODUS==&lt;br /&gt;
===Decompile AREV to C++===&lt;br /&gt;
&lt;br /&gt;
Do in Master AREV Installation Maintenance mode: (win7)&lt;br /&gt;
&lt;br /&gt;
#ATTACH ADECOMC &lt;br /&gt;
#*ADECOM &amp;lt;programname&amp;gt;   *single program&lt;br /&gt;
#*ADECOM &amp;lt;prog1&amp;gt; &amp;lt;prog2&amp;gt; &lt;br /&gt;
#*ADECOMALL              *all programs   (CHECK FIRST)&lt;br /&gt;
&lt;br /&gt;
Include the option &amp;quot;(V)&amp;quot; in the command to print the C++ to a notepad, which can easily be copy and pasted.&lt;br /&gt;
&lt;br /&gt;
===Getting C++ program to Exodus Installation===&lt;br /&gt;
&lt;br /&gt;
Two methods: (use the first for one off programs)&lt;br /&gt;
&lt;br /&gt;
====Copy &amp;amp; Paste====&lt;br /&gt;
&lt;br /&gt;
Compile program and open source code in notepad&lt;br /&gt;
&lt;br /&gt;
 ADECOM &amp;lt;programname&amp;gt; (V)&lt;br /&gt;
&lt;br /&gt;
Find which directory the program belongs. e.g fin/med/job/sys e.t&lt;br /&gt;
&lt;br /&gt;
 find /cygdrive/d/exodus/pickos | grep &amp;lt;program name&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If cpp in SYS, the program belongs in ~/exodus/service/src OR if in MED JOB FIN GEN AGY the program belongs in ~/neosys/src&lt;br /&gt;
&lt;br /&gt;
Copy the source code in the text file from the first command.&lt;br /&gt;
&lt;br /&gt;
In Exodus, create a new .cpp (in correct directory) and paste the source code.&lt;br /&gt;
&lt;br /&gt;
Compile &amp;amp; Test&lt;br /&gt;
&lt;br /&gt;
====Rsync====&lt;br /&gt;
&lt;br /&gt;
 /d/exodus/arev/syncup.sh&lt;br /&gt;
&lt;br /&gt;
If cpp in SYS then: ~/exodus/service/src ./getpickos&lt;br /&gt;
&lt;br /&gt;
If cpp in MED JOB FIN GEN AGY then: *~/neosys/src&lt;br /&gt;
&lt;br /&gt;
===Compile C++ files to TEST system===&lt;br /&gt;
&lt;br /&gt;
#*./test &amp;lt;DBNAME&amp;gt;&lt;br /&gt;
#*~/neosys ./doall TEST &amp;lt;DBNAME&amp;gt; restart    #to get one service to start start using the new lib files&lt;br /&gt;
#*~/neosys ./doall TEST all restart         #to get all the services to start start using the new lib files&lt;br /&gt;
&lt;br /&gt;
===Install C++ files to LIVE System===&lt;br /&gt;
&lt;br /&gt;
#~/exodus/service/ ./copyall            #to copy all the ~/lib and bin files to ~/live/lib and bin ... which is used by all exodus/live services&lt;br /&gt;
&lt;br /&gt;
==Writing Standard Exodus Core Function/Method Testing==&lt;br /&gt;
Screen 9: ~/exodus/test/src/&lt;br /&gt;
There are a series of test programs that check whether methods/functions behave as intended.&lt;br /&gt;
They do this using the function, assert.. a 1 or more argument values produce one and only one output)&lt;br /&gt;
&lt;br /&gt;
e.g test_multilang.cpp or test_sort.cpp&lt;br /&gt;
&lt;br /&gt;
Two methods of running test programs:&lt;br /&gt;
*Screen 9: make test&lt;br /&gt;
*after compiling using edic/compile/c, enter test_prog_name. (Since compile has moved it to ~/bin)&lt;br /&gt;
&lt;br /&gt;
Difference between the two methods is make calls gdb directly;&lt;br /&gt;
whereas ~/bin/test_prog_name uses exodus compile program&lt;br /&gt;
#~/neosys ./doall LIVE all restart&lt;br /&gt;
&lt;br /&gt;
==Updating a pgsql function in an exodus dictionary==&lt;br /&gt;
&lt;br /&gt;
PENDING&lt;br /&gt;
&lt;br /&gt;
==Development and deployment using &#039;dat&#039; files==&lt;br /&gt;
&lt;br /&gt;
===Rationale===&lt;br /&gt;
&lt;br /&gt;
Part of system development is the creation of various data that is neither programs nor layout i.e. not cpp, h, html, js, php files etc.&lt;br /&gt;
&lt;br /&gt;
For example:&lt;br /&gt;
&lt;br /&gt;
*Dictionaries are data about data.&lt;br /&gt;
*Language files are data about text to use for various languages.&lt;br /&gt;
*“Change logs” are data about changes in the system.&lt;br /&gt;
&lt;br /&gt;
Historically, in EXODUS and NEOSYS, the above data has been deployed in exodus database files using SQL text files. However SQL files are not convenient for development.&lt;br /&gt;
&lt;br /&gt;
Therefore, &#039;dat&#039; text files will be used now so that standard development tools including editors and git can be fully exploited.&lt;br /&gt;
&lt;br /&gt;
===&#039;dat&#039; files===&lt;br /&gt;
&lt;br /&gt;
Each database file is represented by an os directory of the same name.&lt;br /&gt;
&lt;br /&gt;
Each record in the database file is represented by an os text file where filename is the primary key.&lt;br /&gt;
&lt;br /&gt;
For example a record with key &#039;&#039;&#039;DEADLINE&#039;&#039;&#039; in a dat file &#039;&#039;&#039;dict.materials&#039;&#039;&#039; would be represented as an os text file &#039;&#039;&#039;dat/dict.materials/DEADLINE&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Each line in the os text file represents one field in the db record. In other words, db record FM characters are represented by new line characters in &#039;dat&#039; files. Any actual new line characters required in the record, and any backslashes, are escaped and appear as &#039;\n&#039; and &#039;\\&#039; in &#039;dat&#039; files. Other database field separator characters such as VM, SM, TM and STM are stored without any conversion.&lt;br /&gt;
&lt;br /&gt;
===Location of dat files===&lt;br /&gt;
&lt;br /&gt;
The development versions are stored in exodus and neosys src/dat dirs. They form part of the standard git repositories in parallel with cpp files.&lt;br /&gt;
&lt;br /&gt;
The operational versions are stored in ~/dat and ~/live/dat alongside bin and lib dirs and are automatically installed into databases as database files on service startup. Any database functions embedded in the text files (pgsql) are also automatically installed at the same time.&lt;br /&gt;
&lt;br /&gt;
===Editing and deploying a &#039;dat&#039; file===&lt;br /&gt;
&lt;br /&gt;
It is currently a three step process to edit and deploy such &#039;dat&#039; files. &lt;br /&gt;
&lt;br /&gt;
====Edit the &#039;dat&#039; file====&lt;br /&gt;
&lt;br /&gt;
Note that EXODUS service and NEOSYS service have different src/dat folders.&lt;br /&gt;
&lt;br /&gt;
Editing language items:&lt;br /&gt;
&lt;br /&gt;
 edir dat/alanguage/SCHEDULES*ARABIC&lt;br /&gt;
&lt;br /&gt;
Editing a dictionary item:&lt;br /&gt;
&lt;br /&gt;
 edir dat/dict.materials/DEADLINE&lt;br /&gt;
&lt;br /&gt;
Editing a pgsql function in a dictionary:&lt;br /&gt;
&lt;br /&gt;
 edir dat/dict.materials/DEADLINE 8&lt;br /&gt;
&lt;br /&gt;
====Copy all &#039;dat&#039; files to ~/dat ====&lt;br /&gt;
&lt;br /&gt;
This step might be removed at a later date.&lt;br /&gt;
&lt;br /&gt;
This will cause all test databases to immediately restart and load any &#039;dat&#039; file changes into dictionaries and data files and also create any new or modified pgsql functions.&lt;br /&gt;
&lt;br /&gt;
If any ~/neosys/src/dat files were edited:&lt;br /&gt;
&lt;br /&gt;
 cd ~/neosys/src&lt;br /&gt;
 &lt;br /&gt;
 ./compall dat&lt;br /&gt;
&lt;br /&gt;
and/or, if exodus/service/dat files were edited&lt;br /&gt;
&lt;br /&gt;
 cd ~/exodus/service/src&lt;br /&gt;
 &lt;br /&gt;
 ./compall dat&lt;br /&gt;
&lt;br /&gt;
====Copy all programs and &#039;dat&#039; files to ~/live/bin|lib|dat====&lt;br /&gt;
&lt;br /&gt;
This should only be run after testing. It will cause all live databases to automatically restart and do the same as the test databases mentioned above.&lt;br /&gt;
&lt;br /&gt;
 cd ~/exodus/service&lt;br /&gt;
 &lt;br /&gt;
 ./copyall CONFIRM&lt;br /&gt;
​&lt;br /&gt;
&lt;br /&gt;
==Upgrading Exodus==&lt;br /&gt;
&lt;br /&gt;
#Inform clients.&lt;br /&gt;
#*Client hosted - Schedule a planned upgrade with client.&lt;br /&gt;
#*NEOSYS hosted - Inform all clients/users of planned morning upgrade, 24hours in advanced.      (TODO: &#039;What&#039;s New in NEOSYS&#039;) AND (emailallusers.cpp)&lt;br /&gt;
#If the morning&#039;s USB backup failed, do NOT continue upgrade procedure because if upgrade fails, we need a way to roll back system to last working state.&lt;br /&gt;
#Check upgrade works on test service using:/root/neosys/upgrade.all.sh test&lt;br /&gt;
#Check the latest patch is working.&lt;br /&gt;
#Run/root/neosys/upgrade.all.sh live&lt;br /&gt;
#Inform users their system has been upgraded and they can login.&lt;br /&gt;
&lt;br /&gt;
===Roll Back Upgrade===&lt;br /&gt;
&lt;br /&gt;
If for any reason the entire upgrade needs to be reverted (excludes clients database), follow steps below:&lt;br /&gt;
&lt;br /&gt;
#Inform users that there is a problem and services need to be stopped.&lt;br /&gt;
#Stop all exodus processes.&lt;br /&gt;
#Restore the morning&#039;s USB backup by: (Note this backup contains:  source/obj code, /etc, neosys scripts but not client data)&lt;br /&gt;
##Login into container&#039;s host and rsync the morning&#039;s usb backup to the container&#039;s /:&lt;br /&gt;
#*&amp;lt;pre&amp;gt;rsync --dry-run -avz -e &#039;ssh -p &amp;lt;C_SSHPORT&amp;gt;&#039; /backups/usb/&amp;lt;C_CODE&amp;gt; &amp;lt;C_CODE&amp;gt;:/      (Example: rsync --dry-run -avz -e &#039;ssh -p 19582&#039; /backups/usb/ad1 ad1:/&amp;lt;/pre&amp;gt;)&lt;br /&gt;
#Quick sane check, the latest git commit is not the latest git commit in the remote repo.&lt;br /&gt;
#Inform users they can login.&lt;br /&gt;
&lt;br /&gt;
==Configuring services to autostart during login==&lt;br /&gt;
&lt;br /&gt;
Create a file &#039;autostart.cfg&#039; in the data folder &lt;br /&gt;
&lt;br /&gt;
 touch /root/hosts/&amp;lt;dbname&amp;gt;/data/autostart.cfg&lt;br /&gt;
&lt;br /&gt;
This will autostart a database service as long as at least one database service in that directory is running.&lt;br /&gt;
&lt;br /&gt;
For example, demo service will autostart during login if,&lt;br /&gt;
#/root/hosts/demo/data/autostart.cfg exists and&lt;br /&gt;
#demo_test service is running&lt;/div&gt;</summary>
		<author><name>Gregory</name></author>
	</entry>
</feed>