update-stats: Close logging.conf before reloading lighttpd.
[matthijs/servers/drsnuggles.git] / usr / local / bin / update-stats
index 749fed9b11d2ef23f7b11417dac8de498d65328a..2591ff4bf30874cada2f97f0cdcef90abe1a1b43 100755 (executable)
@@ -140,12 +140,17 @@ if lighttpd_conf != f.read():
   f.seek(0)
   f.truncate()
   f.write(lighttpd_conf)
+  f.close()
 
   # Reload lighttpd configuration
   print "Reloading lighttpd: %s" % reload_lighttpd
-  subprocess.call(reload_lighttpd, shell=True)
-    
-f.close()
+  ret = subprocess.call(reload_lighttpd, shell=True)
+
+  if ret != 0:
+    print >> sys.stderr, "Reloading lighttpd failed. Logging.conf was:"
+    print >> sys.stderr, lighttpd_conf
+else:
+  f.close()
 
 # Now, run awstats to parse log files.