add user-timeout, move set timouts to load_default

This commit is contained in:
Jakobus Schürz 2020-03-12 10:39:22 +01:00
parent d68a65338f
commit 81793e06c3
2 changed files with 6 additions and 3 deletions

View file

@ -11,7 +11,8 @@ if [[ $- = *i* ]] ; then
#echo "interactive shell" >&2 #echo "interactive shell" >&2
# define variables # define variables
[ -z "${MYSHELLCONFIIG_ROOT_TMOUT+x}" ] && MYSHELLCONFIIG_ROOT_TMOUT=0 [ -z "${MYSHELLCONFIIG_ROOT_TMOUT+x}" ] && MYSHELLCONFIIG_ROOT_TMOUT=500
[ -z "${MYSHELLCONFIIG_USER_TMOUT+x}" ] && MYSHELLCONFIIG_USER_TMOUT=0
[ -z "${USERNAME+x}" ] && USERNAME="$USER" [ -z "${USERNAME+x}" ] && USERNAME="$USER"
[ -z "${USEREMAIL+x}" ] && USEREMAIL="$USER@$(domainname -f)" [ -z "${USEREMAIL+x}" ] && USEREMAIL="$USER@$(domainname -f)"
[ -z "${FULLNAME+x}" ] && FULLNAME="$(getent passwd $USER | cut -d ":" -f 5 | cut -d ',' -f 1)" [ -z "${FULLNAME+x}" ] && FULLNAME="$(getent passwd $USER | cut -d ":" -f 5 | cut -d ',' -f 1)"
@ -33,8 +34,6 @@ if [[ $- = *i* ]] ; then
SGIT="git -C ${MYSHELLCONFIG_BASE}" SGIT="git -C ${MYSHELLCONFIG_BASE}"
export MYSHELLCONFIG_BASE MYSHELLCONFIG_LOGDIR MYSHELLCONFIG_LOGFILE SGIT MYSHELLCONFIG_VIM_PLUGINS export MYSHELLCONFIG_BASE MYSHELLCONFIG_LOGDIR MYSHELLCONFIG_LOGFILE SGIT MYSHELLCONFIG_VIM_PLUGINS
# if we are root, exit after 5 Minutes
[ $( id -u ) -eq 0 ] && TMOUT=${MYSHELLCONFIIG_ROOT_TMOUT}
cat << EOF >> "${MYSHELLCONFIG_LOGFILE}" cat << EOF >> "${MYSHELLCONFIG_LOGFILE}"
------- start -------------- $(date) ---------------8<-- ------- start -------------- $(date) ---------------8<--

View file

@ -1,5 +1,9 @@
#!/bin/bash #!/bin/bash
# if we are root, exit after 5 Minutes
[ $( id -u ) -eq 0 ] && TMOUT=${MYSHELLCONFIIG_ROOT_TMOUT}
[ $( id -u ) -gt 0 ] && TMOUT=${MYSHELLCONFIIG_USER_TMOUT}
# Load default values, functions, aliases for myshellconfig # Load default values, functions, aliases for myshellconfig
if ! $SSHS; then if ! $SSHS; then
if [ -e ${MYSHELLCONFIG_BASE}/functions.sh ]; then if [ -e ${MYSHELLCONFIG_BASE}/functions.sh ]; then