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
|
*) usage
|
||||||
esac
|
esac
|
||||||
done
|
done
|
||||||
shift $((OPTIND - 1))
|
shift $(($OPTIND - 1))
|
||||||
if [ $# -ne 2 ] || [ -z "$1" ] || [ -z "$2" ]; then
|
if [ $# -ne 2 ] || [ -z "$1" ] || [ -z "$2" ]; then
|
||||||
usage
|
usage
|
||||||
fi
|
fi
|
||||||
@ -41,8 +41,10 @@ backup_name=$2
|
|||||||
|
|
||||||
[ -f "$host/bulist" ] || err "no bulist present in \"$h/\""
|
[ -f "$host/bulist" ] || err "no bulist present in \"$h/\""
|
||||||
|
|
||||||
eval $(ssh-agent -s)
|
if [ -z "$SSH_AUTH_SOCK" ] || [ ! -S "$SSH_AUTH_SOCK" ]; then
|
||||||
trap 'eval $(ssh-agent -ks)' EXIT INT QUIT TERM
|
eval $(ssh-agent -s)
|
||||||
|
trap 'eval $(ssh-agent -ks)' EXIT INT QUIT TERM
|
||||||
|
fi
|
||||||
|
|
||||||
set -e
|
set -e
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user