| 
									
										
										
										
											2020-05-28 05:31:31 +08:00
										 |  |  | #!/bin/bash
 | 
					
						
							| 
									
										
										
										
											2011-10-08 03:51:28 +08:00
										 |  |  | # 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 | 
					
						
							| 
									
										
										
										
											2017-12-16 06:48:30 +08:00
										 |  |  | # | 
					
						
							| 
									
										
										
										
											2011-10-08 03:51:28 +08:00
										 |  |  | #    http://www.apache.org/licenses/LICENSE-2.0 | 
					
						
							| 
									
										
										
										
											2017-12-16 06:48:30 +08:00
										 |  |  | # | 
					
						
							| 
									
										
										
										
											2011-10-08 03:51:28 +08:00
										 |  |  | # 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. | 
					
						
							| 
									
										
										
										
											2017-12-16 06:48:30 +08:00
										 |  |  | SIGNAL=${SIGNAL:-TERM} | 
					
						
							| 
									
										
										
										
											2020-02-20 22:19:50 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-09-02 23:46:24 +08:00
										 |  |  | OSNAME=$(uname -s) | 
					
						
							|  |  |  | if [[ "$OSNAME" == "OS/390" ]]; then | 
					
						
							| 
									
										
										
										
											2020-02-20 22:19:50 +08:00
										 |  |  |     if [ -z $JOBNAME ]; then | 
					
						
							|  |  |  |         JOBNAME="ZKEESTRT" | 
					
						
							|  |  |  |     fi | 
					
						
							|  |  |  |     PIDS=$(ps -A -o pid,jobname,comm | grep -i $JOBNAME | grep java | grep -v grep | awk '{print $1}') | 
					
						
							| 
									
										
										
										
											2020-09-02 23:46:24 +08:00
										 |  |  | elif [[ "$OSNAME" == "OS400" ]]; then | 
					
						
							| 
									
										
										
										
											2021-01-22 02:18:48 +08:00
										 |  |  |     PIDS=$(ps -Af | grep java | grep -i QuorumPeerMain | grep -v grep | awk '{print $2}') | 
					
						
							| 
									
										
										
										
											2020-02-20 22:19:50 +08:00
										 |  |  | else | 
					
						
							|  |  |  |     PIDS=$(ps ax | grep java | grep -i QuorumPeerMain | grep -v grep | awk '{print $1}') | 
					
						
							|  |  |  | fi | 
					
						
							| 
									
										
										
										
											2016-03-04 09:41:47 +08:00
										 |  |  | 
 | 
					
						
							|  |  |  | if [ -z "$PIDS" ]; then | 
					
						
							|  |  |  |   echo "No zookeeper server to stop" | 
					
						
							|  |  |  |   exit 1 | 
					
						
							|  |  |  | else | 
					
						
							| 
									
										
										
										
											2017-12-16 06:48:30 +08:00
										 |  |  |   kill -s $SIGNAL $PIDS | 
					
						
							| 
									
										
										
										
											2016-03-04 09:41:47 +08:00
										 |  |  | fi |