rbucmd: start ssh-agent only if there isn't one running already
This commit is contained in:
parent
50cd17d821
commit
52f2d20dbc
@ -32,7 +32,7 @@ while getopts cl: flag; do
|
||||
*) usage
|
||||
esac
|
||||
done
|
||||
shift $((OPTIND - 1))
|
||||
shift $(($OPTIND - 1))
|
||||
if [ $# -ne 2 ] || [ -z "$1" ] || [ -z "$2" ]; then
|
||||
usage
|
||||
fi
|
||||
@ -41,8 +41,10 @@ backup_name=$2
|
||||
|
||||
[ -f "$host/bulist" ] || err "no bulist present in \"$h/\""
|
||||
|
||||
eval $(ssh-agent -s)
|
||||
trap 'eval $(ssh-agent -ks)' EXIT INT QUIT TERM
|
||||
if [ -z "$SSH_AUTH_SOCK" ] || [ ! -S "$SSH_AUTH_SOCK" ]; then
|
||||
eval $(ssh-agent -s)
|
||||
trap 'eval $(ssh-agent -ks)' EXIT INT QUIT TERM
|
||||
fi
|
||||
|
||||
set -e
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user