Rajesh3338 commited on
Commit
1d97050
·
verified ·
1 Parent(s): a72ec98

Create dataset.txt

Browse files
Files changed (1) hide show
  1. dataset.txt +290 -0
dataset.txt ADDED
@@ -0,0 +1,290 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ CPSL (Custom Process Scripting Language) Documentation
2
+
3
+ 1. Introduction
4
+ CPSL is a domain-specific scripting language designed for automating server management, database operations, and system administration tasks. It enables efficient interaction with servers, execution of shell commands, and control over processes and services.
5
+
6
+ 2. Commands Overview
7
+ - R_ConnectServer: Connects to a remote server using its hostname or IP address.
8
+ Example:
9
+ R_ConnectServer "<Server_Name>"
10
+
11
+ - ExecuteShellCommandEnter: Executes a shell command on the connected server with an optional timeout.
12
+ Example:
13
+ ExecuteShellCommandEnter "hostname", "$", 5000
14
+
15
+ - R_DisconnectSSH: Disconnects the session from the connected server.
16
+ Example:
17
+ R_DisconnectSSH
18
+
19
+ - GetServerPass: Retrieves the password for a server.
20
+ Example:
21
+ GetServerPass("<Environment>", "<Server>", "<Key>")
22
+
23
+ - GetServerUser: Retrieves the username for a server.
24
+ Example:
25
+ GetServerUser("<Environment>", "<Server>", "<Key>")
26
+
27
+ 3. Common Scripting Tasks
28
+
29
+ 3.1 Update Hostname
30
+ Updates the hostname on a server and verifies the change.
31
+
32
+ R_ConnectServer "<Server_Name>"
33
+ ExecuteShellCommandEnter "sudo su - root", "$", 5000
34
+ ExecuteShellCommandEnter "hostnamectl set-hostname <New_Hostname>", "$", 5000
35
+ $v1 = ExecuteShellCommandEnter "hostname", "$", 5000
36
+ if (v1.contains("<New_Hostname>")) then
37
+ R_DisconnectSSH
38
+ return true
39
+ else
40
+ R_DisconnectSSH
41
+ return false
42
+ end
43
+
44
+ 3.2 Container Platform Operations
45
+ Example for OCP login and operations:
46
+
47
+ R_ConnectServer "<Server_Name>"
48
+ ExecuteShellCommandEnter "oc login <Protocol>://<FQDN>:<Port> -u <Username> -p <Password>", "$", <Login_Timeout>
49
+ ExecuteShellCommandEnter "oc project <Project_Name>", "$", <Project_Timeout>
50
+ ExecuteShellCommandEnter "<Scale_Command>", "$", <Operation_Timeout>
51
+ $v1 = ExecuteShellCommandEnter "<Status_Command>", "$", <Status_Timeout>
52
+ if (v1.contains("<Status_Pattern>")) then
53
+ R_DisconnectSSH
54
+ return true
55
+ else
56
+ R_DisconnectSSH
57
+ return false
58
+ end
59
+
60
+ 3.3 Service Instance Management
61
+ Example for service control:
62
+
63
+ R_ConnectServer "<Server_Name>"
64
+ ExecuteShellCommandEnter "sudo su - <Service_User>", "$", <Auth_Timeout>
65
+ ExecuteShellCommandEnter "cd <Service_Path>", "$", <Path_Timeout>
66
+ $v1 = ExecuteShellCommandEnter "sh <Service_Script>", "$", <Execute_Timeout>
67
+ if (v1.contains("<Status_Pattern>")) then
68
+ R_DisconnectSSH
69
+ return true
70
+ else
71
+ R_DisconnectSSH
72
+ return false
73
+ end
74
+
75
+ 3.4 Log Monitoring with Loop
76
+ Example for continuous log monitoring:
77
+
78
+ R_ConnectServer "<Server_Name>"
79
+ ExecuteShellCommandEnter "cd <Log_Path>", "$", <Path_Timeout>
80
+ loop
81
+ $v1 = ExecuteShellCommandEnter "tail -100 <Log_File>", "$", <Monitor_Timeout>
82
+ if (v1.contains("<Success_Pattern>")) then
83
+ R_DisconnectSSH
84
+ clearfile
85
+ else
86
+ Wait <Interval>
87
+ Breakloopaftercycle(<Max_Cycles>)
88
+ goto loop
89
+ end
90
+
91
+ 3.5 File Operations
92
+ Example for file management:
93
+
94
+ R_ConnectServer "<Server_Name>"
95
+ ExecuteShellCommandEnter "cd <Path>", "$", <Path_Timeout>
96
+ $v1 = ExecuteShellCommandEnter "<File_Operation>", "$", <Operation_Timeout>
97
+ if (v1.contains("<Success_Pattern>")) then
98
+ R_DisconnectSSH
99
+ return true
100
+ else
101
+ R_DisconnectSSH
102
+ return false
103
+ end
104
+
105
+ 3.6 Start EnterpriseLink Cluster Server
106
+ Starts the EnterpriseLink Cluster Server service and verifies it.
107
+
108
+ R_ConnectServer "<Server_Name>"
109
+ ExecuteShellCommandEnter "sudo su - root", "$", 5000
110
+ $v1 = ExecuteShellCommandEnter "/etc/init.d/EnterpriseLinkClusterServer start", "$", 5000
111
+ if (v1.contains("Starting EnterpriseLink Cluster Server")) then
112
+ R_DisconnectSSH
113
+ return true
114
+ else
115
+ R_DisconnectSSH
116
+ return false
117
+ end
118
+
119
+ 3.7 Copy Files to Another Server
120
+ Copies a file from one server to another using SCP.
121
+
122
+ R_ConnectServer "<Source_Server_Name>"
123
+ ExecuteShellCommandEnter "scp <File_Path> <Destination_User>@<Destination_IP>:<Destination_Path>", "$", 5000
124
+ ExecuteShellCommandEnter "yes", "$", 5000
125
+ $v1 = ExecuteShellCommandEnter "ls <Destination_Path>", "$", 5000
126
+ if (v1.contains("<File_Name>")) then
127
+ R_DisconnectSSH
128
+ return true
129
+ else
130
+ R_DisconnectSSH
131
+ return false
132
+ end
133
+
134
+ 3.8 MySQL Operations
135
+ Starts MySQL replication and verifies the process.
136
+
137
+ R_ConnectServer "<Server_Name>"
138
+ ExecuteShellCommandEnter "mysql -u <Username> -p", "$", 5000
139
+ ExecuteShellCommandEnter "start slave;", "$", 5000
140
+ $v1 = ExecuteShellCommandEnter "show slave status\G", "$", 5000
141
+ if (v1.contains("Running")) then
142
+ R_DisconnectSSH
143
+ return true
144
+ else
145
+ R_DisconnectSSH
146
+ return false
147
+ end
148
+
149
+ 3.9 Manage SnapMirror
150
+
151
+ Quiesce SnapMirror Replication:
152
+ R_ConnectServer "<Storage_Server_Name>"
153
+ $v1 = ExecuteShellCommandEnter "snapmirror quiesce -destination-path <Path>", "$", 5000
154
+ if (v1.contains("Operation succeeded")) then
155
+ R_DisconnectSSH
156
+ return true
157
+ else
158
+ R_DisconnectSSH
159
+ return false
160
+ end
161
+
162
+ Break SnapMirror Replication:
163
+ R_ConnectServer "<Storage_Server_Name>"
164
+ $v1 = ExecuteShellCommandEnter "snapmirror break -destination-path <Path>", "$", 5000
165
+ if (v1.contains("Operation succeeded")) then
166
+ R_DisconnectSSH
167
+ return true
168
+ else
169
+ R_DisconnectSSH
170
+ return false
171
+ end
172
+
173
+ 4. Multiple Server Operation Patterns
174
+
175
+ 4.1 Single Server, Multiple Operations
176
+
177
+ R_Connect Server "<Server_Name>"
178
+ ExecuteShellCommandEnter "sudo su - <User>","",<Timeout>
179
+ $v1 = ExecuteShellCommandEnter "<Command_1>","",<Timeout_1>
180
+ if($v1.notcontains("<Success_Pattern_1>")) then
181
+ R_DisconnectSSH
182
+ return false
183
+ else
184
+ $v2 = ExecuteShellCommandEnter "<Command_2>","",<Timeout_2>
185
+ if($v2.notcontains("<Success_Pattern_2>")) then
186
+ R_DisconnectSSH
187
+ return false
188
+ else
189
+ R_DisconnectSSH
190
+ return true
191
+ end
192
+ end
193
+
194
+ 4.2 Multiple Servers, Sequential Operations
195
+
196
+ R_Connect Server "<Server_1>"
197
+ ExecuteShellCommandEnter "sudo su - <User_1>","",<Timeout>
198
+ $v1 = ExecuteShellCommandEnter "<Command_1>","",<Timeout_1>
199
+ if($v1.notcontains("<Success_Pattern_1>")) then
200
+ R_DisconnectSSH
201
+ return false
202
+ else
203
+ R_Connect Server "<Server_2>"
204
+ ExecuteShellCommandEnter "sudo su - <User_2>","",<Timeout>
205
+ $v2 = ExecuteShellCommandEnter "<Command_2>","",<Timeout_2>
206
+ if($v2.notcontains("<Success_Pattern_2>")) then
207
+ R_DisconnectSSH
208
+ return false
209
+ else
210
+ R_DisconnectSSH
211
+ return true
212
+ end
213
+ end
214
+
215
+ 4.3 Multiple Servers, Parallel Operations
216
+
217
+ R_Connect Server "<Server_1>"
218
+ ExecuteShellCommandEnter "sudo su - <User_1>","",<Timeout>
219
+ $v1 = ExecuteShellCommandEnter "<Command_1>","",<Timeout_1>
220
+ R_DisconnectSSH
221
+
222
+ R_Connect Server "<Server_2>"
223
+ ExecuteShellCommandEnter "sudo su - <User_2>","",<Timeout>
224
+ $v2 = ExecuteShellCommandEnter "<Command_2>","",<Timeout_2>
225
+ R_DisconnectSSH
226
+
227
+ R_Connect Server "<Server_3>"
228
+ ExecuteShellCommandEnter "sudo su - <User_3>","",<Timeout>
229
+ $v3 = ExecuteShellCommandEnter "<Command_3>","",<Timeout_3>
230
+ R_DisconnectSSH
231
+
232
+ if($v1.notcontains("<Success_Pattern_1>") or $v2.notcontains("<Success_Pattern_2>") or $v3.notcontains("<Success_Pattern_3>")) then
233
+ return false
234
+ else
235
+ return true
236
+ end
237
+
238
+ 4.4 Best Practices for Multiple Server Operations:
239
+ - Use appropriate timeout values for each operation
240
+ - Implement proper error handling and validation for each server connection and command execution
241
+ - Disconnect from servers after completing operations or in case of errors
242
+ - Use consistent naming conventions for variables and placeholders
243
+ - Structure the script logically, grouping related operations together
244
+ - Consider using loops for repetitive operations across multiple servers
245
+ - Implement appropriate logging or output messages for troubleshooting
246
+ - Use .contains() or .notcontains() based on the expected output patterns
247
+ - Ensure proper indentation and nesting of if-else statements for readability
248
+
249
+ Common Timeout Values:
250
+ - Authentication: 5000-60000
251
+ - Basic operations: 5000
252
+ - Service operations: 120000-300000
253
+ - Platform operations: 60000-120000
254
+ - Recovery operations: 300000-1200000
255
+
256
+ Best Practices:
257
+ - Use empty string for second parameter
258
+ - Include R_DisconnectSSH in all paths
259
+ - Validate each operation before proceeding
260
+ - Match number of 'end' statements with if blocks
261
+ - Follow proper nesting structure
262
+ - Use appropriate timeout values
263
+ - Use .contains() or .notcontains() based on validation needs
264
+
265
+
266
+ 4.5 Best Practices for Multiple Server Operations:
267
+ - Use empty string "" for second parameter in ExecuteShellCommandEnter
268
+ - Implement proper timeout values for each operation
269
+ - Follow nested if-else structure for validations
270
+ - Include R_DisconnectSSH in each failure path
271
+ - Match 'end' statements with if blocks
272
+ - Use .contains() or .notcontains() based on validation needs
273
+ - Maintain consistent prompt patterns
274
+ - Follow proper command sequence
275
+ - Implement appropriate validation checks
276
+
277
+ 5. Best Practices
278
+ - Always sanitize inputs to avoid hardcoding sensitive information
279
+ - Use placeholders in templates and replace them with real values during execution
280
+ - Test scripts in a controlled environment before deploying them in production
281
+ - Set appropriate timeout values based on operation type
282
+ - Implement proper validation checks for operations
283
+ - Include error handling for all operations
284
+
285
+ 6. Common Timeout Values
286
+ - Basic operations: 5000
287
+ - Authentication operations: 60000
288
+ - Path operations: 60000
289
+ - Service operations: 300000
290
+ - Build operations: 900000