Ha, got you, you bastard

Started out fixing a couple of mobile game issues then working on yet another bloody codec. This time IMA4 which has yet another file format, at least this one is RIFF based. Managed to get it decoding without too much stress.

So then on to the outstanding issue, the bloody UPS and powering down / up the server and the pfSense box. First thing I noticed was that when the pfSense box shut down, it magically woke again when the server deconfigured the network. Then another problem when the server was booting I couldn’t get the script to activate in the correct place to wait for the network to come up.

Anyway, the final solution….

pfSense box has it’s shutdown modified to trigger after 1 minute. This needed to be done in the package php script rather than the nut conf as it reruns it every reboot. That’s the only change required on the pfSense box. On the server the nut script is modified so that it pauses rather than shuts down the ups. Then a script is added to to init.d, this checks the shutdown flag, if set then it sends the wake on lan to the pfSense box and deletes the flag. It then starts a reboot on another bash shell set to 2 minutes, this stops the script jamming and also stops an issue with grub reporting a bad boot and stopping on the grub screen.

So it works like this: Power goes off, UPS goes critical, server then sends a remote shutdown to pfSense box. pfSense box then starts a shutdown delayed by 1 minute (to stop the reboot from the network deconfigure). Server then shuts everything down and just waits. Then either the UPS power runs out and everything shuts off or power is restored. Doesn’t matter either way, the server will reboot after a time out or after the power is restored. Server boots, power kill flag is set to script runs a wake on lan to pfSense box. pfSense box starts booting. Server starts a shutdown and reboot for 2 minutes. It then continues to boot and fails all over the place due to no network. Eventually gets to log in prompt. Then shutdown occurs and reboots. Server then boots normally as pfSense box is now up. Job done. Yes I am good.

Also went to gym, ran for 72 minutes and knocked up 1000 calories. I’m now going to drink wine, eat cheese and watch torture porn.

Nut driving me nuts

So the day started waiting for the rain to stop. It didn’t. So I waited for Lisa to turn up then took the dog out then, thankfully the rain held off.

Moved on to lunch, salad sandwich, why break a tradition even if it is a bank holiday.

Then moved on to NUT and configuring UPS scripts. To be fair I didn’t really have any issue with NUT itself, just the Belkin driver. There is a modified driver that I just completely failed to get working under Ubuntu. In the end I went for the USB driver as well it’s just a bit more modern. The problem with the Belkin UPS is that it doesn’t support a soft shutdown, in other words if the mains fails and the UPS goes critical and shuts the server down then when the mains comes back up, bugger all happens, the UPS stays shut down. The only way round it is to get the server to the point just before halt, then just sit there and wait. If the mains comes back on, wait for a maximum of about 20 minutes then perform a reboot. If the UPS fails then the server just shuts off. Now, if the mains comes back up the UPS does the decent thing and powers everything up. Now this is all jolly except for one fly in the ointment. If the UPS monitor has remotely shut down the pfSense box on a critical, if the mains is reapplied before the battery is exhausted then the server will reboot but the pfSense box will remain shut down. I think the solution here is wake on lan, one for another night.

Yesterday I probably ate too much and appeared to put on 4 pound by this morning, but today I’m about 1000 calories under (after running 51 minutes this afternoon) and been nothing but shitting all day. I feel backed up like the Severn Tunnel. So lets see how long it takes to drop those 4 pounds again.

I am the king of the scripts

Strange day. Got up late as usual as it was a Saturday. Walked the dog in bright sunshine. Then met up with Jamie to do the shopping as he was finishing early. I then had lunch and went back to bed. Then resurrected around 6 (what happened in the meantime I’ll leave as an exercise to the reader).

I then went to B&Q and did very manly things like buy grass seed and top soil. I’ve then been piddling with pfSense again. Installed the new wireless PCI card, which won’t actually fit into the case until I take a hacksaw to it, but it appears to at least be working fine.

I’ve then spent the rest of the evening adding a startup and shutdown script in the correct place in Ubuntu to control the UPS, the scripts are working correctly even if the UPS driver doesn’t seem to be. But that’s going to require more testing I thing.

Did the accounts. Now about to have a shower and cook the dinner. Tomorrow I did have the oppertunity of going out to dinner in the afternoon, but I think this is going to be my last day I can actually get on with the front garden and get the grass seed down. So I’m going to be very dull and do manly gardening tasks. In the evening providing it’s not pissing down we will be having a BBQ though (yes, sad, just the 3 of us and one of them chases her own tail).

So, Nut and pfSense where are we currently at

Ok, so pfSense now appears to be stable, even on the development trunk if I don’t run the wireless USB dongle. Looking at the kernel panics it was always coming from the ‘run’ driver, so after removing it all looks good. I’ve ordered this new PCI wireless card that should work with another driver so will see how that one pans out.

Nut wise, well that all appears to be working, I just need to do something sensible with the messages and sort out the start up and shutdown scripts, then do a lot of testing with it.

Server wise, everything else seems very stable. No issues overall which is very good. There are still a couple of odd firewall port issues to sort out, but nothing major. So it is all finally getting there. I think the next job will be to test out the UPS stuff then move the server into the network cabinet. I’ll leave the pfSense box out for now until I fit the wireless card and do more soak testing on it.

Work wise, been stripping back that MP4 lib some more. Bit of a tedious task, but has to be done. Did a couple of minor mobile game changes.

Went to gym, did Body Pump, then ran for 50 minutes. That must mean I can have at least one glass of wine and may be a few beers…

Anyway, must be wine o’clock and bath time. Oh and all the other Friday night shit like hanging up washing, emptying the dishwasher and doing the washing up. All the stuff Jamie doesn’t do. He did surprise me last week though, he managed to change the loo roll without any outside assistance.

My Nut’s are emailing me

So I spent the bulk of the day pissing about with PS3 compiler issues on VC2010. In between I added one small addition to a mobile game. I did manage to look at NUT again though and worked out the script problem, it needed it’s group changing to ‘nut’ then it was able to send mail from nut@root without any problem. I now need to write a script to actually do something useful, including shutting the bloody server down. Due to it being a Belkin UPS there are a couple of oddities to do with ‘what happens if’ type scenarios, like if the power is restored during a shut down. There are some scripts to handle this, but I’m not sure how far I want to take it, it’s hardly NASA and isn’t exactly mission critical. I think in 15 years we’ve had about 20 power cuts and in that time the UPS has always outlasted the cut.

Still having fun with pfSense, it reboot another half a dozen times. Looking at the kernel panics it appears to be the wireless driver. So I’ve yanked the dongle out and ordered a PCI card from ebay which should use a different driver. In the meantime I’ve connected up the old router to use as an access point. I’ve also gone back on to the development versions of pfSense as there still seems to be a bit of an issue with pppoe not reconnecting properly. I’ve added a link up/down to one of the scripts to try and shift this. I’ve done a few tests and so far it’s been fine. But yet another thing to keep and eye on.

Went to gym, only ran for half hour. Now it’s salad time and torture porn night, so I may get a glass of wine in, what a naughty boy.

Going nuts and avoiding cheese

So today I was finishing off this damn AAC codec and finally got it all working. So now it supports both ‘main’ and ‘low complexity’ objects and encodes them nicely. One oddity with AAC is that there is a single frame offset at the beginning, which means the encoder runs for a while before it outputs anything. Then at the end of it you have to call the encode multiple times to get it to spew all the data back out again. It also means that if you skip while decoding there is a discrepancy between the length it thinks it is and the length it actually is, that one I’m going to forget about.

I’m now in the process of tidying it all up. But almost done.

Then off to the gym and ran far too much, 49 minutes and 739 calories. Came back to moaning about wireless connectivity. I tried a few things but it’s working fine on my devices.

I then started play with NUT. This is the linux UPS handler thingy. I’m trying to get it to mail me when the power fails and its a pain in the ass to configure. There’s also another odd problem I’m now having, if the ethernet modem goes down and comes back up again, the pfSense box tries to log in to the modem dhcp address and not the wan ip. Oh the joys.

And yes, I’m craving cheese, been almost a week now. 3AM again, piddling about to much as normal.

Well, it’s now live…..and crashing

So I took the plunge and unhooked the old Draytek and put the cable into the pfSense LAN port. It’s reset itself multiple times, this may be because I’ve been running the latest developer version, so I’ve gone back to the last ‘stable’ release. So far, so good. Also got the remote logging to work, so it’s now sending all it’s log stuff back to the servers syslog and into it’s own nice little log file.

I also found an RS232 (yes they are still used) extension cable, so connected the UPS to the server and configured NUT. It appears to be working, but I haven’t tried a power down test yet. Need to configure that and may be get it to send a mail with the power outage.

Work wise, well, did a bit on the mobile game, then it was back to Apple Lossless. Apart from a major tidy up of the file handling libs (for MP4), it’s all working. Next job is to add in ALC which uses yet another library, when that’s done I can strip down finally all the bloaty file libs.

Right, now it must be time for salad (going for a wine free week again….)