-
Notifications
You must be signed in to change notification settings - Fork 0
/
admin-commands.txt
265 lines (152 loc) · 8.06 KB
/
admin-commands.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
MYSQL ADMINISTRATION COMMANDS
------------------------------
First of all, you need to edit your manager.conf to provide a valid administrator
credentials to be able to create and delete users and/or change their passwords.
1) Create a MySQL user
Syntax: MYSQL CREATE USER $username PASSWORD $base64_password FOR [hostname|*]
Example: MYSQL CREATE USER srvmgrtest PASSWORD dGVzdA== FOR localhost
This will create the srvmgrtest user for localhost connection with
password set to 'test' (dGVzdA== is base64 form of 'test' string)
and then it will flush the privileges. The optional asterisk sign
(*) can be used for access of all hosts to this one but this applied
only when using TCP/IP connection since for UNIX socket connection
type it's not being used.
2) Create a MySQL database for user
Syntax: MYSQL CREATE DATABASE $db_name FOR $user ON $host
Example: MYSQL CREATE DATABASE srvmgrtest_db1 FOR srvmgrtest ON localhost
This will create the srvmsgtest_db1 database for user srvmgrtest on
the localhost machine.
3) Delete a MySQL user
Syntax: MYSQL DELETE USER $username FOR [hostname|*]
Example: MYSQL DELETE USER srvmgrtest FOR *
This command will delete all users named 'srvmgrtest' on the host
machine.
4) Drop a MySQL database
Syntax: MYSQL DELETE DATABASE $db_name
Example: MYSQL DELETE DATABASE srvmgrtest
This command will delete (drop) the srvmgrtest database from the
MySQL server.
5) Limit queries/updates/connections for user or user connections per user
Syntax: MYSQL LIMIT [QUERIES-PER-HOUR|UPDATES-PER-HOUR|CONNECTIONS-PER-HOUR|USER-CONNECTIONS]
TO $count FOR $user ON $hostname [DATABASE $database TABLE $tab]
Example: MYSQL LIMIT QUERIES-PER-HOUR TO 100 FOR srvmgrtest ON localhost
This command will limit the number of queries, updates or connections per hour on $count
for $user on $hostname or user connections per username to $count. You can optionally
provide database name and table name to apply this limit to.
This example will call "GRANT USAGE ON *.* TO 'srvmgrtest'@'localhost' WITH MAX_QUERIES_PER_HOUR 100;"
described in manual [http://dev.mysql.com/doc/refman/5.1/en/grant.html].
CRON COMMANDS
-------------
1) Create a cron table entry
Syntax: CRON ADD $username "Min Hour Day Month DOW /path/to/command"
Example: CRON ADD root "5 * * * * /root/send-report.sh"
This example will run /root/send-report.sh every 5th minute of the hour.
2) Delete a cron table entry
Syntax: CRON DELETE $username "Min Hour Day Month DOW /path/to/command"
Syntax: CRON REMOVE $username "Min Hour Day Month DOW /path/to/command"
Example: CRON DELETE root "5 * * * * /root/send-report.sh"
This example will remove the /root/send-report.sh entry as added by previous command (CRON ADD).
Since there could be multiple occurrences of the same command you need to specify the time definition
as well.
3) Truncate (delete all) cron table
Syntax: CRON TRUNCATE $username
Example: CRON TRUNCATE root
This command will remove all the entries from the CRON table of root user on the system.
4) List table
Syntax: CRON LIST $username $filename_to_store_to
Example: CRON LIST root /tmp/cron-root.tmp
This command will dump the cron table for root user into /tmp/cron-root.tmp file in the CRON
notation. You need to parse it manually.
GIT REPOSITORY COMMANDS (SCM-GIT):
----------------------------------
1) CREATE REPO
Syntax: SCM-GIT CREATE REPO $name [WITH DESCRIPTION $descr] [FOR $domain]
Purpose: Creates the git repository $name in the repo_dir with optional
description $descr for domain (server) $domain.
Example: SCM-GIT CREATE REPO test WITH DESCRIPTION descr FOR domain.tld
This will create git repository test.git in the repo_dir with
description of 'descr' for domain domain.tld.
2) DELETE REPO
Syntax: SCM-GIT DELETE REPO $name
Purpose: Deletes the repository $name from repo_dir.
Example: SCM-GIT DELETE REPO test
This command deletes the repository test.git from the repo_dir.
3) ALTER REPO
Syntax: SCM-GIT ALTER REPO test SET type new_value
where type can be either DESCRIPTION or SERVER. New value can be empty
to disable server limitations or delete the repository description.
Purpose: Allows to change the repo description or server.
Example: SCM-GIT ALTER REPO test SET SERVER
SCM-GIT ALTER REPO test SET SERVER domain
First command changes the repository test.git rules to be shown
in gitweb of all the servers and second command limits the
repository to be shown only for domain (server) 'domain'.
4) DAEMON ENABLE
Syntax: DAEMON ENABLE
Purpose: Ensures the init scripts exists and enables the Git daemon.
5) DAEMON DISABLE
Syntax: DAEMON DISABLE
Purpose: Disables the Git daemon.
6) SYNC
Syntax: SYNC $reponame
Purpose: This command will synchronize data from $reponame repository (checkout) into the
remote location as defined in manager.conf file.
7) SYNC-REPO
Syntax: SYNC-REPO $reponame
Purpose: Same as 6 except the synchronization will take and transfer the git repository rather
than checked-out copy.
SVN REPOSITORY COMMANDS (SCM-SVN):
----------------------------------
1) CREATE REPO
Syntax: SCM-SVN CREATE REPO $name [ALLOW-ALL | FOR $username PASSWORD $password]
Purpose: Creates a new subversion (SVN) repository $name with option to
allow full access to all or not (ALLOW-ALL option). If you input
"FOR $username PASSWORD $password" clause you will associate
the repo with user $username which will be created if it doesn't
exist or reused if it already exists.
Example: SCM-SVN CREATE REPO test ALLOW-ALL
This command creates the SVN repository with read-write, i.e. full,
access rights to all users.
2) DELETE REPO
Syntax: SCM-SVN DELETE REPO $name
Purpose: Deletes the subversion repository from the repo_dir.
Example: SCM-SVN DELETE REPO test
This command deletes the repo named 'test' from the repo_dir.
BIND DAEMON COMMANDS (DNS-BIND)
-------------------------------
1) Domain zone creation
Syntax: DNS-BIND CREATE ZONE $domain_name
Purpose: Creates the new domain zone file and appends new file information into master file.
Example: DNS-BIND CREATE ZONE domain.tld
This command will create empty (but check-working) zone file for domain domain.tld
with appropriate entry added to the master file.
2) Domain record creation
Syntax: DNS-BIND CREATE $type RECORD $any_value FOR $name_with_domain_suffix
Purpose: Creates a new record of specified type and value to be appended to the domain
zone file under name corresponding to the first token of $name_with_domain_suffix.
Example: DNS-BIND CREATE TXT RECORD some value even with spaces FOR name.domain.tld
This command will create a new TXT record for domain domain.tld named as name
(extracted from name.domain.tld) with value "some value even with spaces" and
and the value will be appended to the domain zone file.
3) Domain zone deletion
Syntax: DNS-BIND DELETE ZONE domain.tld
Purpose: Deletes the previously created DNS zone.
4) Domain record deletion
Syntax: DNS-BIND DELETE RECORD record.domain.tld
Purpose: Deletes the previously created $record for zone domain.tld.
5) Domain zones dump
Syntax: DNS-BIND DUMP ZONES $output_filename
Purpose: Dumps all the zones available on the node and saves them into $output_filename.
6) Domain zone records dump
Syntax: DNS-BIND DUMP RECORDS $zone $output_filename
Purpose: Dumps all the zone records for $zone and saves them into $output_filename.
BUILTIN COMMANDS
----------------
1) Enabling port rule on machine using IPTABLES
Syntax: BUILTIN FIREWALL INSERT $port (TCP|UDP|BOTH) (ACCEPT|REJECT)
2) Disabling port rule on machine using IPTABLES
Syntax: BUILTIN FIREWALL DELETE $port (TCP|UDP|BOTH) (ACCEPT|REJECT)
3) Adding user
Syntax: BUILTIN USER ADD $name $password $groupName $description $home $shell
4) Adding group
Syntax: BUILTIN GROUP ADD $name