[Olsr-users] DOT draw Telnet plugin

John Schultz (spam-protected)
Mon Dec 17 15:52:26 CET 2012


I finally got it working.

I ended up using two scripts, one shell script and one expect script.

The main scrip that controls everything is as follows:
#!/bin/sh

TIMESTAMP=$(date +%m.%d.%Y-%H%M%S)
SERVER='**********'
USER='**********'
PASSWD='**********'

remountrw

./topology.sh > topology-$TIMESTAMP.dot

sed -i 1d topology-$TIMESTAMP.dot
sed -i 1d topology-$TIMESTAMP.dot
sed -i 1d topology-$TIMESTAMP.dot
sed -i 1d topology-$TIMESTAMP.dot

dot -Tpng topology-$TIMESTAMP.dot -o topology-$TIMESTAMP.png

lftp -u $USER,$PASSWD -e "put topology-$TIMESTAMP.png; quit" $SERVER

rm topology-$TIMESTAMP.dot
rm topology-$TIMESTAMP.png

remountro

exit 0

and the second script that actually gets the DOT data is as follows:
#!/usr/bin/expect -f
spawn telnet 127.0.0.1 2004
expect -re "}"
send "\]"
send "quit"


Took me forever to figure out why the script was not logging into the
server, I then realized that I didn't set up forwarding on my firewall
(chuckle). But this does work and ive tested it several times.

Enjoy,
John

-----Original Message-----
From: Henning Rogge [mailto:(spam-protected)] 
Sent: Monday, December 17, 2012 3:00 AM
To: John Schultz
Cc: olsr users mailing list
Subject: Re: [Olsr-users] DOT draw Telnet plugin

There is no "exit command" for the dotdraw plugin... it keeps sending until
you close the socket.

Henning Rogge

On Mon, Dec 17, 2012 at 10:57 AM, John Schultz <(spam-protected)>
wrote:
> Right, exactly what I was thinking. If I use the expect scripting I 
> can use the "expect" command to read the Curly bracket, and then the 
> "send" command to send the control character and exit commands.
>
> John
>
> -----Original Message-----
> From: Henning Rogge [mailto:(spam-protected)]
> Sent: Monday, December 17, 2012 2:53 AM
> To: John Schultz
> Cc: olsr users mailing list
> Subject: Re: [Olsr-users] DOT draw Telnet plugin
>
> Look through the output of the Dotdraw plugin... you will notice you 
> first get a large block of stuff which ends with a certain line. When 
> your script read that line, it should stop processing the data and close
the socket.
>
> Henning Rogge
>
> On Mon, Dec 17, 2012 at 10:49 AM, John Schultz 
> <(spam-protected)>
> wrote:
>> Unfortunately the scope of this project has to have something "pretty"
>> to show off to the big wigs. The closest thing is the DOT draw plugin.
>>
>> OK, what about having the plugin do one iteration and then force an exit
.
>> Or is that something done by a script.
>>
>> BTW, I am planning on using a bash script or maybe expect script
>>
>> -----Original Message-----
>> From: Henning Rogge [mailto:(spam-protected)]
>> Sent: Monday, December 17, 2012 2:45 AM
>> To: John Schultz
>> Cc: olsr users mailing list
>> Subject: Re: [Olsr-users] DOT draw Telnet plugin
>>
>> I would say that depends on your scripting language.
>>
>> If you want to find out about the layout and links of your mesh, just 
>> use the txtinfo plugin.
>>
>> Henning Rogge
>>
>> On Mon, Dec 17, 2012 at 10:42 AM, John Schultz 
>> <(spam-protected)>
>> wrote:
>>> Henning...
>>>
>>> This can be done in a shell script?
>>>
>>> -----Original Message-----
>>> From: Henning Rogge [mailto:(spam-protected)]
>>> Sent: Monday, December 17, 2012 2:40 AM
>>> To: John Schultz
>>> Cc: olsr users mailing list
>>> Subject: Re: [Olsr-users] DOT draw Telnet plugin
>>>
>>> You could just close the socket after you receive the beginning of 
>>> the second iteration.
>>>
>>> Henning Rogge
>>>
>>> On Mon, Dec 17, 2012 at 10:27 AM, John Schultz 
>>> <(spam-protected)>
>>> wrote:
>>>> Is there any way to have the telnet session ONLY display one 
>>>> iteration and then exit automatically?
>>>>
>>>>
>>>> --
>>>> Olsr-users mailing list
>>>> (spam-protected)
>>>> https://lists.olsr.org/mailman/listinfo/olsr-users
>>>
>>>
>>>
>>> --
>>> Steven Hawkings about cosmic inflation: "An increase of billions of 
>>> billions of percent in a tiny fraction of a second. Of course, that 
>>> was before the present government."
>>>
>>>
>>> --
>>> Olsr-users mailing list
>>> (spam-protected)
>>> https://lists.olsr.org/mailman/listinfo/olsr-users
>>
>>
>>
>> --
>> Steven Hawkings about cosmic inflation: "An increase of billions of 
>> billions of percent in a tiny fraction of a second. Of course, that 
>> was before the present government."
>>
>>
>> --
>> Olsr-users mailing list
>> (spam-protected)
>> https://lists.olsr.org/mailman/listinfo/olsr-users
>
>
>
> --
> Steven Hawkings about cosmic inflation: "An increase of billions of 
> billions of percent in a tiny fraction of a second. Of course, that 
> was before the present government."
>
>
> --
> Olsr-users mailing list
> (spam-protected)
> https://lists.olsr.org/mailman/listinfo/olsr-users



--
Steven Hawkings about cosmic inflation: "An increase of billions of billions
of percent in a tiny fraction of a second. Of course, that was before the
present government."





More information about the Olsr-users mailing list