Saturday, November 21, 2009

Scripts, and more scripts...


My router runs three different scripting languages now. Built in bash, lua, and python.

A person suggested lua as an easy scripting language already supported in OpenWRT. The problem was that I couldn't get processes to start on boot. So I set up a simple lua script to try do the job.

The problem wasn't to do with init.d however. The problem was I used pivot_root - a tool to create a new '/'. This meant I could move the old root to /mnt, and use my USB stick as /. Anyway... To get things to start on boot, I had to copy my init.d to the old root and make the symlink to rc.d.

The lua script is now redundant, so I might get rid of it. It does however make it easy to add new stuff without having to copy the script and symlink - not that that is hard...


My router now starts a *working* pythong script, a server for hosting my website (lighttpd), and a server for uploading files to my website (vsftpd). Everything it needs to do it now does!

Finally I can stop repeating myself on the router, and start getting a functional system online! The only major router stuff to do is:
  • get python to read twitter names from a text file
  • get the website's members area to edit the above file
  • get ntpclient to run on startup, and edit the timezone to NZDT
I figure I will get the *.CSV files to be created fresh daily. So at 0000 to 2359 is will have one file, and the next day there will be a new file. This will make it a little easier to see what happens day to day.

I think I will get python to create a 'comments' log file. It will be more user readable than the *.CSV files, and will include things like boot, message file edited, and any other useful stuff I can think of.

I've built the simple indoor temperature sensor into a warehouse box I found (don't worry mum, it was from an old project!). All I need now is a power supply. The HopeRF units need a steady 5v. This makes powersupplies hard to design, as I want them to be efficient, and low power. I'm hoping for atleast a one year battery life. Did somebody say switching regulator?

No comments:

Post a Comment