View previous topic :: View next topic |
Author |
Message |
zorloc n00b
Joined: 31 Jul 2002 Posts: 14
|
Posted: Fri Nov 22, 2002 8:10 pm Post subject: Telnet chat in rc-script |
|
|
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 |
|
|
some_bob Tux's lil' helper
Joined: 23 Jul 2002 Posts: 94
|
Posted: Fri Nov 22, 2002 11:04 pm Post subject: |
|
|
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 |
|
|
zorloc n00b
Joined: 31 Jul 2002 Posts: 14
|
Posted: Fri Nov 22, 2002 11:19 pm Post subject: |
|
|
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 |
|
|
|