Hi, thanks for reading -- the system in question is unique but the question is probably a generic one, so I'm sure any input at all from someone would be helpful.

I've been developing a PostgreSQL data-logging service which runs on several embedded systems running linux on a compact flash card and connecting to the internet via ppp using a Verizon cellular modem card. Instead of getting the expensive batch of static IPs from Verizon, I'm using DYNDNS to be able to access the SQL database from a central (Windows) server and it works great, until something unexpected happens (like windows crashing while a connection is open) and the inetd (I think) service or something related on the embedded system crashes, making it impossible to pull data from it without going to the site and rebooting the system. This is not to say that linux itself crashes -- in fact, I can still ping it through its dyndns address, but the connection will be refused for any ssh, psql, etc. service.

There are a couple of things I'd like to implement that would solve this problem for me in a big way:

1.) Automatically reboot when it isn't working. I could probably get crond to automatically reboot it once a night fairly easily, but it'd be even better if I could get this to happen as soon as an issue presents itself. Something along the lines of detecting when the last time a PSQL connection was made and rebooting when that has been longer than the normal interval.

2.) NOT Linux related, but maybe someone can direct me toward something helpful. It could be useful to have a low-hardware, fool-proof UPS. . .thingy which automatically shuts the power off once a night for a second and turns itself back on. This is in case linux itself actually crashes (I know, when does that ever happen) and can't reboot itself.

Thanks in advance! The real meat of what I need is the first part there.