Operating System - HP-UX
1837097 Members
2210 Online
110112 Solutions
New Discussion

Re: Detecting a talk query to use in shell script

 
so_2
Regular Advisor

Detecting a talk query to use in shell script

Hi

I want to write a shell script in which
whenever someone tries to chat me using the "talk " command, the system has to automaticaly respond to make the coneection.

I will run the script in background.But what i need is how my script will understand that there is a query from another user to establish a connection.
You may feel it too silly... why such things..but i require.

please help.

Thanks in advance
S.O
2 REPLIES 2
RAC_1
Honored Contributor

Re: Detecting a talk query to use in shell script

Down and dirty script. you script should be checking the talk processe. Once it sees it, it warns/alerts you.

This is easy. You script in background keeps doing following every minute and alerts you.

UNIX95= ps -Ctalk -o pid,ruser,args

If there is a talk, process trying to talk to you, it will be seen as follows.

talk "user_name" dev/pts/39
There is no substitute to HARDWORK
Jannik
Honored Contributor

Re: Detecting a talk query to use in shell script

from remote all connections will come though port 517 on udp. So for remote logins U could do something like this:
tcpdump udp port 517 >> /tmp/dumpout

All remote connections would be loged to /tmp/dumpout.

For local connections you could write a small program call talk that do some logging and then rename the old one and call it from talk.

mv /usr/bin/talk /usr/bin/talk.org

#!/usr/bin/ksh
# filename : /usr/bin/talk
echo `date; id` >> /tmp/dumpout

/usr/bin/talk.org
jaton