mbpfan-josie

Fixes #26

eda84439061d02654843bab891acb2798af02771
Daniel Graziotin <dgraziotin@task3.cc> · 2012-10-20T17:18 · browse files at this commit

parents: ac4178b

diff --git a/README.md b/README.md
index f55cd19..a2acf77 100644
--- a/README.md
+++ b/README.md
@@ -19,7 +19,7 @@ This enhanced version assumes any number of processors and fans (max. 10).
 Supported GNU/Linux Distributions
 ---------------------------------
 We provide scripts to to load mbpfan daemon at system boot for many distros.
-Please note that the support is provided by volunteers. mbpfan needs test and bug reports.
+Please note that the support is provided by volunteers. mbpfan needs tests and bug reports.
 
 Supported distributions:
 
diff --git a/mbpfan.upstart b/mbpfan.upstart
index ff2957f..32fc389 100644
--- a/mbpfan.upstart
+++ b/mbpfan.upstart
@@ -1,7 +1,7 @@
 # mbpfan - A simple daemon to control fan speed on all Macbook/Macbook Pros \
 #   (probably all Apple computers) for Linux 3.x.x
 
-description	"mbpfan"
+description     "mbpfan"
 
 start on filesystem or runlevel [2345]
 stop on runlevel [!2345]
@@ -12,15 +12,4 @@ umask 022
 
 console log
 
-pre-start script
-    test -x /usr/sbin/mbpfan || { stop; exit 0; }
-    # A way to turn pidfile writing off would be nice. That or mbpfan
-    # could check for staleness before refusing to control your fans.
-    rm -f /var/run/mbpfan.pid
-end script
-
-# Starting mbpfan in the foreground without being in an interactive tty currently
-#   seems to segfault, so expect forkage.
-expect fork
-exec /usr/sbin/mbpfan
-
+exec /usr/sbin/mbpfan -f
diff --git a/src/daemon.c b/src/daemon.c
index 56d563c..44a2b90 100644
--- a/src/daemon.c
+++ b/src/daemon.c
@@ -87,6 +87,11 @@ void signal_handler(int signal)
         delete_pid();
         //TODO: free resources
         exit(0);
+    case SIGSTOP:
+        syslog(LOG_WARNING, "Received SIGSTOP signal.");
+        delete_pid();
+        //TODO: free resources
+        exit(0);
     default:
         syslog(LOG_WARNING, "Unhandled signal (%d) %s", signal, strsignal(signal));
         break;