diff --git a/ratis-examples/src/main/bin/start-counter-server.sh b/ratis-examples/src/main/bin/start-counter-server.sh new file mode 100644 index 0000000000..19052ec320 --- /dev/null +++ b/ratis-examples/src/main/bin/start-counter-server.sh @@ -0,0 +1,39 @@ +#!/usr/bin/env bash +# 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. + +DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" + +source $DIR/common.sh + +# One of the examples, e.g. "filestore" or "arithmetic" +example="$1" +shift + +subcommand="$1" +shift + +# Find a tmpdir, defaulting to what the environment tells us +tmp="${TMPDIR:-/tmp}" + +echo "Starting 3 Ratis servers with Counter with directories in '${tmp}' as local storage" + +for((i=1;i<=3;i++)); +do +java -cp $ARTIFACT org.apache.ratis.examples.counter.server.CounterServer $i & +done + + +echo "Waiting for the servers" diff --git a/ratis-examples/src/main/bin/stop-counter-server.sh b/ratis-examples/src/main/bin/stop-counter-server.sh new file mode 100644 index 0000000000..a638d3fa99 --- /dev/null +++ b/ratis-examples/src/main/bin/stop-counter-server.sh @@ -0,0 +1,18 @@ + #!/usr/bin/env bash +# 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. + + kill $(jps -lv | grep 'ratis' | grep 'CounterServer' | grep -v 'grep' | awk '{print $1}') + echo "All Ratis examples have been stopped."