diff --git a/pbx/pbx_spool.c b/pbx/pbx_spool.c
index 26d38dfe5a9df405c27ce3fd7c1a37bf89710761..1955b78a5f05caabfc460975de1dbb1b9a1c37c4 100644
--- a/pbx/pbx_spool.c
+++ b/pbx/pbx_spool.c
@@ -40,6 +40,7 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
 #include "asterisk/pbx.h"
 #include "asterisk/module.h"
 #include "asterisk/utils.h"
+#include "asterisk/options.h"
 
 /*
  * pbx_spool is similar in spirit to qcall, but with substantially enhanced functionality...
@@ -432,10 +433,15 @@ static void *scan_thread(void *unused)
 	char fn[256];
 	int res;
 	time_t last = 0, next = 0, now;
+	struct timespec ts = { .tv_sec = 1 };
+  
+	while (!ast_fully_booted) {
+		nanosleep(&ts, NULL);
+	}
 
 	for(;;) {
 		/* Wait a sec */
-		sleep(1);
+		nanosleep(&ts, NULL);
 		time(&now);
 
 		if (stat(qdir, &st)) {