set timeout only if run in TTY
This commit is contained in:
parent
98b96b25e9
commit
04e217184d
2 changed files with 10 additions and 8 deletions
|
@ -10,12 +10,6 @@ if [ -z ${SSHS+x} ]; then SSHS=false;fi
|
||||||
if [[ $- = *i* ]] ; then
|
if [[ $- = *i* ]] ; then
|
||||||
#echo "interactive shell" >&2
|
#echo "interactive shell" >&2
|
||||||
|
|
||||||
case $(tty) in
|
|
||||||
/dev/tty[0-9]*)
|
|
||||||
echo "Run in TTY" ;;
|
|
||||||
*)
|
|
||||||
echo "Run in other terminal";;
|
|
||||||
esac
|
|
||||||
# define variables
|
# define variables
|
||||||
[ -z "${MYSHELLCONFIIG_ROOT_TMOUT+x}" ] && MYSHELLCONFIIG_ROOT_TMOUT=500
|
[ -z "${MYSHELLCONFIIG_ROOT_TMOUT+x}" ] && MYSHELLCONFIIG_ROOT_TMOUT=500
|
||||||
[ -z "${MYSHELLCONFIIG_USER_TMOUT+x}" ] && MYSHELLCONFIIG_USER_TMOUT=0
|
[ -z "${MYSHELLCONFIIG_USER_TMOUT+x}" ] && MYSHELLCONFIIG_USER_TMOUT=0
|
||||||
|
|
|
@ -1,8 +1,16 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
# if we are root, exit after 5 Minutes
|
# if we are root, exit after 5 Minutes
|
||||||
[ $( id -u ) -eq 0 ] && TMOUT=${MYSHELLCONFIIG_ROOT_TMOUT}
|
case $(tty) in
|
||||||
[ $( id -u ) -gt 0 ] && TMOUT=${MYSHELLCONFIIG_USER_TMOUT}
|
/dev/tty[0-9]*)
|
||||||
|
echo "Run in TTY -> set autologout \$TMOUT=$TMOUT" >&2
|
||||||
|
[ $( id -u ) -eq 0 ] && TMOUT=${MYSHELLCONFIIG_ROOT_TMOUT}
|
||||||
|
[ $( id -u ) -gt 0 ] && TMOUT=${MYSHELLCONFIIG_USER_TMOUT}
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
echo "Run in other terminal" >&2
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
# Load default values, functions, aliases for myshellconfig
|
# Load default values, functions, aliases for myshellconfig
|
||||||
if ! $SSHS; then
|
if ! $SSHS; then
|
||||||
|
|
Loading…
Reference in a new issue