Sunday, 30 October 2011
Blinking lights on the LAN
The sorry state of my garden lights has taken one pathetic step to the brighter. I can now blink my garden lights over the local network, using a serverized version of the Lua script i wrote earlier to do the same over the command line. Okay, so it's one step better than ssh'ing into the box and entering relay commands over Bash :) I first thought of learning some more Lua to make the script socket-aware. But then it hit me: Linux has all this built in, into a "super server" called inetd, which i've never actually used before but kinda know of due to its history of security issues. Still, i feel like such a late bloomer for never having used inetd before. Here's how, if you're one of the inetd virgins. Edit /etc/services and add the name, port and protocol of my service. In my case, i called it relay 11647/tcp. Call update-inetd --add ...and a bunch of arguments separated by the t character, as one wonky string. Yeah, it's hairy. I needed to make just one change to the Lua script. Since the script won't read command line arguments anymore -- and i don't know if it's by design or my deficiency -- i had to add if rel == Nil then rel, act = io.read( "*number", "*number" ) end into the code. Still, now i can say echo 4 1 | nc gardengnome 11647 which is a sure sign about a turn for the better :)Did this make any sense at all to you?