From: Martin Schwenke Date: Tue, 5 Mar 2024 03:26:19 +0000 (+1100) Subject: ctdb-scripts: Reformat with "shfmt -w -p -i 0 -fn" X-Git-Tag: tdb-1.4.11~527 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=6ffb73bb55ef2c7a72426945e8a8595a5c8f3738;p=thirdparty%2Fsamba.git ctdb-scripts: Reformat with "shfmt -w -p -i 0 -fn" Best reviewed with "git show -w". Signed-off-by: Martin Schwenke Reviewed-by: Volker Lendecke --- diff --git a/ctdb/doc/examples/nfs-ganesha-callout b/ctdb/doc/examples/nfs-ganesha-callout index 0c21c47da9a..2c7e1fad85a 100755 --- a/ctdb/doc/examples/nfs-ganesha-callout +++ b/ctdb/doc/examples/nfs-ganesha-callout @@ -64,10 +64,9 @@ glusterfs) ;; esac - ################################################## -usage () +usage() { _c=$(basename "$0") cat < -check_ln () +check_ln() { - if [ ! -L "${2}" ] ; then + if [ ! -L "${2}" ]; then rm -vrf "${2}" else _t=$(readlink "${2}") - if [ "$_t" != "${1}" ] ; then + if [ "$_t" != "${1}" ]; then rm -v "${2}" fi fi @@ -161,7 +163,7 @@ check_ln () } # Return 'active' if the shared filesystem is accessible. -get_cluster_fs_state () +get_cluster_fs_state() { case $state_fs in gpfs) @@ -178,7 +180,7 @@ get_cluster_fs_state () esac } -create_ganesha_recdirs () +create_ganesha_recdirs() { if ! _mounts=$(mount | grep "$state_fs"); then echo "Failed to find mounts of type $state_fs" @@ -197,7 +199,7 @@ create_ganesha_recdirs () check_ln "$_link_dst" "$GANRECDIR" ;; glusterfs) - [ -d /var/lib/nfs.backup ] || \ + [ -d /var/lib/nfs.backup ] || mv /var/lib/nfs /var/lib/nfs.backup check_ln "$NODESTATEDIR" /var/lib/nfs @@ -210,40 +212,41 @@ create_ganesha_recdirs () mkdir -p "$GANSTATEDIR" check_ln "$NODESTATEDIR" "$NODESTATELN" - for _dir in "${GANSTATEDIR}/"* ; do + for _dir in "${GANSTATEDIR}/"*; do # Handle no directories case - if [ ! -d "$_dir" ] ; then + if [ ! -d "$_dir" ]; then break fi _node="${_dir##*/}" # basename if [ "${_node}" != "${host}" ]; then check_ln "${GANSTATEDIR}/${_node}/ganesha" \ - "${NODESTATEDIR}/ganesha/${_node}" + "${NODESTATEDIR}/ganesha/${_node}" check_ln "${GANSTATEDIR}/${_node}/statd" \ - "${NODESTATEDIR}/statd/${_node}" + "${NODESTATEDIR}/statd/${_node}" fi done ;; esac } -service_check () +service_check() { create_ganesha_recdirs # Always succeed if cluster filesystem is not active _cluster_fs_state=$(get_cluster_fs_state) - if [ "$_cluster_fs_state" != "active" ] ; then + if [ "$_cluster_fs_state" != "active" ]; then return 0 fi # Check that NFS Ganesha is running, according to PID file _pidfile="/var/run/ganesha.pid" _ganesha="/usr/bin/ganesha.nfsd" - if ! { read -r _pid < "$_pidfile" && \ - grep "$_ganesha" "${procfs}/${_pid}/cmdline" ; } >/dev/null 2>&1 - then + if ! { + read -r _pid <"$_pidfile" && + grep "$_ganesha" "${procfs}/${_pid}/cmdline" + } >/dev/null 2>&1; then echo "ERROR: NFS Ganesha not running according to PID file" return 1 @@ -280,11 +283,11 @@ nfs_releaseip() grace_period "2:${_ip}" } -nfs_takeip () +nfs_takeip() { _ip="$2" - case $state_fs in + case $state_fs in glusterfs) check_ln "$NODESTATEDIR" "${GANSTATEDIR}/${_ip}" ;; @@ -296,12 +299,12 @@ nfs_takeip () ################################################## # service init startup and final shutdown -nfs_shutdown () +nfs_shutdown() { basic_stop "nfs" } -nfs_startup () +nfs_startup() { basic_stop "nfs" || true @@ -309,7 +312,7 @@ nfs_startup () basic_start "nfs" _f="${procfs}/sys/net/ipv4/tcp_tw_recycle" - if [ -f "$_f" ] ; then + if [ -f "$_f" ]; then echo 1 >"$_f" fi } @@ -317,7 +320,7 @@ nfs_startup () ################################################## # list share directories -nfs_monitor_list_shares () +nfs_monitor_list_shares() { grep Path "$nfs_exports_file" | cut -f2 -d\" | @@ -326,7 +329,7 @@ nfs_monitor_list_shares () ################################################## -nfs_register () +nfs_register() { cat <