diff options
| author | Stephen D. Huston <shuston@apache.org> | 2011-10-20 18:42:46 +0000 |
|---|---|---|
| committer | Stephen D. Huston <shuston@apache.org> | 2011-10-20 18:42:46 +0000 |
| commit | 5eb354b338bb8d8fcd35b6ac3fb33f8103e757c3 (patch) | |
| tree | f24776684c025fbed6a0431bf3d6811f0a1aae7a /cpp/src/tests/qrsh_utils | |
| parent | 718ff5b34dd1e87eb79fa4c61fec668d1dc33103 (diff) | |
| download | qpid-python-5eb354b338bb8d8fcd35b6ac3fb33f8103e757c3.tar.gz | |
Merge trunk to QPID-2519 branch
git-svn-id: https://svn.apache.org/repos/asf/qpid/branches/QPID-2519@1186990 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'cpp/src/tests/qrsh_utils')
| -rwxr-xr-x | cpp/src/tests/qrsh_utils/10_all | 30 | ||||
| -rwxr-xr-x | cpp/src/tests/qrsh_utils/1_remote_run | 26 | ||||
| -rwxr-xr-x | cpp/src/tests/qrsh_utils/2_forever | 26 | ||||
| -rwxr-xr-x | cpp/src/tests/qrsh_utils/3_kill_it | 27 | ||||
| -rwxr-xr-x | cpp/src/tests/qrsh_utils/4_wait_for_it | 26 | ||||
| -rwxr-xr-x | cpp/src/tests/qrsh_utils/5_exited | 64 | ||||
| -rwxr-xr-x | cpp/src/tests/qrsh_utils/6_get | 29 | ||||
| -rwxr-xr-x | cpp/src/tests/qrsh_utils/7_get_output | 44 | ||||
| -rwxr-xr-x | cpp/src/tests/qrsh_utils/8_any | 43 | ||||
| -rwxr-xr-x | cpp/src/tests/qrsh_utils/9_alias | 38 | ||||
| -rw-r--r-- | cpp/src/tests/qrsh_utils/qrsh_example_command.cpp | 52 | ||||
| -rw-r--r-- | cpp/src/tests/qrsh_utils/qrsh_forever.cpp | 50 | ||||
| -rw-r--r-- | cpp/src/tests/qrsh_utils/qsh_doc.txt | 309 |
13 files changed, 0 insertions, 764 deletions
diff --git a/cpp/src/tests/qrsh_utils/10_all b/cpp/src/tests/qrsh_utils/10_all deleted file mode 100755 index 7b486ea672..0000000000 --- a/cpp/src/tests/qrsh_utils/10_all +++ /dev/null @@ -1,30 +0,0 @@ -/* - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - */ - -#! /bin/bash - -echo "Asking all servers to say their names... " -qrsh 127.0.0.1 5813 \ - all sayName - - - - diff --git a/cpp/src/tests/qrsh_utils/1_remote_run b/cpp/src/tests/qrsh_utils/1_remote_run deleted file mode 100755 index 5b9b307bba..0000000000 --- a/cpp/src/tests/qrsh_utils/1_remote_run +++ /dev/null @@ -1,26 +0,0 @@ -/* - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - */ - -#! /bin/bash - - -./qrsh 127.0.0.1 5813 \ - mrg23 command_1 /home/mick/redhat/qrsh/qrsh_run/my_command foo bar baz diff --git a/cpp/src/tests/qrsh_utils/2_forever b/cpp/src/tests/qrsh_utils/2_forever deleted file mode 100755 index 5528b0e4d8..0000000000 --- a/cpp/src/tests/qrsh_utils/2_forever +++ /dev/null @@ -1,26 +0,0 @@ -/* - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - */ - -#! /bin/bash - - -./qrsh 127.0.0.1 5813 \ - mrg23 command_2 /home/mick/redhat/qrsh/qrsh_run/forever foo bar baz diff --git a/cpp/src/tests/qrsh_utils/3_kill_it b/cpp/src/tests/qrsh_utils/3_kill_it deleted file mode 100755 index afc7a03c9d..0000000000 --- a/cpp/src/tests/qrsh_utils/3_kill_it +++ /dev/null @@ -1,27 +0,0 @@ -/* - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - */ - -#! /bin/bash - -echo "Killing command 2... " -./qrsh 127.0.0.1 5813 \ - mrg23 exec kill -9 command_2 - diff --git a/cpp/src/tests/qrsh_utils/4_wait_for_it b/cpp/src/tests/qrsh_utils/4_wait_for_it deleted file mode 100755 index a4dc0da1ce..0000000000 --- a/cpp/src/tests/qrsh_utils/4_wait_for_it +++ /dev/null @@ -1,26 +0,0 @@ -/* - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - */ - -#! /bin/bash - -./qrsh 127.0.0.1 5813 \ - mrg23 exec_wait /home/mick/redhat/qrsh/qrsh_run/my_command foo bar baz -echo "my_command returned an exit code of $?" diff --git a/cpp/src/tests/qrsh_utils/5_exited b/cpp/src/tests/qrsh_utils/5_exited deleted file mode 100755 index 4fec1dcc79..0000000000 --- a/cpp/src/tests/qrsh_utils/5_exited +++ /dev/null @@ -1,64 +0,0 @@ -/* - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - */ - -#! /bin/bash - -path=/home/mick/redhat/qrsh/qrsh_run - -echo "Running command_3 ..." -./qrsh 127.0.0.1 5813 \ - mrg23 command_3 $path/my_command foo bar baz - -echo "Now I do some other stuff..." -sleep 1 -echo "And then some more stuff..." -sleep 1 -echo "and so on..." -sleep 1 - -echo "Now I'm waiting for command_3 ..." -./qrsh 127.0.0.1 5813 \ - mrg23 exited command_3 -echo "has command_3 exited: $? ." -sleep 5 - -./qrsh 127.0.0.1 5813 \ - mrg23 exited command_3 -echo "has command_3 exited: $? ." -sleep 5 - -./qrsh 127.0.0.1 5813 \ - mrg23 exited command_3 -echo "has command_3 exited: $? ." -sleep 5 - -./qrsh 127.0.0.1 5813 \ - mrg23 exited command_3 -echo "has command_3 exited: $? ." -sleep 5 - -./qrsh 127.0.0.1 5813 \ - mrg23 exited command_3 -echo "has command_3 exited: $? ." -sleep 5 - - - diff --git a/cpp/src/tests/qrsh_utils/6_get b/cpp/src/tests/qrsh_utils/6_get deleted file mode 100755 index 4b35ca98e6..0000000000 --- a/cpp/src/tests/qrsh_utils/6_get +++ /dev/null @@ -1,29 +0,0 @@ -/* - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - */ - -#! /bin/bash - -echo "getting /tmp/foo ..." -./qrsh 127.0.0.1 5813 \ - mrg23 get /tmp/foo - - - diff --git a/cpp/src/tests/qrsh_utils/7_get_output b/cpp/src/tests/qrsh_utils/7_get_output deleted file mode 100755 index 59911089ec..0000000000 --- a/cpp/src/tests/qrsh_utils/7_get_output +++ /dev/null @@ -1,44 +0,0 @@ -/* - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - */ - -#! /bin/bash - -echo "Run a command..." -./qrsh 127.0.0.1 5813 \ - mrg23 command_4 /home/mick/redhat/qrsh/qrsh_run/my_command foo bar baz - -echo "Wait for a while..." -sleep 20 - -echo "Get stderr output:" -echo "------------- begin stderr ---------------" -./qrsh 127.0.0.1 5813 \ - mrg23 get command_4 stderr -echo "------------- end stderr ---------------" -echo " " -echo " " -echo " " -echo "Get stdout output:" -echo "------------- begin stdout ---------------" -./qrsh 127.0.0.1 5813 \ - mrg23 get command_4 stdout -echo "------------- end stdout ---------------" - diff --git a/cpp/src/tests/qrsh_utils/8_any b/cpp/src/tests/qrsh_utils/8_any deleted file mode 100755 index 2a922ea0e0..0000000000 --- a/cpp/src/tests/qrsh_utils/8_any +++ /dev/null @@ -1,43 +0,0 @@ -/* - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - */ - -#! /bin/bash - -echo "asking any server to say his name ..." -./qrsh 127.0.0.1 5813 \ - any sayName -sleep 1 -echo "asking any server to say his name ..." -./qrsh 127.0.0.1 5813 \ - any sayName -sleep 1 -echo "asking any server to say his name ..." -./qrsh 127.0.0.1 5813 \ - any sayName -sleep 1 -echo "asking any server to say his name ..." -./qrsh 127.0.0.1 5813 \ - any sayName -sleep 1 - - - - diff --git a/cpp/src/tests/qrsh_utils/9_alias b/cpp/src/tests/qrsh_utils/9_alias deleted file mode 100755 index a4cfdfdf9a..0000000000 --- a/cpp/src/tests/qrsh_utils/9_alias +++ /dev/null @@ -1,38 +0,0 @@ -/* - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - */ - -#! /bin/bash - -# Make a group of two of the servers, using "alias", -# and send the group a command. - -qrsh 127.0.0.1 5813 \ - mrg22 alias group_1 -qrsh 127.0.0.1 5813 \ - mrg23 alias group_1 - -echo "Asking group_1 to say their names... " -qrsh 127.0.0.1 5813 \ - group_1 sayName - - - - diff --git a/cpp/src/tests/qrsh_utils/qrsh_example_command.cpp b/cpp/src/tests/qrsh_utils/qrsh_example_command.cpp deleted file mode 100644 index 386e2f73f0..0000000000 --- a/cpp/src/tests/qrsh_utils/qrsh_example_command.cpp +++ /dev/null @@ -1,52 +0,0 @@ -/* - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - */ - -#include <stdio.h> -#include <unistd.h> - - - -main ( int argc, char ** argv ) -{ - fprintf ( stderr, "Hello, I am the Example Child!\n"); - fprintf ( stderr, "my arguments %d are:\n", argc - 1 ); - fprintf ( stdout, "And hello to stdout, too!\n"); - - int i; - for ( i = 1; i < argc; ++ i ) - { - fprintf ( stderr, "arg %d: |%s|\n", i, argv[i] ); - } - - for ( i = 0; i < 15; ++ i ) - { - fprintf ( stderr, "child sleeping...\n" ); - sleep ( 1 ); - } - - fprintf ( stderr, "child exiting with code 13.\n" ); - - return 13; -} - - - - diff --git a/cpp/src/tests/qrsh_utils/qrsh_forever.cpp b/cpp/src/tests/qrsh_utils/qrsh_forever.cpp deleted file mode 100644 index 191a9bca11..0000000000 --- a/cpp/src/tests/qrsh_utils/qrsh_forever.cpp +++ /dev/null @@ -1,50 +0,0 @@ -/* - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - */ - - -#include <stdio.h> -#include <unistd.h> - - - -main ( int argc, char ** argv ) -{ - fprintf ( stderr, "Hello, I am the Forever Example Child!\n"); - fprintf ( stderr, "my %d arguments are:\n", argc - 1 ); - - int i; - for ( i = 1; i < argc; ++ i ) - fprintf ( stderr, "arg %d: |%s|\n", i, argv[i] ); - - for ( i = 0; i >= 0; ++ i ) - { - fprintf ( stderr, "child sleeping forever %d ...\n" , i); - sleep ( 1 ); - } - - fprintf ( stderr, "child exiting with code 12.\n" ); - - return 12; -} - - - - diff --git a/cpp/src/tests/qrsh_utils/qsh_doc.txt b/cpp/src/tests/qrsh_utils/qsh_doc.txt deleted file mode 100644 index ad5990b38b..0000000000 --- a/cpp/src/tests/qrsh_utils/qsh_doc.txt +++ /dev/null @@ -1,309 +0,0 @@ -/* - * - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - */ - -############################################## - qrsh: a Qpid-based remote shell utility - - Last updated: 3 Aug 09 Mick Goulish -############################################## - - - -============================= -Overview -============================= - - You're writing a multi-box test, and you want to write a - shell script in which you start processes on other boxes - and kill them (or send arbitrary signals to them). - - But ssh doesn't let you signal them, and bash isn't the - greatest language in the world for creating data structures - (like you need to associate the PIDs with box names and - executable names.) - - Qsh is a utility implemented on Qpid that you can use from - within your bash script, or any other scripting language. - With it, you can: - - 1. run any executable on any box in your cluster. - - 2. don't worry about PIDs and box-names. You associate - your own abstract names with the executable instances, - and then use those names in the rest of your script. - I.e. "broker_1" "sender_3" etc. - - 3. Launch the executable and wait until it returns, and - get its exit code. - - 4. Launch your executable and do other stuff, then come - back later and see if it has exited. - - 5. Get whatever it sent to stdout or stderr. - - 6. Get the contents of any other file. - - 7. send a command to all your boxes at once - - 8. send a command to a randomly selected box. - - 9. define groups of boxes, and send a command simultaneously - to all boxes in a given group. - - - - -============================= -Using It -============================= - - 1. You need to run a Qpid broker. - - 2. You start a Qpid client ( which is called a qrsh_server ) - on all the boxes you care about. And you give them all - names like "mrg13", "mrg14" etc. The names can be anything - you want, but I've always used one qrsh_server per box, - and given it the box name. ( However, you can run two on - one box, they won't collide. ) - - 3. After you start all servers, send a "start" command to any - one of them: - - 4. The qrsh_servers use the fanout exchange to talk to each - other. - - 5. In your script, you run an executable called "qrsh". It knows - how to talk to the servers, do what you want, and retrieve - the data you want. - - - example start script: (this does 4 servers on the same box) - ------------------------------------------------------------- - - echo "Starting server mrg22 ..." - ./qrsh_server mrg22 ./qrsh_run 127.0.0.1 5813 & - - echo "Starting server mrg23 ..." - ./qrsh_server mrg23 ./qrsh_run 127.0.0.1 5813 & - - echo "Starting server mrg24 ..." - ./qrsh_server mrg24 ./qrsh_run 127.0.0.1 5813 & - - echo "Starting server mrg25 ..." - ./qrsh_server mrg25 ./qrsh_run 127.0.0.1 5813 & - - echo "Issuing start command..." - sleep 2 - ./qrsh 127.0.0.1 5813 mrg22 start - sleep 1 - - echo "Ready." - - # end of script. - - - - - - -============================= -Qrsh Syntax -============================= - - qrsh host port server_name command_name arg* - - - "host" and "port" specify the Qpid server to connect to. - - "server_name" can be anything you want. I always use the name - of the box that the server is running on. - - "command_name" is the name that you choose to assign to - the process you are running. Each process that you decide - to name must have a unique name within this script. - - Or it could be a reserved command name, that Qsh - interprets in a special way. - - Reserved command names are: - - exec - exec_wait - exited - get - - "exec" means "interpret the rest of the command line as a - command to be executed by the designated server. - - "exec_wait" means same as "exec", but wait for the command - to terminate, and return its exit code. - - "exited" -- you provide 1 arg, which is an abstract - process name. qrsh returns 1 if that process has exited, - else 0. - - "get" -- you provide one arg which is a path. qrsh returns - (by printing to stdout) the contents of that file. - - "arg*" is zero or more arguments. They are interpreted - differently depending on whether you are using one of - the above reserved command names, or making up your own - abstract name for a command. - - - - -============================= -Examples -============================= - - 1. Run a process on a remote box. - - qrsh mrg23 command_1 /usr/sbin/whatever foo bar baz - - Returns immediately. - - - - 2. Kill a process that you started earlier: - - qrsh mrg23 exec kill -9 command_1 - - After the word "exec" put any command line you want. - The server you're sending this to will replace all abstract - names in the command with process IDs. ( In this example, - just the word "command_1" will be replaced. ) Then it will - execute the command. - - - - 3. Execute a command, and wait for it to finish - - qrsh mrg23 exec_wait command_name args - - - - 4. Check on whether a command you issude earlier has exited. - - ./qrsh mrg23 exited command_3 - - Returns 1 if it has exited, else 0. - - - - 5. Get the contents of a file from the remote system: - - ./qrsh mrg23 get /tmp/foo - - Prints the contents to stdout. - - - - 6. Send a command to all servers at once: - - # This example causes them all to print thir names to stderr. - ./qrsh all sayName - - - 7. Define a group of servers and send a command to that group. - - #! /bin/bash - - # Make a group of two of the servers, using "alias", - # and send the group a command. - - qrsh 127.0.0.1 5813 \ - mrg22 alias group_1 - - qrsh 127.0.0.1 5813 \ - mrg23 alias group_1 - - echo "Asking group_1 to say their names... " - qrsh 127.0.0.1 5813 \ - group_1 sayName - - # end of script. - - - - - 8. Execute a command and get its stdout and stderr contents. - - #! /bin/bash - - echo "Run a command..." - ./qrsh 127.0.0.1 5813 \ - mrg23 command_4 my_command foo bar baz - - echo "Wait for a while..." - sleep 10 - - echo "Get stderr output:" - echo "------------- begin stderr ---------------" - ./qrsh 127.0.0.1 5813 \ - mrg23 get command_4 stderr - echo "------------- end stderr ---------------" - echo " " - - echo " " - echo "Get stdout output:" - echo "------------- begin stdout ---------------" - ./qrsh 127.0.0.1 5813 \ - mrg23 get command_4 stdout - echo "------------- end stdout ---------------" - - # end of script. - - - - - 9. Send a command to one of your servers, selected - at random. - - #! /bin/bash - - # I do it multiple times here, so I can see - # that it really is selecting randomly. - - echo "asking any server to say his name ..." - ./qrsh 127.0.0.1 5813 \ - any sayName - sleep 1 - - echo "asking any server to say his name ..." - ./qrsh 127.0.0.1 5813 \ - any sayName - sleep 1 - - echo "asking any server to say his name ..." - ./qrsh 127.0.0.1 5813 \ - any sayName - sleep 1 - - echo "asking any server to say his name ..." - ./qrsh 127.0.0.1 5813 \ - any sayName - - # end of script. - - - - |
