embedded control panel - can this work?

David Collier from_busybox_maillist at dexdyne.com
Tue Jan 18 14:34:00 UTC 2011


In article <4D3591E7.8030506 at gmx.de>, ralda at gmx.de (Harald Becker) wrote:

> *From:* Harald Becker <ralda at gmx.de>
> *To:* from_busybox_maillist at dexdyne.com
> *CC:* busybox at busybox.net
> *Date:* Tue, 18 Jan 2011 14:13:11 +0100
> 
>  Hallo David!
> 
> > I have to implement a "quick fix", and then later a "do it 
> > properly"
> Using tcpsrvd and a shell script can be used as a quick resolution 
> AND
> it is properly done (at least if time and memory resources are not
> overstressed) :-) ... should work with a properly configured but
> otherwise standard busybox (that means no extra patches or
> modifications). ... and you can test your daemon functionality using
> netcat from command line (no need for complex web script debugging).
> 
> Unix philosophy: Keep things simple ... should never be dropped from
> programmers brain!
> 
> Ahh, I see it is tcpsvd not tcpsrvd ... sorry for typo.
> 
> Use tcpsvd 127.0.0.1 YOUR_LISTEN_PORT_NUMBER YOUR_SHELL_SCRIPT
> 
> start shell script with "#!/bin/busybox sh" to make sure it runs 
> busybox
> internal shell and make the script executeable. Simple example from 
> my
> brain:
> 
> #!/bin/busybox sh
> while read cmnd args; do
>   logger -t DAEMON_NAME "Got command $cmnd $args"
>   case "$cmnd" in
>      REBOOT )
>          logger -t DAEMON_NAME "System reboot triggered."
>          # run your reboot stuff here
>          ;;
>      OTHER_COMMAND )
>         logger -t DAEMON_NAME "OTHER_COMMAND with $args"
>         # do your other command stuff here
>         ;;
>      *)
>         logger -t DAEMON_NAME "Unexpected command $cmnd"
>        ;;
>     esac
> done
> exit 0
> 
> 
> Quick resolution, easy to modify and extend ... and just works fine 
> (at
> least for me).
> 
> --
> Harald
 
Thanks H.

We already have a message queueing system up and running to hold a queue
of SMS messages to be sent - it uses sockets - so I'm tempted to add this
function to that code.
OTOH that needs writing in C, where your example seems to be purely
scripted, which is a good thing.

Thanks for the ideas - really helpful.

I know I am ignorant - what would I need in a script or a C prog to
simply send a 1-off message to tcpsvd?

I see that tcpsvd actually opens a 2-way conversation with the other
socket - I guess I should be using it to confirm that the requested
action has happened...?

D


More information about the busybox mailing list