Is there a way to setup the TTL (Time To Live) on a process. We have many ssh processes that seem to just stack up. These processes do not need a static connection all the time and it might cause problems on our servers. Does anybody know how to setup the TTL on a process?
There is "ulimit -t" but it uses CPU time, not clock time. Using it is however likely a wrong approach. You might first try understanding why these ssh processes do stack up in the first place.
I'm new to Solaris, how do I setup the "ulimit -t"?
"ulimit -t" is not Solaris specific. You set it that way:
$ ulimit -t 60
That would mean the process cannot exceed 1 minute of CPU time.
Note that it affects the shell where you set it and all its children processes.
This would affect all processes? Is there a way to just affect one process?
I didn't wrote that would affect all processes, only the shell where you set it and its own children processes. Another clarification: the limit is per process, not shared.
I'm a little confused. I need to set the value for just ssh processes in the shell. How would I do that?
Create a wrapper (eg: mySsh) setting this limit to a single ssh command:
#!/bin/ksh
ulimit -t 3600
ssh "$@"
I need to take baby steps. Where would I put this wrapper (eg: mySsh) and what does the
"$@"
mean? Also, is ther a way to see what the current ulimit is set?
Anywhere in your PATH.
all parameters
The default is unlimited:
ulimit -a
Here is a copy of my profile file:
server-root# cat profile
#ident "@(#)profile 1.18 98/10/03 SMI" /* SVr4.0 1.3 */
# The profile that all logins get before using their own .profile.
trap "" 2 3
export LOGNAME PATH
if [ "$TERM" = "" ]
then
if /bin/i386
then
TERM=sun-color
else
TERM=sun
fi
export TERM
fi
# Login and -su shells get /etc/profile services.
# -rsh is given its environment in its .profile.
case "$0" in
-sh | -ksh | -jsh)
if [ ! -f .hushlogin ]
then
# Allow the user to break the Message-Of-The-Day only.
trap "trap '' 2" 2
/bin/cat -s /etc/motd
trap "" 2
fi
esac
umask 037
trap 2 3
TMOUT=900;export TMOUT
if [ `/usr/bin/id | grep -c 'uid=0'` -eq 1 ]
then
PS1=`uname -n`"-"`id | cut -d"(" -f2 | cut -d")" -f1`"# ";export PS1
else
PS1=`uname -n`"-"`id | cut -d"(" -f2 | cut -d")" -f1`"$ ";export PS1
fi
/usr/bin/mesg n 2> /dev/null
Where would you suggest I put the mySsh file and where and how in the profile file would I enter the path to the mySsh file?