A Reboot() command with failover

view story

http://unix.stackexchange.com – I'm implementing a Reboot() call in my application. It's an embedded application, so no console, keyboard or power switch. The Reboot() must eventually restart the system no matter what. Ideally, I want it to fail gracefully. I've had systems in the past cause problems where a call to reboot or shutdown did not result in a reboot of the machine. e.g. failure to sync drives, unmount a removed USB flash drive. My system is embedded, with a read-only mounted root filing system, so a sudden power off isn't a big issue. But I do write logs to a Flash disc and I'd like to preserve this as much as (HowTos)