#include "Syslog.h"
#include "VehicleConfigurator.h"
#include "SystemStatus.h"

int main()
{
	SystemStatus *stat;

	VehicleConfigurator::setName("systemStatus");

	try {
		stat = new SystemStatus();
	}
	catch (...) {
		Syslog::write("Caught exception creating SystemStatus. Sorry.");
		exit(1);
	}

	try {
		stat->run();
	}
	catch(...) {
		openlog("SystemStatus", LOG_PID, 0); Syslog::write("SystemStatus: Caught exception. Rebooting"); closelog();

		fprintf(stderr, "Caught exception running SystemStatus. Probably that means something bad happened.");
		fprintf(stderr, "I'm gonna reboot, just in case.");
		system("/bin/shutdown");
	}

	return 1;
}