[ssh_tools] Config is now in ~/.config/ssh_tools

Also removed references to "cluster" in code.
This commit is contained in:
Matteo Cypriani 2019-10-21 11:29:29 +02:00
parent 20b84f300e
commit a8b48a2771
5 changed files with 18 additions and 14 deletions

View File

@ -1 +1 @@
cluster-deploy: add option to set a destination directory.
multicopy: add option to set a destination directory.

View File

@ -1,6 +1,7 @@
#!/bin/sh
#
# cluster-deploy.sh, Copyright © 2013 Matteo Cypriani <mcy@lm7.fr>
# multicopy.sh, Copyright © 2013 Matteo Cypriani <mcy@lm7.fr>
# (Formerly named cluster-deploy.sh)
#
# This program is free software. It comes without any warranty, to
# the extent permitted by applicable law. You can redistribute it
@ -53,7 +54,7 @@ done
# Do we still have at least a host list and a file?
# Note: if the program was wrongly called but still has 2 arguments, for
# example with "cluster-deploy -l root -P my_file", it will try to use
# example with "multicopy -l root -P my_file", it will try to use
# "-P" as hosts' list and "my_file" as the file to be transfered.
if [ $# -lt 2 ] ; then
print_usage
@ -81,15 +82,15 @@ fi
# Check dependencies
PSCP=$(command -v parallel-scp || command -v pscp.pssh || command -v pscp)
PRSYNC=$(command -v parallel-rsync || command -v prsync)
CLUSTERPING=$(command -v cluster-ping)
MULTIPING=$(command -v multiping)
if [ -z "$RSYNC" ] && [ -z "$PSCP" ] ; then
echo "Parallel SSH (pssh) is required for this script to work."
exit 4
elif [ -z "$PRSYNC" ] ; then
echo "Parallel rsync (prsync) is required for this script to work."
exit 5
elif [ -z "$CLUSTERPING" ] ; then
echo "cluster-ping (which should have been provided along with this"
elif [ -z "$MULTIPING" ] ; then
echo "multiping (which should have been provided along with this"
echo "script) is required for this script to work."
exit 6
fi
@ -99,7 +100,7 @@ HOSTS_LIST_NAME="$1"
if [ -z "$XDG_CONFIG_HOME" ] ; then
XDG_CONFIG_HOME="$HOME/.config"
fi
HOSTS="$XDG_CONFIG_HOME/cluster/${HOSTS_LIST_NAME}.lst"
HOSTS="$XDG_CONFIG_HOME/ssh_tools/${HOSTS_LIST_NAME}.lst"
shift
echo "Using file '$HOSTS' as hosts' list."
if [ ! -f "$HOSTS" ] ; then
@ -116,7 +117,7 @@ fi
# Test the connection to the first host and get the destination
# directory (home directory of the remote user)
FIRST_HOST=$($CLUSTERPING "$HOSTS_LIST_NAME" 2>/dev/null \
FIRST_HOST=$($MULTIPING "$HOSTS_LIST_NAME" 2>/dev/null \
| sed -n "s/ is alive$//p" | head -n1)
if [ -z "$FIRST_HOST" ] ; then
echo "None of the remote hosts is alive."

View File

@ -1,6 +1,7 @@
#!/bin/sh
#
# cluster-ping.sh, Copyright © 2013 Matteo Cypriani <mcy@lm7.fr>
# multiping.sh, Copyright © 2013 Matteo Cypriani <mcy@lm7.fr>
# (Formerly named cluster-ping.sh)
#
# This program is free software. It comes without any warranty, to
# the extent permitted by applicable law. You can redistribute it
@ -20,7 +21,7 @@ fi
if [ -z "$XDG_CONFIG_HOME" ] ; then
XDG_CONFIG_HOME="$HOME/.config"
fi
HOSTS="$XDG_CONFIG_HOME/cluster/$1.lst"
HOSTS="$XDG_CONFIG_HOME/ssh_tools/$1.lst"
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."

View File

@ -1,6 +1,7 @@
#!/bin/sh
#
# cluster-run.sh, Copyright © 2013 Matteo Cypriani <mcy@lm7.fr>
# multissh.sh, Copyright © 2013 Matteo Cypriani <mcy@lm7.fr>
# (Formerly named cluster-run.sh)
#
# This program is free software. It comes without any warranty, to
# the extent permitted by applicable law. You can redistribute it
@ -47,7 +48,7 @@ fi
if [ -z "$XDG_CONFIG_HOME" ] ; then
XDG_CONFIG_HOME="$HOME/.config"
fi
HOSTS="$XDG_CONFIG_HOME/cluster/$1.lst"
HOSTS="$XDG_CONFIG_HOME/ssh_tools/$1.lst"
shift
echo "Using file '$HOSTS' as hosts' list."
if [ ! -f "$HOSTS" ] ; then

View File

@ -1,6 +1,7 @@
#!/bin/sh
#
# cluster-ssh.sh, Copyright © 2013 Matteo Cypriani <mcy@lm7.fr>
# tabssh.sh, Copyright © 2013 Matteo Cypriani <mcy@lm7.fr>
# (Formerly named cluster-ssh.sh)
#
# This program is free software. It comes without any warranty, to
# the extent permitted by applicable law. You can redistribute it
@ -38,7 +39,7 @@ fi
if [ -z "$XDG_CONFIG_HOME" ] ; then
XDG_CONFIG_HOME="$HOME/.config"
fi
HOSTS_FILE="$XDG_CONFIG_HOME/cluster/$1.lst"
HOSTS_FILE="$XDG_CONFIG_HOME/ssh_tools/$1.lst"
shift
echo "Using file '$HOSTS_FILE' as hosts' list."
if [ ! -f "$HOSTS_FILE" ] ; then