Changes

Jump to navigation Jump to search
1,782 bytes added ,  19:31, 5 March 2022
Line 1: Line 1:  
==db command tutorial==
 
==db command tutorial==
   −
The db command is unique to sme server. It is used to add settings to the various configuration databases which are then incorporated into the standard configuration files in /etc/.... via the template expansion process.
+
The '''db''' command is unique to SME Server, and is the command line user interface to the '''db system'''. It is used to manipulate configuration setting of the various configuration databases which are then incorporated into the standard configuration files in /etc/.... via the template expansion process.
   −
To display the syntax, at a command prompt type
+
The '''db system''' comes with default values that can be manipulated by either manually through the CLI or fully automatic through the Server Manager. This tutorial explains manipulating the '''db system''' manually through the CLI.
  db
+
 
then press Enter, which displays the usage:
+
 
 +
To display the syntax issue the following command:
 +
  /sbin/e-smith/db
 +
which will result in the db help output below, for we did not pass any parameters.
 
  /sbin/e-smith/db dbfile keys
 
  /sbin/e-smith/db dbfile keys
 
  /sbin/e-smith/db dbfile print [key]
 
  /sbin/e-smith/db dbfile print [key]
Line 21: Line 24:  
  /sbin/e-smith/db dbfile delprop key prop1 [prop2] [prop3] ...
 
  /sbin/e-smith/db dbfile delprop key prop1 [prop2] [prop3] ...
   −
{{Note box|Note that on a properly setup SME Server (path wise) you do not need to include the
+
{{Note box|Note that on a properly setup SME Server (path wise) '''you do not need''' to include the
/sbin/e-smith/ part, only use db since you are in the Path of your environment}}
+
/sbin/e-smith/ part, '''only use db or config''' since you are in the Path of your environment}}
    
===Only for the configuration database===
 
===Only for the configuration database===
Line 31: Line 34:     
Note this only applies to this one often used database file, all others must be referred to using the format
 
Note this only applies to this one often used database file, all others must be referred to using the format
  db dbname xxxx yyyy zzzz
+
  db dbname command key [property value] [property2 value2]
    
All database files are in
 
All database files are in
Line 82: Line 85:       −
imap = '''key'''
+
{| class="wikitable"
ConcurrencyLimit = '''property'''
+
|-
400 = '''value'''
+
! Database name !! Unique key !! Property name !! Default value || Possible values || Description
ConcurrencyLimitPerIP = '''property'''
+
|-
12 = '''value'''
+
| configuration ||style="text-align:center;"| imap || ||style="text-align:center;"|'''service'''|| || Unique key name
TCPPort = '''property'''
+
|-
143 = '''property'''
+
| || || Concurrenstyle || style="text-align:center;"|'''400''' || style="text-align:center;"|nnn || User defined value
access = '''property'''
+
|-
private = '''value'''
+
| || || ConcurrencyLimitPerIP || style="text-align:center;"|'''12''' || style="text-align:center;"|nn || User defined value
status = '''property'''
+
|-
enabled = '''value'''
+
| || || TCPPort || style="text-align:center;"|'''143''' || style="text-align:center;"|nnn || TCP port or port range [nnn] or [nnn-nnn]
 +
|-
 +
| || || access || style="text-align:center;"|'''private''' || style="text-align:center;"|private / public || Specify LAN only or LAN and WAN access.<br> The firewall will be adjusted accordingly
 +
|-
 +
| || || status || style="text-align:center;"|'''enabled''' || style="text-align:center;"|enabled / disabled || Enable or disable this service.<br> The firewall will be adjusted accordingly
 +
|}
 +
 
    
Apply the above "reasoning" to any database and the the syntax presented by issuing db then makes sense.
 
Apply the above "reasoning" to any database and the the syntax presented by issuing db then makes sense.
Line 105: Line 114:  
===show all available databases===
 
===show all available databases===
 
To show a list of existing databases do
 
To show a list of existing databases do
  cd /home/e-smith/db
+
  ls -al /home/e-smith/db
ls -al
      
which gives something like for official databases
 
which gives something like for official databases
    
  total 304
 
  total 304
  -rw-r----- 1 root admin  1921 f�vr. 18  2014 accounts
+
  -rw-r----- 1 root admin  1921 févr. 18  2014 accounts
  -rw-r--r-- 1 root admin      0 f�vr.  2  2013 backups
+
  -rw-r--r-- 1 root admin      0 févr.  2  2013 backups
 
  -rw-r----- 1 root admin  8816 nov.  4 19:38 configuration
 
  -rw-r----- 1 root admin  8816 nov.  4 19:38 configuration
  -rw-r----- 1 root admin    361 f�vr.  2  2013 domains
+
  -rw-r----- 1 root admin    361 févr.  2  2013 domains
  -rw-r----- 1 root admin    816 f�vr.  7  2013 hosts
+
  -rw-r----- 1 root admin    816 févr.  7  2013 hosts
  drwxr-x--- 2 root ldap    4096 f�vr. 22  2013 ldap
+
  drwxr-x--- 2 root ldap    4096 févr. 22  2013 ldap
  -rw-r----- 1 root admin  3098 f�vr.  2  2013 mailpatterns
+
  -rw-r----- 1 root admin  3098 févr.  2  2013 mailpatterns
 
  drwxr-x--- 2 root root    4096 avril 27  2014 mysql
 
  drwxr-x--- 2 root root    4096 avril 27  2014 mysql
 
  drwxr-xr-x 2 root root    4096 nov.  3 21:42 navigation
 
  drwxr-xr-x 2 root root    4096 nov.  3 21:42 navigation
  -rw-r----- 1 root admin    299 f�vr.  2  2013 networks
+
  -rw-r----- 1 root admin    299 févr.  2  2013 networks
 
  -rw-r----- 1 root admin      0 mars 11  2010 portforward_tcp
 
  -rw-r----- 1 root admin      0 mars 11  2010 portforward_tcp
 
  -rw-r----- 1 root admin      0 mars 11  2010 portforward_udp
 
  -rw-r----- 1 root admin      0 mars 11  2010 portforward_udp
  -rw-r----- 1 root admin    271 f�vr.  2  2013 spamassassin
+
  -rw-r----- 1 root admin    271 févr.  2  2013 spamassassin
 
  -rw-r--r-- 1 root root  201371 nov.  4 04:04 yum_available
 
  -rw-r--r-- 1 root root  201371 nov.  4 04:04 yum_available
 
  -rw-r--r-- 1 root root  37419 nov.  4 04:04 yum_installed
 
  -rw-r--r-- 1 root root  37419 nov.  4 04:04 yum_installed
  -rw-r----- 1 root admin  4459 f�vr. 18  2014 yum_repositories
+
  -rw-r----- 1 root admin  4459 févr. 18  2014 yum_repositories
 
  -rw-r--r-- 1 root root      70 nov.  4 04:04 yum_updates
 
  -rw-r--r-- 1 root root      70 nov.  4 04:04 yum_updates
       
To show the keys for the two main databases do:
 
To show the keys for the two main databases do:
  db configuration keys |more
+
  db configuration show |less
 
That can be abbreviated to
 
That can be abbreviated to
  config keys |more
+
  config show |less
   −
  db accounts keys |more
+
  db accounts show |less
Note after using the |more switch, press Enter to scroll down a line at a time, or press Space to scroll down a page at a time
+
Note after using the |less switch, press Enter to scroll down a line at a time, or press Space to scroll down a page at a time. 'q' to quit.
    
===Usage===
 
===Usage===
 +
{{Note box| Use of 'config' is a shorthand version for 'db configuration' and therefore only works with the configuration database}}
 
====Create a  key in a database====
 
====Create a  key in a database====
 
the generic command is :
 
the generic command is :
Line 155: Line 164:  
  config show plop
 
  config show plop
 
or  
 
or  
  db configuration show
+
  db configuration show plop
 +
 
 
   plop=configuration
 
   plop=configuration
 
     DbName=wordpress
 
     DbName=wordpress
Line 201: Line 211:  
  db configuration show plop
 
  db configuration show plop
 
or
 
or
  config show plop  
+
  config show plop
 +
 
 
  plop=configuration
 
  plop=configuration
 
     DbName=wordpress
 
     DbName=wordpress
Line 225: Line 236:  
  /etc/e-smith/events/actions/initialize-default-databases
 
  /etc/e-smith/events/actions/initialize-default-databases
   −
=== Delete a property value ===
+
==== Delete a property value ====
 
To delete the property
 
To delete the property
 
  db dbfile delprop <key> <prop>
 
  db dbfile delprop <key> <prop>
Line 233: Line 244:  
  config delprop plop WpLang
 
  config delprop plop WpLang
   −
=== Reset a property value ===
+
==== Delete a Key ====
 +
To delete the Key
 +
db dbfile delete <key>
 +
for example
 +
db configuration delete plop
 +
or
 +
config delete plop
 +
 
 +
==== Reset a property to an empty value ====
 
To reset to an empty value
 
To reset to an empty value
 
  db dbfile setprop <key> <prop> <nowiki>''</nowiki>
 
  db dbfile setprop <key> <prop> <nowiki>''</nowiki>
Line 241: Line 260:  
or
 
or
 
  config setprop plop WpLang <nowiki>''</nowiki>
 
  config setprop plop WpLang <nowiki>''</nowiki>
 +
 +
====Check if a key is used====
 +
To check if a key is used, grep templates
 +
 +
Eg :
 +
 +
grep -irn grapCutof /etc/e-smith/templates
 +
 +
 +
grep -rn AutoBlock /etc/e-smith/templates
 +
 +
{{Note box|: via CLI so it is easy to make mistakes.
 +
 +
Hence it is safer to user server manager when there is an entry to configure key.}}
 +
    
{{Warning box|Database parameters are case sensitive so take great care when typing at the server shell because no error messages are given should you make a mistake.}}
 
{{Warning box|Database parameters are case sensitive so take great care when typing at the server shell because no error messages are given should you make a mistake.}}
Line 255: Line 289:  
This one is useful when you don't want to restart your server, a lot of event are called with this command line but The console-save event is not a "reconfigure everything" event, and only changes items which can be configured from the text-mode console. It is convenient in this case as it performs database initialization and migration.  
 
This one is useful when you don't want to restart your server, a lot of event are called with this command line but The console-save event is not a "reconfigure everything" event, and only changes items which can be configured from the text-mode console. It is convenient in this case as it performs database initialization and migration.  
   −
all specific event can be found  at [[DB_Variables_Configuration]] and in the [[SME_Server:Documentation:Developers_Manual#Signalling_events|developer manual]] with more informations
+
all specific events can be found  at [[DB_Variables_Configuration]] and in the [[SME_Server:Documentation:Developers_Manual#Signalling_events|developer manual]] with more informations
    
===References===
 
===References===
3,054

edits

Navigation menu