fix some small problems
* change options for sshs * run sshs only when server is reachable * change echo to logging * fix loadagent to abort, when af is empty
This commit is contained in:
parent
6d8e79c8bc
commit
5ea9128a28
1 changed files with 6 additions and 4 deletions
10
functions.sh
10
functions.sh
|
@ -346,6 +346,7 @@ EOF
|
|||
sshs() {
|
||||
ENTRY
|
||||
|
||||
|
||||
local LOGLEVEL="WARN"
|
||||
# MKTMPCMD='mktemp $(echo ${XDG_RUNTIME_DIR}/bashrc.XXXXXXXX.conf)'
|
||||
# VIMMKTMPCMD="mktemp ${XDG_RUNTIME_DIR}/vimrc.XXXXXXXX.conf"
|
||||
|
@ -363,9 +364,10 @@ sshs() {
|
|||
done
|
||||
fi
|
||||
logdebug "FILELIST: $FILELIST"
|
||||
local SSH_OPTS="-o VisualHostKey=no -o ControlMaster=auto -o ControlPersist=15s -o ControlPath=~/.ssh/ssh-%C"
|
||||
local SSH_OPTS="-o VisualHostKey=no -o ControlMaster=auto -o ControlPersist=2s -o ControlPath=~/.ssh/master-%C"
|
||||
#local SSH_OPTS="-o VisualHostKey=no -o ControlMaster=yes -o ControlPersist=10s -o ControlPath=~/.ssh/ssh-%C"
|
||||
# Read /etc/bashrc or /etc/bash.bashrc (depending on distribution) and /etc/profile.d/*.sh first
|
||||
ssh -T ${SSH_OPTS} $@ "pwd" >/dev/null 2>/dev/null || { logerror "Server $@ not reachable -> exit"; return 1; }
|
||||
cat << EOF >> "${TMPBASHCONFIG}"
|
||||
[ -e /etc/bashrc ] && BASHRC=/etc/bashrc
|
||||
[ -e /etc/bash.bashrc ] && BASHRC=/etc/bash.bashrc
|
||||
|
@ -490,7 +492,7 @@ vim-repair-vundle () {
|
|||
getbashrcfile () {
|
||||
ENTRY
|
||||
if [ -z ${BASHRC+x} ] ; then
|
||||
echo "bash uses default" >&2
|
||||
loginfo "bash uses default"
|
||||
else
|
||||
cat /proc/$$/cmdline | xargs -0 echo|awk '{print $3}'
|
||||
fi
|
||||
|
@ -500,7 +502,7 @@ getbashrcfile () {
|
|||
catbashrcfile () {
|
||||
ENTRY
|
||||
if [ -z ${BASHRC+x} ] ; then
|
||||
echo "bash uses default" >&2
|
||||
loginfo "bash uses default"
|
||||
else
|
||||
#cat $(cat /proc/$$/cmdline | xargs -0 echo|awk '{print $3}')
|
||||
cat $(getbashrcfile)
|
||||
|
@ -879,7 +881,7 @@ loadagent() {
|
|||
af=$(startagent --create-only $1 )
|
||||
loginfo "Load agent from $af"
|
||||
unset SSH_AUTH_SOCKET SSH_AGENT_PID
|
||||
eval $(<$af)
|
||||
[ -n "${af+x}" ] && eval $(<$af)
|
||||
logdebug "SSH_AUTH_SOCK: ${SSH_AUTH_SOCK-not set}"
|
||||
logdebug "SSH_AGENT_PID: ${SSH_AGENT_PID-not set}"
|
||||
loginfo "currently loaded keys in agent:
|
||||
|
|
Loading…
Reference in a new issue