Operating System - HP-UX
1752571 Members
4572 Online
108788 Solutions
New Discussion юеВ

Re: Recursion too deep error.

 
raj0105
Occasional Contributor

Recursion too deep error.

Hi experts,

I got script to log user keystroke to a file.
I put that script in /etc/profile.
Everything works fine but some times while user getting loged in to system it gives error continuously as below.
"profile[4]: log1: recursion too deep."
and my script is:
HISTFILE=$HOME/.sh_history
export HISTFILE
ln=`logname`
lr=`last -R | head -1 | awk '{ print $3}'`
function log1
{

xr=$(fc -ln -0 | head -1)
z=`logger -p local3.info echo "$ln@$lr PWD $PWD $xr"`
}

trap log1 DEBUG

I hope this is happening because same function(log1) getting run multiple times when /etc/profile is getting executed.

Kindly help (Will assign points)

Raj

6 REPLIES 6
Dennis Handly
Acclaimed Contributor

Re: Recursion too deep error.

>I hope this is happening because same function(log1) getting run multiple times

You may have to cancel that trap inside log1. Or put log1 in a separate script.
raj0105
Occasional Contributor

Re: Recursion too deep error.

Hi,
Thanks for reply.

How could I stop this function kindly help.

But it should run after each key stroke.


Kindly help.

Chandra
Dennis Handly
Acclaimed Contributor

Re: Recursion too deep error.

>How could I stop this function?

Have you tried creating a log1 script instead of a function?
raj0105
Occasional Contributor

Re: Recursion too deep error.

Hi Dennis,

How can I do that could you pls help me on this.

Raj
Dennis Handly
Acclaimed Contributor

Re: Recursion too deep error.

>How can I do that?

That may not help since "trap" is still set. You could try turning it off in log1.

Otherwise you would need to copy your log1 function to a script called log1, move all variable settings too. And remove the "function log1 {}" around the body.
raj0105
Occasional Contributor

Re: Recursion too deep error.

HI Dennis,

Thanks again for response.

As per your suggestion I have traped function as script.

At present I have not find any issues.

Let me keep under obeservation this for two weeks.

Raj