summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael J. Chudobiak <mjc@avtechpulse.com>2012-09-27 09:01:32 -0400
committerMichael J. Chudobiak <mjc@avtechpulse.com>2012-09-27 09:01:32 -0400
commit2a93a26822476c1c693d1cbe51c79a66b38cab2f (patch)
treee12195f77329350896cde2f30b4b239988279756
parent4dacc2939aa996325477228f07885000a48f287f (diff)
sync before shutdown
-rw-r--r--instr-daemon.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/instr-daemon.c b/instr-daemon.c
index 093b2f7..0065ca3 100644
--- a/instr-daemon.c
+++ b/instr-daemon.c
@@ -14,6 +14,7 @@
#include <stdlib.h>
#include <ctype.h>
#include <glib.h>
+#include <unistd.h>
#define STDIN_BUF_SIZE 1024
@@ -315,6 +316,10 @@ int main(int argc, char **argv)
static gboolean periodic_poll (void)
{
if (bus_getpin (POWER_FAIL)) {
+ // tidy up filesystem
+ sync ();
+
+ // shutdown
system ("/usr/bin/systemctl poweroff");
}