embedded control panel - can this work?

Harald Becker ralda at gmx.de
Tue Jan 18 13:13:11 UTC 2011


 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



More information about the busybox mailing list