mirror of
https://github.com/samba-team/samba.git
synced 2025-02-23 09:57:40 +03:00
ctdb-scripts: Avoid shellcheck warning SC2039 (echo -n)
SC2039: In POSIX sh, echo flags are not supported. echo -n is well supported but the changes are simple. Improve some logic, replace some instances with printf. Who knew printf was in POSIX? Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
This commit is contained in:
parent
f43df8f0e9
commit
d7f3b1977f
@ -60,7 +60,7 @@ pidfile="${CTDB_PIDFILE:-/var/run/ctdb/ctdbd.pid}"
|
||||
|
||||
start()
|
||||
{
|
||||
echo -n "Starting ctdbd service: "
|
||||
printf "Starting ctdbd service: "
|
||||
|
||||
case "$CTDB_INIT_STYLE" in
|
||||
suse)
|
||||
@ -85,7 +85,7 @@ start()
|
||||
|
||||
stop()
|
||||
{
|
||||
echo -n "Shutting down ctdbd service: "
|
||||
printf "Shutting down ctdbd service: "
|
||||
|
||||
case "$CTDB_INIT_STYLE" in
|
||||
suse)
|
||||
|
@ -203,7 +203,7 @@ get_config_for_ip ()
|
||||
# that we get the maskbits as item #2 without further parsing.
|
||||
while IFS="/$IFS" read _i _maskbits _x ; do
|
||||
if [ "$_ip" = "$_i" ] ; then
|
||||
echo -n "$_ip "; ipv4_host_addr_to_net "$_ip" "$_maskbits"
|
||||
printf "%s" "$_ip "; ipv4_host_addr_to_net "$_ip" "$_maskbits"
|
||||
fi
|
||||
done <"${CTDB_PUBLIC_ADDRESSES:-/dev/null}"
|
||||
else
|
||||
|
@ -29,13 +29,15 @@ multipathd_check_background()
|
||||
# Check multipath knows about the device
|
||||
_out=$(multipath -ll "$_device")
|
||||
if [ -z "$_out" ] ; then
|
||||
echo "device \"${_device}\" not known to multipathd" >"$multipath_fail"
|
||||
echo "ERROR: device \"${_device}\" not known to multipathd" \
|
||||
>"$multipath_fail"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Check for at least 1 active path
|
||||
if ! echo "$_out" | grep 'prio=.* status=active' >/dev/null 2>&1 ; then
|
||||
echo "multipath device \"${_device}\" has no active paths" >"$multipath_fail"
|
||||
echo "ERROR: multipath device \"${_device}\" has no active paths" \
|
||||
>"$multipath_fail"
|
||||
exit 1
|
||||
fi
|
||||
done
|
||||
@ -58,7 +60,6 @@ multipathd_check()
|
||||
if wait $_pid ; then
|
||||
return 0
|
||||
else
|
||||
echo -n "ERROR: "
|
||||
cat "$multipath_fail"
|
||||
rm -f "$multipath_fail"
|
||||
return 1
|
||||
|
@ -769,8 +769,8 @@ ctdb_counter_init () {
|
||||
ctdb_counter_incr () {
|
||||
_ctdb_counter_common "$1"
|
||||
|
||||
# unary counting!
|
||||
echo -n 1 >> "$_counter_file"
|
||||
# unary counting using newlines!
|
||||
echo >>"$_counter_file"
|
||||
}
|
||||
ctdb_counter_get () {
|
||||
_ctdb_counter_common "$1"
|
||||
|
Loading…
x
Reference in New Issue
Block a user