Skip to content

Commit

Permalink
script/run-cbt.sh: drop bashism
Browse files Browse the repository at this point in the history
* "local" is not supported by POSIX shell, so drop it
* assign "$*" to a non-array variable, see
  https://github.com/koalaman/shellcheck/wiki/SC2124
* fail early if "cd" fails, see
  https://github.com/koalaman/shellcheck/wiki/SC2164
* quote "$(...)" with quotes to avoid string split

Signed-off-by: Kefu Chai <[email protected]>
  • Loading branch information
tchaikov committed Dec 10, 2020
1 parent bcebcea commit 2335cde
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/script/run-cbt.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/bin/sh

usage() {
local prog_name=$1
prog_name=$1
shift
cat <<EOF
usage:
Expand Down Expand Up @@ -86,13 +86,13 @@ fi
# store absolute path before changing cwd
source_dir=$(readlink -f $source_dir)
if ! $use_existing; then
cd $build_dir
cd $build_dir || exit
# seastar uses 128*8 aio in reactor for io and 10003 aio for events pooling
# for each core, if it fails to enough aio context, the seastar application
# bails out. and take other process into consideration, let's make it
# 32768 per core
max_io=$(expr 32768 \* $(nproc))
if test $(/sbin/sysctl --values fs.aio-max-nr) -lt $max_io; then
max_io=$(expr 32768 \* "$(nproc)")
if test "$(/sbin/sysctl --values fs.aio-max-nr)" -lt $max_io; then
sudo /sbin/sysctl -q -w fs.aio-max-nr=$max_io
fi
if $classical; then
Expand All @@ -105,7 +105,7 @@ if ! $use_existing; then
--crimson --nodaemon --redirect-output \
--osd-args "--memory 4G"
fi
cd -
cd - || exit
fi

for config_file in $config_files; do
Expand All @@ -123,7 +123,7 @@ for config_file in $config_files; do
done

if ! $use_existing; then
cd $build_dir
cd $build_dir || exit
if $classical; then
$source_dir/src/stop.sh
else
Expand Down

0 comments on commit 2335cde

Please sign in to comment.