change default loglevel, change output
This commit is contained in:
parent
9f300e6a5a
commit
0e3cb1501b
2 changed files with 29 additions and 29 deletions
|
@ -52,8 +52,8 @@ if [[ $- = *i* ]] ; then
|
||||||
# Logging
|
# Logging
|
||||||
[ -z "${MYSHELLCONFIG_LOGDIR+x}" ] && export MYSHELLCONFIG_LOGDIR="${HOME}/logs"
|
[ -z "${MYSHELLCONFIG_LOGDIR+x}" ] && export MYSHELLCONFIG_LOGDIR="${HOME}/logs"
|
||||||
[ -z "${MYSHELLCONFIG_LOGFILE+x}" ] && export MYSHELLCONFIG_LOGFILE="${MYSHELLCONFIG_LOGDIR}/myshellconfig.log"
|
[ -z "${MYSHELLCONFIG_LOGFILE+x}" ] && export MYSHELLCONFIG_LOGFILE="${MYSHELLCONFIG_LOGDIR}/myshellconfig.log"
|
||||||
[ -z "${MYHSELLCONFIG_LOGLEVEL_DEFAULT+x}" ] && export MYHSELLCONFIG_LOGLEVEL_DEFAULT="WARN"
|
[ -z "${MYHSELLCONFIG_LOGLEVEL_DEFAULT+x}" ] && export MYHSELLCONFIG_LOGLEVEL_DEFAULT="INFO"
|
||||||
[ -z "${MYHSELLCONFIG_FILELOGLEVEL_DEFAULT+x}" ] && export MYHSELLCONFIG_FILELOGLEVEL_DEFAULT="WARN"
|
[ -z "${MYHSELLCONFIG_FILELOGLEVEL_DEFAULT+x}" ] && export MYHSELLCONFIG_FILELOGLEVEL_DEFAULT="INFO"
|
||||||
[ -z "${SCRIPT_LOG+x}" ] && { SCRIPT_LOG="${MYSHELLCONFIG_LOGFILE}"; export SCRIPT_LOG; }
|
[ -z "${SCRIPT_LOG+x}" ] && { SCRIPT_LOG="${MYSHELLCONFIG_LOGFILE}"; export SCRIPT_LOG; }
|
||||||
[ -z "${LOGLEVEL_DEFAULT+x}" ] && { LOGLEVEL_DEFAULT="${MYHSELLCONFIG_LOGLEVEL_DEFAULT-INFO}"; export LOGLEVEL_DEFAULT; }
|
[ -z "${LOGLEVEL_DEFAULT+x}" ] && { LOGLEVEL_DEFAULT="${MYHSELLCONFIG_LOGLEVEL_DEFAULT-INFO}"; export LOGLEVEL_DEFAULT; }
|
||||||
[ -z "${FILELOGLEVEL_DEFAULT+x}" ] && { FILELOGLEVEL_DEFAULT=${MYHSELLCONFIG_FILELOGLEVEL_DEFAULT-INFO}; export FILELOGLEVEL_DEFAULT; }
|
[ -z "${FILELOGLEVEL_DEFAULT+x}" ] && { FILELOGLEVEL_DEFAULT=${MYHSELLCONFIG_FILELOGLEVEL_DEFAULT-INFO}; export FILELOGLEVEL_DEFAULT; }
|
||||||
|
|
|
@ -141,8 +141,8 @@ agent-start-or-restart () {
|
||||||
logtrace "agentsocket: $agentsocket"
|
logtrace "agentsocket: $agentsocket"
|
||||||
logdebug "SSH_AGENT_OPTIONS: $SSH_AGENT_OPTIONS"
|
logdebug "SSH_AGENT_OPTIONS: $SSH_AGENT_OPTIONS"
|
||||||
if (! $keyonly && ! $tokenonly ) && $remove ; then
|
if (! $keyonly && ! $tokenonly ) && $remove ; then
|
||||||
loginfo "delete keys and tokens in ssh-agent $agentsocket"
|
logdebug "delete keys and tokens in ssh-agent $agentsocket"
|
||||||
loginfo "$(ssh-runinagent $agentfile ssh-add -D 2>&1)"
|
logdebug "$(ssh-runinagent $agentfile ssh-add -D 2>&1)"
|
||||||
createonly=true
|
createonly=true
|
||||||
|
|
||||||
else
|
else
|
||||||
|
@ -155,29 +155,29 @@ agent-start-or-restart () {
|
||||||
logtrace "$msg"
|
logtrace "$msg"
|
||||||
case $ret in
|
case $ret in
|
||||||
0)
|
0)
|
||||||
loginfo "agent is running"
|
logdebug "agent is running"
|
||||||
;;
|
;;
|
||||||
1)
|
1)
|
||||||
loginfo "agent is running, but:"
|
logdebug "agent is running, but:"
|
||||||
logwarn "$msg"
|
logwarn "$msg"
|
||||||
;;
|
;;
|
||||||
2)
|
2)
|
||||||
loginfo "former agent is not running -> start it"
|
logdebug "former agent is not running -> start it"
|
||||||
[ -e $agentsocket ] && { logdebug -n "remove socketfile: $( rm -v "$agentsocket" )"; }
|
[ -e $agentsocket ] && { logdebug -n "remove socketfile: $( rm -v "$agentsocket" )"; }
|
||||||
logdebug "$(ssh-agent -a $agentsocket ${SSH_AGENT_OPTIONS} > $agentfile )"
|
logtrace "$(ssh-agent -a $agentsocket ${SSH_AGENT_OPTIONS} > $agentfile )"
|
||||||
loginfo "agent started"
|
logdebug "agent started"
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
else
|
else
|
||||||
loginfo "agent did not exist -> create it"
|
logdebug "agent did not exist -> create it"
|
||||||
logdebug "ssh-agent -a $agentsocket \> $agentfile"
|
logtrace "ssh-agent -a $agentsocket \> $agentfile"
|
||||||
logdebug "$(ssh-agent -a $agentsocket $SSH_AGENT_OPTIONS > $agentfile )"
|
logtrace "$(ssh-agent -a $agentsocket $SSH_AGENT_OPTIONS > $agentfile )"
|
||||||
loginfo "agent started"
|
logdebug "agent started"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
logdebug "ssh-agent for identity »$ssh_identity«: $agentfile"
|
logdebug "ssh-agent for identity »$ssh_identity«: $agentfile"
|
||||||
$createonly && logdebug "current loaded keys after action:
|
$createonly && logtrace "current loaded keys after action:
|
||||||
$(ssh-runinagent $agentfile ssh-add -l)"
|
$(ssh-runinagent $agentfile ssh-add -l)"
|
||||||
echo $agentfile
|
echo $agentfile
|
||||||
ret=0
|
ret=0
|
||||||
|
@ -189,7 +189,7 @@ $(ssh-runinagent $agentfile ssh-add -l)"
|
||||||
else
|
else
|
||||||
|
|
||||||
if which gnome-keyring-daemon >/dev/null 2>&1; then
|
if which gnome-keyring-daemon >/dev/null 2>&1; then
|
||||||
loginfo "no identity given -> gnome-keyrings ssh-agent"
|
logdebug "no identity given -> gnome-keyrings ssh-agent"
|
||||||
agentfile="${SSH_AGENTS_DIR}/agent-gnome_session-$(hostname)"
|
agentfile="${SSH_AGENTS_DIR}/agent-gnome_session-$(hostname)"
|
||||||
agentsocket="${SSH_AGENT_SOCKETS_DIR}/socket-gnome-session-$(hostname)"
|
agentsocket="${SSH_AGENT_SOCKETS_DIR}/socket-gnome-session-$(hostname)"
|
||||||
gnome-keyring-daemon -s > $agentfile
|
gnome-keyring-daemon -s > $agentfile
|
||||||
|
@ -245,15 +245,15 @@ agent-load-identity-keys () {
|
||||||
if [[ ${fingerprints[*]} =~ "$fingerprint" ]]; then
|
if [[ ${fingerprints[*]} =~ "$fingerprint" ]]; then
|
||||||
logdebug "key: $(basename $key) (with fp $fingerprint) is loaded"
|
logdebug "key: $(basename $key) (with fp $fingerprint) is loaded"
|
||||||
if $readd || $remove ; then
|
if $readd || $remove ; then
|
||||||
$readd && loginfo "re-add key $key"
|
$readd && logdebug "re-add key $key"
|
||||||
$remove && loginfo "remove key $key"
|
$remove && logdebug "remove key $key"
|
||||||
loginfo "$(ssh-runinagent $agentfile ssh-add ${SSH_ADD_OPTIONS} -d ${key} 2>&1)"
|
logdebug "$(ssh-runinagent $agentfile ssh-add ${SSH_ADD_OPTIONS} -d ${key} 2>&1)"
|
||||||
$remove || loginfo "$(ssh-runinagent $agentfile ssh-add ${SSH_ADD_OPTIONS} ${key} 2>&1)"
|
$remove || logdebug "$(ssh-runinagent $agentfile ssh-add ${SSH_ADD_OPTIONS} ${key} 2>&1)"
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
loginfo "key: $key is not loaded -> load it"
|
logdebug "key: $key is not loaded -> load it"
|
||||||
#loginfo "$(ssh-runinagent $agentfile ssh-add ${SSH_ADD_OPTIONS} -d ${key} 2>&1)"
|
#logdebug "$(ssh-runinagent $agentfile ssh-add ${SSH_ADD_OPTIONS} -d ${key} 2>&1)"
|
||||||
$remove || loginfo "$(ssh-runinagent $agentfile ssh-add ${SSH_ADD_OPTIONS} ${key} 2>&1)"
|
$remove || logdebug "$(ssh-runinagent $agentfile ssh-add ${SSH_ADD_OPTIONS} ${key} 2>&1)"
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
fi
|
fi
|
||||||
|
@ -263,15 +263,15 @@ agent-load-identity-keys () {
|
||||||
if [[ ${fingerprints[*]} =~ "$tokenfingerprint" ]]; then
|
if [[ ${fingerprints[*]} =~ "$tokenfingerprint" ]]; then
|
||||||
logdebug "token: $key ($fingerprint) is loaded"
|
logdebug "token: $key ($fingerprint) is loaded"
|
||||||
if $readd || $remove ; then
|
if $readd || $remove ; then
|
||||||
$readd && loginfo "re-add token $key"
|
$readd && logdebug "re-add token $key"
|
||||||
$remove && loginfo "remove token $key"
|
$remove && logdebug "remove token $key"
|
||||||
loginfo "$(ssh-runinagent $agentfile ssh-add ${SSH_ADD_OPTIONS} -e ${key} 2>&1)"
|
logdebug "$(ssh-runinagent $agentfile ssh-add ${SSH_ADD_OPTIONS} -e ${key} 2>&1)"
|
||||||
$remove || loginfo "$(ssh-runinagent $agentfile ssh-add ${SSH_ADD_OPTIONS} -s ${key} 2>&1)"
|
$remove || logdebug "$(ssh-runinagent $agentfile ssh-add ${SSH_ADD_OPTIONS} -s ${key} 2>&1)"
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
loginfo "token: $key is not loaded -> load it"
|
logdebug "token: $key is not loaded -> load it"
|
||||||
loginfo "$(ssh-runinagent $agentfile ssh-add ${SSH_ADD_OPTIONS} -e ${key} 2>&1)"
|
logdebug "$(ssh-runinagent $agentfile ssh-add ${SSH_ADD_OPTIONS} -e ${key} 2>&1)"
|
||||||
$remove || loginfo "$(ssh-runinagent $agentfile ssh-add ${SSH_ADD_OPTIONS} -s ${key} 2>&1)"
|
$remove || logdebug "$(ssh-runinagent $agentfile ssh-add ${SSH_ADD_OPTIONS} -s ${key} 2>&1)"
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
fi
|
fi
|
||||||
|
|
Loading…
Reference in a new issue