Browse code

- help and comments updated

Jan Janak authored on 24/06/2008 14:00:20
Showing 1 changed files
... ...
@@ -2,7 +2,7 @@
2 2
 #
3 3
 # $Id$
4 4
 #
5
-# Script for adding and dropping ser MySQL tables
5
+# SER MySQL Database Administration Tool
6 6
 #
7 7
 # Copyright (C) 2006 iptelorg GmbH
8 8
 #
... ...
@@ -21,6 +21,10 @@ DEFAULT_RWPASS="heslo"       # Default password of read-write user
21 21
 DEFAULT_MYSQL="mysql"
22 22
 DEFAULT_MYSQLDUMP="mysqldump"
23 23
 
24
+# The default directory which contains SQL scripts. If empty then the
25
+# directory which contains this shell script will be used. If relative then
26
+# the pathname will be made absolute with respect to the location of this
27
+# shell script.
24 28
 DEFAULT_SCRIPT_DIR=""
25 29
 
26 30
 DEFAULT_CREATE_SCRIPT="my_create.sql"
... ...
@@ -33,7 +37,7 @@ DEFAULT_DUMP_OPTS="-c -a -e --add-locks --all"
33 37
 usage() {
34 38
 cat <<EOF
35 39
 NAME
36
-  $COMMAND - SER MySQL database administration tool
40
+  $COMMAND - SER MySQL Database Administration Tool
37 41
 
38 42
 SYNOPSIS
39 43
   $COMMAND [options] create
... ...
@@ -42,65 +46,63 @@ SYNOPSIS
42 46
   $COMMAND [options] restore [filename]
43 47
   $COMMAND [options] update-data
44 48
 
45
-DESCRIPTION
46
-  This tool is a simple shell wrapper over mysql client utility that can
47
-  be used to create, drop, or backup SER database stored on a MySQL server.
48
-  See section COMMANDS for brief overview of supported actions.
49
+DESCRIPTION 
50
+  This tool is a simple shell wrapper over mysql client utility that can be
51
+  used to create, drop, or backup SER database stored on a MySQL server.  See
52
+  section COMMANDS for brief overview of supported actions.
49 53
 
50 54
   The SQL definition of tables within SER database is stored in a separate
51
-  file which can be usualy found in /usr/lib/ser/my_create.sql (depending
52
-  on installation). You can use that file to create SER database manually
53
-  if you cannot or do not want to use this shell wrapper.
55
+  files which can be usualy found under /usr/share/ser (depending on the
56
+  installation). You can use those file to create the SER database manually if
57
+  you cannot or do not want to use this shell wrapper.
54 58
 
55
-  This tool requires mysql client utility to create or drop SER database.
56
-  Furthemore backup and restore commands require mysqldump. Both tools
57
-  can be found in mysql-client package.
59
+  This tool requires mysql client utility to create or drop the SER database.
60
+  Additionally backup and restore commands require mysqldump. Both tools can
61
+  be found in mysql-client package.
58 62
 
59 63
 COMMANDS
60 64
   create
61
-    Create a new SER database from scratch. The database must not exist.
62
-    This command creates the database, the default name of the database
63
-    is '${DEFAULT_DBNAME}' (the default name can be changed using a command line
65
+    Create a new SER database from scratch. The database must not exist.  This
66
+    command creates the database, the default name of the database is
67
+    '${DEFAULT_DBNAME}' (the default name can be changed using a command line
64 68
     parameter, see below). Furthemore the script will load table definition
65 69
     from the external SQL file and create users with access to the newly
66
-    created database. You can use command line options to change the
67
-    default database name, usernames and passwords. Note that you need to
68
-    change SER and SERWeb configuration if you change database name or
69
-    usernames because SER and SERWeb are pre-configured to use the default
70
-    names.
71
-
72
-  drop
73
-    This command can be used to delete SER database and corresponding
74
-    database users. WARNING: This command will delete all data in the
75
-    database and this action cannot be undone afterwards. Make sure that
76
-    you have backups if you want to keep the data from the database.
77
-    The command also deletes the database users by default. You can change
78
-    that behavior using -k command line options, see below.
70
+    created database. You can use command line options to change the default
71
+    database name, usernames and passwords. Note that you need to change SER
72
+    and SERWeb configuration if you change database name or usernames because
73
+    SER and SERWeb are pre-configured to use the default names.
74
+
75
+  drop 
76
+    This command can be used to delete SER database and corresponding database
77
+    users. WARNING: This command will delete all data in the database and this
78
+    action cannot be undone! Make sure that you have backups if you want to
79
+    keep the data from the database.  The command also deletes the database
80
+    users by default. You can change that behavior using -k command line
81
+    options, see below.
79 82
 
80 83
   backup <filename>
81 84
     Backup the contents of SER database. If you specify a filename then the
82 85
     contents of the database will be saved in that file, otherwise the tool
83
-    will dumps the contents on the standard output. By default the backup
84
-    SQL data contains CREATE TABLE statements that will drop and recreate
85
-    database tables being loaded. This ensures that the tables are empty
86
-    and have correct structure. You can change this behavior using -t command 
87
-    line option.
86
+    will dumps the contents on the standard output. By default the backup SQL
87
+    data contains CREATE TABLE statements that will drop and recreate database
88
+    tables being loaded. This ensures that the tables are empty and have
89
+    correct structure. You can change this behavior using -t command line
90
+    option.
88 91
 
89 92
   restore <filename>
90
-    Load the contents of SER database from a file (if you specify one) or
91
-    from the standard input. Make sure that the database exists before you
92
-    load the data. Make sure that the database is empty if you have backups 
93
-    without create table statements (i.e. created with -t command line option) 
94
-    and that the tables are empty.
95
-
96
-  update-data
97
-    Update initial data in database. This command delete vendor-controled
98
-    rows from databaze and replace them with new ones.
99
-    
100
-    
101
-OPTIONS
102
-  -h, --help
103
-      Display this help text.
93
+    Load the contents of SER database from a file (if you specify one) or from
94
+    the standard input. Make sure that the database exists before you load the
95
+    data. Make sure that the database is empty if you have backups without
96
+    create table statements (i.e. created with -t command line option) and
97
+    that the tables are empty.
98
+
99
+  update-data 
100
+    Update initial data in the database. This command deletes vendor-controled
101
+    rows from database and replaces them with new ones.
102
+
103
+OPTIONS 
104
+  -h, --help Display
105
+    this help text.
104 106
 
105 107
   -n NAME, --name=NAME
106 108
       Database name of SER database.
... ...
@@ -141,19 +143,18 @@ OPTIONS
141 143
       (No default value)
142 144
 
143 145
   -d DIRECTORY, --script-dir=DIRECTORY
144
-      Directory containing the SQL scripts with database schema and
145
-      initial data definition.
146
+      Directory containing the SQL scripts with database schema and initial
147
+      data definition.
146 148
       (Default value is '$DEFAULT_SCRIPT_DIR')
147 149
 
148 150
   -k, --keep-users
149
-      Do not delete database users when removing the database. This
150
-      is useful if you have multiple databases and use the same users
151
-      to access them.
151
+      Do not delete database users when removing the database. This is useful
152
+      if you have multiple databases and use the same users to access them.
152 153
 
153 154
   -v, --verbose
154
-      Enable verbose mode. This option can be given multiple times
155
-      to produce more and more output.
156
-        
155
+      Enable verbose mode. This option can be given multiple times to produce
156
+      more and more output.
157
+
157 158
 ENVIRONMENT VARIABLES
158 159
   MYSQL     Path to mysql command (Currently ${MYSQL})
159 160
   MYSQLDUMP Path to mysqldump command (Currently ${MYSQLDUMP})
... ...
@@ -163,9 +164,9 @@ AUTHOR
163 164
 
164 165
 COPYRIGHT
165 166
   Copyright (C) 2006-2008 iptelorg GmbH
166
-  This is free software. You may redistribute copies of it under the
167
-  termp of the GNU General Public License. There is NO WARRANTY, to the
168
-  extent permitted by law.
167
+  This is free software. You may redistribute copies of it under the termp of
168
+  the GNU General Public License. There is NO WARRANTY, to the extent
169
+  permitted by law.
169 170
 
170 171
 FILES
171 172
   ${SCRIPT_DIR}/${CREATE_SCRIPT}
... ...
@@ -215,9 +216,7 @@ abs_script_dir()
215 216
 }
216 217
 
217 218
 
218
-#
219 219
 # Execute an SQL command
220
-#
221 220
 sql_query()
222 221
 {
223 222
 	if [ $# -gt 1 ] ; then