From cdaa5dd7f91d93fce3d900e4321dd83d021e96dd Mon Sep 17 00:00:00 2001 From: Kaleb S KEITHLEY Date: Tue, 17 May 2016 11:06:07 -0400 Subject: scripts: bash-isms in scripts MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Backport of http://review.gluster.org/14401/ Change-Id: I05f8718fb73c16dbb37c1f7460bb7b55cc0ffe97 BUG: 1223947 Reported-by: Patrick Matthäi Signed-off-by: Kotresh HR Original-Author: Kaleb S KEITHLEY (cherry picked from commit 2df72780e473709128a4f5d7f274a9063b288252) Reviewed-on: http://review.gluster.org/14774 Smoke: Gluster Build System NetBSD-regression: NetBSD Build System CentOS-regression: Gluster Build System Reviewed-by: Kaleb KEITHLEY --- extras/stop-all-gluster-processes.sh | 10 +++++----- tools/gfind_missing_files/gfid_to_path.sh | 5 +++-- tools/gfind_missing_files/gfind_missing_files.sh | 12 ++++++------ 3 files changed, 14 insertions(+), 13 deletions(-) diff --git a/extras/stop-all-gluster-processes.sh b/extras/stop-all-gluster-processes.sh index 5bc58b30f4e..356a2a63059 100755 --- a/extras/stop-all-gluster-processes.sh +++ b/extras/stop-all-gluster-processes.sh @@ -4,7 +4,7 @@ errors=0 # find the mounts and return their pids -function get_mount_pids() +get_mount_pids() { local opts local pid @@ -20,7 +20,7 @@ function get_mount_pids() } # handle mount processes i.e. 'glusterfs' -function kill_mounts() +kill_mounts() { local signal=${1} local pid @@ -33,7 +33,7 @@ function kill_mounts() } # handle brick processes and node services -function kill_bricks_and_services() +kill_bricks_and_services() { local signal=${1} local pidfile @@ -50,7 +50,7 @@ function kill_bricks_and_services() # for geo-replication, only 'monitor' has pid file written, other # processes are not having a pid file, so get it through 'ps' and # handle these processes -function kill_georep_gsync() +kill_georep_gsync() { local signal=${1} @@ -64,7 +64,7 @@ function kill_georep_gsync() fi } -function main() +main() { kill_mounts TERM kill_bricks_and_services TERM diff --git a/tools/gfind_missing_files/gfid_to_path.sh b/tools/gfind_missing_files/gfid_to_path.sh index 20ac6a94fd2..ebe817ac2f3 100644 --- a/tools/gfind_missing_files/gfid_to_path.sh +++ b/tools/gfind_missing_files/gfid_to_path.sh @@ -11,7 +11,7 @@ E_BADARGS=65 -function gfid_to_path() +gfid_to_path () { brick_dir=$1; gfid_file=$(readlink -e $2); @@ -29,7 +29,8 @@ function gfid_to_path() } -function main(){ +main () +{ if [ $# -ne 2 ] then echo "Usage: `basename $0` BRICK_DIR GFID_FILE"; diff --git a/tools/gfind_missing_files/gfind_missing_files.sh b/tools/gfind_missing_files/gfind_missing_files.sh index 07d6befc958..f42fe7b05af 100644 --- a/tools/gfind_missing_files/gfind_missing_files.sh +++ b/tools/gfind_missing_files/gfind_missing_files.sh @@ -14,18 +14,18 @@ SLAVEVOL= #Slave volume SLAVEMNT= #Slave gluster volume mount point WORKERS=4 #Default number of worker threads -function out() +out() { echo "$@"; } -function fatal() +fatal() { out FATAL "$@"; exit 1 } -function ping_host () +ping_host () { ### Use bash internal socket support { @@ -39,7 +39,7 @@ function ping_host () } 1>&2 2>/dev/null } -function mount_slave() +mount_slave() { local i; # inode number SSH_PORT=22 @@ -59,7 +59,7 @@ function mount_slave() [ "x$i" = "x1" ] || fatal "Could not mount volume $2 on $SLAVEMNT Please check host and volume exists"; } -function parse_cli() +parse_cli() { if [[ $# -ne 4 ]]; then echo "Usage: gfind_missing_files " @@ -76,7 +76,7 @@ function parse_cli() fi } -function main() +main() { parse_cli "$@"; -- cgit