[cluster] Test the existence of the hosts' list
We now test if the hosts' list file exists before to work on it.
This commit is contained in:
parent
3a505db37b
commit
0eeeab14fc
|
@ -94,6 +94,10 @@ HOSTS_LIST_NAME="$1"
|
|||
HOSTS="$HOME/.config/cluster/${HOSTS_LIST_NAME}.lst"
|
||||
shift
|
||||
echo "Using file '$HOSTS' as hosts' list."
|
||||
if [ ! -f "$HOSTS" ] ; then
|
||||
echo "The hosts' list file doesn't exist or is not a regular file."
|
||||
exit 3
|
||||
fi
|
||||
|
||||
# Login
|
||||
if [ "$LOGIN" != "" ] ; then
|
||||
|
|
|
@ -10,13 +10,19 @@
|
|||
#
|
||||
# Ping a list of remote hosts using fping.
|
||||
|
||||
# Check arguments
|
||||
if [ $# -ne 1 ] ; then
|
||||
echo "Usage: $0 <hosts_list>"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Hosts' list file
|
||||
HOSTS="$HOME/.config/cluster/$1.lst"
|
||||
shift
|
||||
echo "Using file '$HOSTS' as hosts' list."
|
||||
if [ ! -f "$HOSTS" ] ; then
|
||||
echo "The hosts' list file doesn't exist or is not a regular file."
|
||||
exit 2
|
||||
fi
|
||||
|
||||
# Go!
|
||||
exec fping $(cat "$HOSTS") 2>/dev/null
|
||||
|
|
|
@ -47,6 +47,10 @@ fi
|
|||
HOSTS="$HOME/.config/cluster/$1.lst"
|
||||
shift
|
||||
echo "Using file '$HOSTS' as hosts' list."
|
||||
if [ ! -f "$HOSTS" ] ; then
|
||||
echo "The hosts' list file doesn't exist or is not a regular file."
|
||||
exit 2
|
||||
fi
|
||||
|
||||
# Login
|
||||
if [ "$LOGIN" != "" ] ; then
|
||||
|
|
|
@ -38,6 +38,10 @@ fi
|
|||
HOSTS="$HOME/.config/cluster/$1.lst"
|
||||
shift
|
||||
echo "Using file '$HOSTS' as hosts' list."
|
||||
if [ ! -f "$HOSTS" ] ; then
|
||||
echo "The hosts' list file doesn't exist or is not a regular file."
|
||||
exit 2
|
||||
fi
|
||||
|
||||
# Login
|
||||
if [ "$LOGIN" != "" ] ; then
|
||||
|
|
Loading…
Reference in New Issue