Index: src/Fragmentation/Automation/FragmentScheduler.cpp
===================================================================
--- src/Fragmentation/Automation/FragmentScheduler.cpp	(revision d9373b981317876af100f1e1720cf65c82487219)
+++ src/Fragmentation/Automation/FragmentScheduler.cpp	(revision 267b8daa521f5d13c38827367820abbe54d9da41)
@@ -562,4 +562,19 @@
 }
 
+/** Function to shutdown server properly, e.g. for use as signal handler.
+ *
+ * @param sig signal number
+ */
+void FragmentScheduler::shutdown(int sig)
+{
+  LOG(0, "STATUS: Shutting down due to signal " << sig << ".");
+
+  if (!pool.presentIdleWorkers() && !pool.hasBusyWorkers()) {
+    shutdown();
+  } else {
+    removeAllWorkers();
+  }
+}
+
 /** Helper function to shutdown the server properly.
  *
Index: src/Fragmentation/Automation/FragmentScheduler.hpp
===================================================================
--- src/Fragmentation/Automation/FragmentScheduler.hpp	(revision d9373b981317876af100f1e1720cf65c82487219)
+++ src/Fragmentation/Automation/FragmentScheduler.hpp	(revision 267b8daa521f5d13c38827367820abbe54d9da41)
@@ -49,4 +49,5 @@
   ~FragmentScheduler();
 
+  void shutdown(int sig);
 private:
   void sendJobToWorker(const WorkerAddress &address, FragmentJob::ptr &job);
@@ -60,5 +61,4 @@
   void recieveNotification(Observable *publisher, Notification_ptr notification);
   void subjectKilled(Observable *publisher);
-
 
   class WorkerListener_t : public Listener
Index: src/Fragmentation/Automation/Server.cpp
===================================================================
--- src/Fragmentation/Automation/Server.cpp	(revision d9373b981317876af100f1e1720cf65c82487219)
+++ src/Fragmentation/Automation/Server.cpp	(revision 267b8daa521f5d13c38827367820abbe54d9da41)
@@ -29,4 +29,5 @@
 #include <boost/program_options.hpp>
 #include <iostream>
+#include <signal.h>
 
 #include "atexit.hpp"
@@ -35,4 +36,30 @@
 #include "FragmentScheduler.hpp"
 
+
+//!> global shutdown function
+boost::function<void (int)> shutdownfunction;
+//!> global signal vector for later releasing
+std::vector<size_t> signals;
+//!> counter for the number of received signals
+size_t NoSignalsReceived = 0;
+//!> maximum number of received signals after which the handlers are released
+const size_t MAX_NOSIGNALSRECEIVED = 3;
+
+void signalhandler(int sig)
+{
+  // increment received signal counter
+  ++NoSignalsReceived;
+
+  // shutdown if we have handler
+  if (shutdownfunction)
+    shutdownfunction(sig);
+
+  if (NoSignalsReceived >= MAX_NOSIGNALSRECEIVED) {
+    // release signal hook again
+    for (std::vector<size_t>::const_iterator iter = signals.begin();
+        iter != signals.end(); ++iter)
+      signal(*iter, NULL);
+  }
+}
 
 int main(int argc, char* argv[])
@@ -47,4 +74,5 @@
       ("help,h", "produce help message")
       ("verbosity,v", boost::program_options::value<size_t>(), "set verbosity level")
+      ("signal", boost::program_options::value< std::vector<size_t> >(), "set signal to catch (can be given multiple times)")
       ("workerport", boost::program_options::value< unsigned short >(), "listen on this port for connecting workers")
       ("controllerport", boost::program_options::value< unsigned short >(), "listen on this port for connecting controller")
@@ -101,4 +129,18 @@
     boost::asio::io_service io_service;
     FragmentScheduler Server(io_service, workerport, controllerport);
+
+    // catch ctrl-c and shutdown worker properly
+    shutdownfunction = boost::bind(&FragmentScheduler::shutdown, boost::ref(Server), _1);
+    if (vm.count("signal")) {
+      signals =  vm["signal"].as< std::vector<size_t> >();
+      for (std::vector<size_t>::const_iterator iter = signals.begin();
+          iter != signals.end(); ++iter) {
+        LOG(0, "STATUS: Catching signal " << *iter << " via signal handler.");
+        signal(*iter, &signalhandler);
+      }
+    } else {
+      LOG(0, "STATUS: No signals are caught.");
+    }
+
     {
       Info info("io_service");
Index: src/Fragmentation/Automation/poolworker.cpp
===================================================================
--- src/Fragmentation/Automation/poolworker.cpp	(revision d9373b981317876af100f1e1720cf65c82487219)
+++ src/Fragmentation/Automation/poolworker.cpp	(revision 267b8daa521f5d13c38827367820abbe54d9da41)
@@ -42,15 +42,24 @@
 //!> global signal vector for later releasing
 std::vector<size_t> signals;
+//!> counter for the number of received signals
+size_t NoSignalsReceived = 0;
+//!> maximum number of received signals after which the handlers are released
+const size_t MAX_NOSIGNALSRECEIVED = 3;
 
 void signalhandler(int sig)
 {
+  // increment received signal counter
+  ++NoSignalsReceived;
+
   // shutdown if we have handler
   if (shutdownfunction)
     shutdownfunction(sig);
 
-  // release signal hook again
-  for (std::vector<size_t>::const_iterator iter = signals.begin();
-      iter != signals.end(); ++iter)
-    signal(*iter, NULL);
+  if (NoSignalsReceived >= MAX_NOSIGNALSRECEIVED) {
+    // release signal hook again
+    for (std::vector<size_t>::const_iterator iter = signals.begin();
+        iter != signals.end(); ++iter)
+      signal(*iter, NULL);
+  }
 }
 
