Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Telnet chat in rc-script
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Portage & Programming
View previous topic :: View next topic  
Author Message
zorloc
n00b
n00b


Joined: 31 Jul 2002
Posts: 14

PostPosted: Fri Nov 22, 2002 8:10 pm    Post subject: Telnet chat in rc-script Reply with quote

I am trying to create rc-script for OpenAntiVirus's ScannerDaemon. Starting is not a problem but I don't know how to script the shutdown. Shutdown is done by:

telnet localhost 8127
(once connected)
COMMAND SHUTDOWN

How do I do this in an rc-script?

jbw
Back to top
View user's profile Send private message
some_bob
Tux's lil' helper
Tux's lil' helper


Joined: 23 Jul 2002
Posts: 94

PostPosted: Fri Nov 22, 2002 11:04 pm    Post subject: Reply with quote

I don't believe you will be able to do it in a shell script as the telnet command does not accept an "execute" parameter like ssh does from the command line.

You might be able to do it in Perl, but I wouldn't know how off the top of my head.

Add on-

You could probably use netcat though. You create a file with the command you want to execute:

get.txt:
COMMAND SHUTDOWN

nc -v <host> <port> < get.txt


you could add that to your rc script and that should work.


Last edited by some_bob on Fri Nov 22, 2002 11:24 pm; edited 1 time in total
Back to top
View user's profile Send private message
zorloc
n00b
n00b


Joined: 31 Jul 2002
Posts: 14

PostPosted: Fri Nov 22, 2002 11:19 pm    Post subject: Reply with quote

Thanks. I was able to do it by embeding a php script -- but that's not very portable. I'll check out netcat.

jbw[/quote]
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Portage & Programming All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum