mirror of
https://github.com/samba-team/samba.git
synced 2025-01-21 18:04:06 +03:00
ctdb-scripts: Update script boilerplate to avoid shellcheck warnings
* Assign the output of dirname to temporary variable to avoid word splitting when directory name contains whitespace * Drop export of CTDB_BASE to avoid masking broken return value - functions file does the export anyway * Quote path when including functions file Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
This commit is contained in:
parent
850863a15e
commit
f227c26178
@ -5,9 +5,9 @@
|
||||
#
|
||||
|
||||
[ -n "$CTDB_BASE" ] || \
|
||||
export CTDB_BASE=$(cd -P $(dirname "$0") ; echo "$PWD")
|
||||
CTDB_BASE=$(d=$(dirname "$0") ; cd -P "$d" ; dirname "$PWD")
|
||||
|
||||
. "$CTDB_BASE/functions"
|
||||
. "${CTDB_BASE}/functions"
|
||||
|
||||
# If ctdb is running, just exit
|
||||
if service ctdb status >/dev/null 2>&1 ; then
|
||||
|
@ -4,9 +4,9 @@
|
||||
# for other operating systems.
|
||||
|
||||
[ -n "$CTDB_BASE" ] || \
|
||||
export CTDB_BASE=$(cd -P $(dirname "$0") ; echo "$PWD")
|
||||
CTDB_BASE=$(d=$(dirname "$0") ; cd -P "$d" ; dirname "$PWD")
|
||||
|
||||
. "$CTDB_BASE/functions"
|
||||
. "${CTDB_BASE}/functions"
|
||||
|
||||
loadconfig ctdb
|
||||
|
||||
|
@ -8,9 +8,9 @@
|
||||
# rather than mutex locks.
|
||||
|
||||
[ -n "$CTDB_BASE" ] || \
|
||||
export CTDB_BASE=$(cd -P $(dirname "$0") ; echo "$PWD")
|
||||
CTDB_BASE=$(d=$(dirname "$0") ; cd -P "$d" ; dirname "$PWD")
|
||||
|
||||
. "$CTDB_BASE/functions"
|
||||
. "${CTDB_BASE}/functions"
|
||||
|
||||
# Default fallback location for database directories.
|
||||
# These can be overwritten from CTDB configuration
|
||||
|
@ -4,9 +4,10 @@
|
||||
# elsewhere.
|
||||
|
||||
[ -n "$CTDB_BASE" ] || \
|
||||
export CTDB_BASE=$(cd -P $(dirname "$0") ; dirname "$PWD")
|
||||
CTDB_BASE=$(d=$(dirname "$0") ; cd -P "$d" ; dirname "$PWD")
|
||||
|
||||
. "${CTDB_BASE}/functions"
|
||||
|
||||
. $CTDB_BASE/functions
|
||||
loadconfig
|
||||
|
||||
ctdb_setup_service_state_dir "ctdb"
|
||||
|
@ -2,9 +2,10 @@
|
||||
# script to check accessibility to the reclock file on a node
|
||||
|
||||
[ -n "$CTDB_BASE" ] || \
|
||||
export CTDB_BASE=$(cd -P $(dirname "$0") ; dirname "$PWD")
|
||||
CTDB_BASE=$(d=$(dirname "$0") ; cd -P "$d" ; dirname "$PWD")
|
||||
|
||||
. "${CTDB_BASE}/functions"
|
||||
|
||||
. $CTDB_BASE/functions
|
||||
loadconfig
|
||||
|
||||
# If CTDB_RECOVERY_LOCK specifies a helper then exit because this
|
||||
|
@ -2,9 +2,10 @@
|
||||
# ctdb event script for checking local file system utilization
|
||||
|
||||
[ -n "$CTDB_BASE" ] || \
|
||||
export CTDB_BASE=$(cd -P $(dirname "$0") ; dirname "$PWD")
|
||||
CTDB_BASE=$(d=$(dirname "$0") ; cd -P "$d" ; dirname "$PWD")
|
||||
|
||||
. "${CTDB_BASE}/functions"
|
||||
|
||||
. $CTDB_BASE/functions
|
||||
loadconfig
|
||||
|
||||
ctdb_setup_service_state_dir "system-monitoring"
|
||||
|
@ -2,9 +2,9 @@
|
||||
# script to manage nfs in a clustered environment
|
||||
|
||||
[ -n "$CTDB_BASE" ] || \
|
||||
export CTDB_BASE=$(cd -P $(dirname "$0") ; dirname "$PWD")
|
||||
CTDB_BASE=$(d=$(dirname "$0") ; cd -P "$d" ; dirname "$PWD")
|
||||
|
||||
. $CTDB_BASE/functions
|
||||
. "${CTDB_BASE}/functions"
|
||||
|
||||
service_name="nfs"
|
||||
loadconfig
|
||||
|
@ -8,9 +8,10 @@
|
||||
# * For connection tracking/killing to work this script must be enabled.
|
||||
|
||||
[ -n "$CTDB_BASE" ] || \
|
||||
export CTDB_BASE=$(cd -P $(dirname "$0") ; dirname "$PWD")
|
||||
CTDB_BASE=$(d=$(dirname "$0") ; cd -P "$d" ; dirname "$PWD")
|
||||
|
||||
. "${CTDB_BASE}/functions"
|
||||
|
||||
. $CTDB_BASE/functions
|
||||
loadconfig
|
||||
|
||||
if [ -z "$CTDB_PUBLIC_ADDRESSES" ] ; then
|
||||
|
@ -6,9 +6,10 @@
|
||||
# public interface
|
||||
|
||||
[ -n "$CTDB_BASE" ] || \
|
||||
export CTDB_BASE=$(cd -P $(dirname "$0") ; dirname "$PWD")
|
||||
CTDB_BASE=$(d=$(dirname "$0") ; cd -P "$d" ; dirname "$PWD")
|
||||
|
||||
. "${CTDB_BASE}/functions"
|
||||
|
||||
. $CTDB_BASE/functions
|
||||
loadconfig
|
||||
|
||||
[ -z "$CTDB_PUBLIC_ADDRESSES" ] && {
|
||||
|
@ -6,9 +6,9 @@
|
||||
#
|
||||
|
||||
[ -n "$CTDB_BASE" ] || \
|
||||
export CTDB_BASE=$(cd -P $(dirname "$0") ; dirname "$PWD")
|
||||
CTDB_BASE=$(d=$(dirname "$0") ; cd -P "$d" ; dirname "$PWD")
|
||||
|
||||
. $CTDB_BASE/functions
|
||||
. "${CTDB_BASE}/functions"
|
||||
|
||||
service_name=natgw
|
||||
|
||||
|
@ -18,9 +18,10 @@
|
||||
# bond1 10.3.3.0/24 10.0.0.1
|
||||
|
||||
[ -n "$CTDB_BASE" ] || \
|
||||
export CTDB_BASE=$(cd -P $(dirname "$0") ; dirname "$PWD")
|
||||
CTDB_BASE=$(d=$(dirname "$0") ; cd -P "$d" ; dirname "$PWD")
|
||||
|
||||
. "${CTDB_BASE}/functions"
|
||||
|
||||
. $CTDB_BASE/functions
|
||||
loadconfig
|
||||
|
||||
[ -f $CTDB_BASE/static-routes ] || {
|
||||
|
@ -1,9 +1,10 @@
|
||||
#!/bin/sh
|
||||
|
||||
[ -n "$CTDB_BASE" ] || \
|
||||
export CTDB_BASE=$(cd -P $(dirname "$0") ; dirname "$PWD")
|
||||
CTDB_BASE=$(d=$(dirname "$0") ; cd -P "$d" ; dirname "$PWD")
|
||||
|
||||
. "${CTDB_BASE}/functions"
|
||||
|
||||
. $CTDB_BASE/functions
|
||||
loadconfig
|
||||
|
||||
service_name=per_ip_routing
|
||||
|
@ -7,13 +7,13 @@
|
||||
#
|
||||
|
||||
[ -n "$CTDB_BASE" ] || \
|
||||
export CTDB_BASE=$(cd -P $(dirname "$0") ; dirname "$PWD")
|
||||
CTDB_BASE=$(d=$(dirname "$0") ; cd -P "$d" ; dirname "$PWD")
|
||||
|
||||
. $CTDB_BASE/functions
|
||||
. "${CTDB_BASE}/functions"
|
||||
|
||||
service_name="multipathd"
|
||||
|
||||
loadconfig
|
||||
loadconfig
|
||||
|
||||
[ -n "$CTDB_MONITOR_MPDEVICES" ] || exit 0
|
||||
|
||||
|
@ -2,9 +2,9 @@
|
||||
# event script to manage clamd in a cluster environment
|
||||
|
||||
[ -n "$CTDB_BASE" ] || \
|
||||
export CTDB_BASE=$(cd -P $(dirname "$0") ; dirname "$PWD")
|
||||
CTDB_BASE=$(d=$(dirname "$0") ; cd -P "$d" ; dirname "$PWD")
|
||||
|
||||
. $CTDB_BASE/functions
|
||||
. "${CTDB_BASE}/functions"
|
||||
|
||||
detect_init_style
|
||||
|
||||
|
@ -2,9 +2,9 @@
|
||||
# event strict to manage vsftpd in a cluster environment
|
||||
|
||||
[ -n "$CTDB_BASE" ] || \
|
||||
export CTDB_BASE=$(cd -P $(dirname "$0") ; dirname "$PWD")
|
||||
CTDB_BASE=$(d=$(dirname "$0") ; cd -P "$d" ; dirname "$PWD")
|
||||
|
||||
. $CTDB_BASE/functions
|
||||
. "${CTDB_BASE}/functions"
|
||||
|
||||
service_name="vsftpd"
|
||||
# make sure the service is stopped first
|
||||
|
@ -2,9 +2,9 @@
|
||||
# event script to manage httpd in a cluster environment
|
||||
|
||||
[ -n "$CTDB_BASE" ] || \
|
||||
export CTDB_BASE=$(cd -P $(dirname "$0") ; dirname "$PWD")
|
||||
CTDB_BASE=$(d=$(dirname "$0") ; cd -P "$d" ; dirname "$PWD")
|
||||
|
||||
. $CTDB_BASE/functions
|
||||
. "${CTDB_BASE}/functions"
|
||||
|
||||
detect_init_style
|
||||
|
||||
|
@ -2,9 +2,9 @@
|
||||
# ctdb event script for winbind
|
||||
|
||||
[ -n "$CTDB_BASE" ] || \
|
||||
export CTDB_BASE=$(cd -P $(dirname "$0") ; dirname "$PWD")
|
||||
CTDB_BASE=$(d=$(dirname "$0") ; cd -P "$d" ; dirname "$PWD")
|
||||
|
||||
. $CTDB_BASE/functions
|
||||
. "${CTDB_BASE}/functions"
|
||||
|
||||
CTDB_SERVICE_WINBIND=${CTDB_SERVICE_WINBIND:-winbind}
|
||||
|
||||
|
@ -2,9 +2,9 @@
|
||||
# ctdb event script for Samba
|
||||
|
||||
[ -n "$CTDB_BASE" ] || \
|
||||
export CTDB_BASE=$(cd -P $(dirname "$0") ; dirname "$PWD")
|
||||
CTDB_BASE=$(d=$(dirname "$0") ; cd -P "$d" ; dirname "$PWD")
|
||||
|
||||
. $CTDB_BASE/functions
|
||||
. "${CTDB_BASE}/functions"
|
||||
|
||||
detect_init_style
|
||||
|
||||
|
@ -2,9 +2,9 @@
|
||||
# script to manage nfs in a clustered environment
|
||||
|
||||
[ -n "$CTDB_BASE" ] || \
|
||||
export CTDB_BASE=$(cd -P $(dirname "$0") ; dirname "$PWD")
|
||||
CTDB_BASE=$(d=$(dirname "$0") ; cd -P "$d" ; dirname "$PWD")
|
||||
|
||||
. $CTDB_BASE/functions
|
||||
. "${CTDB_BASE}/functions"
|
||||
|
||||
service_name="nfs"
|
||||
loadconfig
|
||||
|
@ -3,9 +3,9 @@
|
||||
# CTDB event script for TGTD based iSCSI
|
||||
|
||||
[ -n "$CTDB_BASE" ] || \
|
||||
export CTDB_BASE=$(cd -P $(dirname "$0") ; dirname "$PWD")
|
||||
CTDB_BASE=$(d=$(dirname "$0") ; cd -P "$d" ; dirname "$PWD")
|
||||
|
||||
. $CTDB_BASE/functions
|
||||
. "${CTDB_BASE}/functions"
|
||||
|
||||
service_name="iscsi"
|
||||
|
||||
|
@ -2,9 +2,9 @@
|
||||
# script to manage the lvs ip multiplexer for a single public address cluster
|
||||
|
||||
[ -n "$CTDB_BASE" ] || \
|
||||
export CTDB_BASE=$(cd -P $(dirname "$0") ; dirname "$PWD")
|
||||
CTDB_BASE=$(d=$(dirname "$0") ; cd -P "$d" ; dirname "$PWD")
|
||||
|
||||
. $CTDB_BASE/functions
|
||||
. "${CTDB_BASE}/functions"
|
||||
|
||||
loadconfig ctdb
|
||||
|
||||
|
@ -5,9 +5,10 @@
|
||||
# the event timeout mechanism.
|
||||
|
||||
[ -n "$CTDB_BASE" ] || \
|
||||
export CTDB_BASE=$(cd -P $(dirname "$0") ; dirname "$PWD")
|
||||
CTDB_BASE=$(d=$(dirname "$0") ; cd -P "$d" ; dirname "$PWD")
|
||||
|
||||
. "${CTDB_BASE}/functions"
|
||||
|
||||
. $CTDB_BASE/functions
|
||||
loadconfig ctdb
|
||||
|
||||
[ "$CTDB_RUN_TIMEOUT_MONITOR" = "yes" ] || exit 0
|
||||
|
@ -9,9 +9,9 @@
|
||||
# STATD_HOSTNAME="myhostname -H /etc/ctdb/statd-callout"
|
||||
|
||||
[ -n "$CTDB_BASE" ] || \
|
||||
export CTDB_BASE=$(cd -P $(dirname "$0") ; echo "$PWD")
|
||||
CTDB_BASE=$(d=$(dirname "$0") ; cd -P "$d" ; dirname "$PWD")
|
||||
|
||||
. $CTDB_BASE/functions
|
||||
. "${CTDB_BASE}/functions"
|
||||
|
||||
# Overwrite this so we get some logging
|
||||
die ()
|
||||
|
Loading…
x
Reference in New Issue
Block a user