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.

Leave a Reply

Your email address will not be published.