Changes

From SME Server
Jump to navigationJump to search
683 bytes added ,  20:00, 4 November 2014
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. 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.
Line 34: Line 34:  
  /home/e-smith/db
 
  /home/e-smith/db
   −
Here are a few examples to demonstrate useage and syntax correlation
+
Here are a few examples to demonstrate usage and syntax correlation
 
  db dbname show
 
  db dbname show
 +
 
Using real db names - for the database in /home/e-smith/db/configuration
 
Using real db names - for the database in /home/e-smith/db/configuration
 
  db configuration show
 
  db configuration show
 
  db configuration show |more
 
  db configuration show |more
 
  db configuration keys
 
  db configuration keys
  db configuration show dansguardian
+
 
An example for an installed contrib
+
* An example for the imap service
  db configuration getprop dansguardian status
+
  [root@sme8dev64 ~]# db configuration show imap
 +
 
 +
imap=service
 +
    ConcurrencyLimit=400
 +
    ConcurrencyLimitPerIP=12
 +
    TCPPort=143
 +
    access=private
 +
    status=enabled
 +
 
 +
  [root@sme8dev64 ~]# db configuration getprop imap status
 
which gives something like
 
which gives something like
 
  enabled
 
  enabled
   −
  db configuration getprop dansguardian portblocking
+
  [root@sme8dev64 ~]# db configuration getprop dansguardian ConcurrencyLimitPerIP
 
which gives something like
 
which gives something like
  yes
+
  12
 +
 
 +
You could also do
 +
[root@sme8dev64 ~]# config show dansguardian
 +
 
 +
imap=service
 +
    ConcurrencyLimit=400
 +
    ConcurrencyLimitPerIP=12
 +
    TCPPort=143
 +
    access=private
 +
    status=enabled
 +
 
    
Compare the above displayed actual element values of the db command with the syntax result from issuing the db command where each element or piece equates to:
 
Compare the above displayed actual element values of the db command with the syntax result from issuing the db command where each element or piece equates to:
    
db = command
 
db = command
 
+
configuration = '''database name'''
configuration = database name
  −
 
   
show = part of a command
 
show = part of a command
 
+
keys = part of a command
keys = party of a command
+
imap = '''key'''
 
+
status = '''property'''
dansguardian = key
+
enabled = '''value'''
 
+
ConcurrencyLimitPerIP = '''property'''
status = property
+
12 = '''value'''
 
  −
enabled = value
  −
 
  −
portblocking = property
  −
 
  −
yes = value
      
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 79: Line 92:  
and subfolders and template fragments applicable to particular /etc/file.conf configuration files.
 
and subfolders and template fragments applicable to particular /etc/file.conf configuration files.
    +
===show all available database===
 
To show a list of existing databases do
 
To show a list of existing databases do
 
  cd /home/e-smith/db
 
  cd /home/e-smith/db
 
  ls -al
 
  ls -al
which gives something like
     −
-rw-r-----  1 root  admin 14676 Aug 25 22:38 accounts
+
which gives something like for offical databases
-rw-r----- 1 root admin  994 Sep 22 05:32 affa
+
 
  drwx------  2 root  root  4096 Sep 22 05:32 affa-report
+
total 304
-rw-r--r-- 1 root  root  15310 Sep 22 05:32 affa-rpmlist
+
-rw-r----- 1 root admin  1921 f�vr. 18 2014 accounts
-rw-r-----  1 root admin  2532 Jul 7 15:42 backup2ws
+
-rw-r--r-- 1 root admin     0 f�vr. 2 2013 backups
-rw-r----- 1 root admin 1496 Feb 4 2009 backups
+
-rw-r----- 1 root admin   8816 nov. 4 19:38 configuration
-rw-r-----  1 root  admin 10040 Sep 15 02:01 configuration
+
-rw-r----- 1 root admin   361 f�vr. 2 2013 domains
-rw-r----- 1 root admin   531 Feb 3 2009 dar2
+
-rw-r----- 1 root admin   816 f�vr. 7 2013 hosts
-rw-r----- 1 root admin   816 Jun 3 22:11 domains
+
drwxr-x--- 2 root ldap    4096 f�vr. 22 2013 ldap
-rw-r-----  1 root  admin 4391 Sep 11 18:03 hosts
+
-rw-r----- 1 root admin   3098 f�vr. 2 2013 mailpatterns
drwxr-xr-2 root root  4096 Aug 25 22:48 ldap
+
drwxr-x--- 2 root root   4096 avril 27  2014 mysql
-rw-r----- 1 root admin  3074 Nov 15 2008 mailpatterns
+
drwxr-xr-x 2 root root   4096 nov.  3 21:42 navigation
drwxr-x--- 2 root root   4096 May 29 22:11 mysql
+
-rw-r----- 1 root admin    299 f�vr. 2 2013 networks
drwxr-xr-x 2 root root   4096 Aug 25 22:49 navigation
+
-rw-r----- 1 root admin     0 mars 11 2010 portforward_tcp
-rw-r----- 1 root  admin  298 Nov 15 2008 networks
+
-rw-r----- 1 root admin     0 mars 11 2010 portforward_udp
-rw-r--r--  1 root  root      0 Sep 23  2008 open_ro
+
-rw-r----- 1 root admin    271 f�vr. 2 2013 spamassassin
-rw-r----- 1 root admin     0 Oct  8 2008 portforward_tcp
+
-rw-r--r-- 1 root root  201371 nov. 4 04:04 yum_available
-rw-r----- 1 root admin     0 Oct  8 2008 portforward_udp
+
-rw-r--r-- 1 root root  37419 nov. 4 04:04 yum_installed
-rw-r--r--  1 root  root    20 Jul 22  2007 proxyusers
+
-rw-r----- 1 root admin   4459 f�vr. 18 2014 yum_repositories
-rw-r----- 1 root  admin 1489 Jun 24 13:26 spamassassin
+
-rw-r--r-- 1 root root     70 nov.  4 04:04 yum_updates
-rw-r----1 root admin  559 Sep 18 14:45 wbl
+
 
drwxr-xr-x  2 root  root   4096 Sep 7 11:26 webshare
  −
  -rw-r-----  1 root  admin  1179 Sep  7 11:30 WebShare
  −
-rw-r--r--  1 root  root    70 Sep 22 04:02 yum_available
  −
-rw-r--r-- 1 root  root    70 Sep 22 04:02 yum_installed
  −
-rw-r----- 1 root admin  4351 Sep 21 20:17 yum_repositories
  −
-rw-r--r-- 1 root root     70 Sep 22 04:02 yum_updates
      
To show the keys for the two main databases do:
 
To show the keys for the two main databases do:
Line 120: Line 127:  
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 |more switch, press Enter to scroll down a line at a time, or press Space to scroll down a page at a time
    +
===Create a db key===
 +
the generic command is :
 +
/sbin/e-smith/db dbfile set key type [prop1 val1] [prop2 val2] ...
 +
 +
dbfile : choose the database in /home/e-smith/db
 +
key : the name of key
 +
type : generally 'service' or configuration but it can be other things as webbapps or url or ...
 +
 +
If you want to create a keys called 'plop' in the configuration database with a type as 'configuration you can do like this
 +
 +
db configuration set plop configuration Name wordpress PublicAccess private status enabled DbName wordpress DbUser wordpress WpLang en
 +
 +
you can see the result
 +
 +
config show plop
 +
or
 +
db configuration show
 +
  plop=configuration
 +
    DbName=wordpress
 +
    DbUser=wordpress
 +
    Name=wordpress
 +
    PublicAccess=private
 +
    WpLang=en
 +
    status=enabled
    
===References===
 
===References===

Navigation menu