Diff

util/prosodyctl.lua @ 4335:3a2a01432b5c

Add "reload" command to prosodyctl
author Vladimir Protasov <eoranged@ya.ru>
date Thu, 04 Aug 2011 21:26:15 +0400
parent 4142:caa78589598f
child 4485:abfd27b59fa8
child 4499:55ef5d83d00a
line wrap: on
line diff
--- a/util/prosodyctl.lua	Wed Jul 27 14:25:05 2011 -0400
+++ b/util/prosodyctl.lua	Thu Aug 04 21:26:15 2011 +0400
@@ -238,3 +238,19 @@
 	signal.kill(pid, signal.SIGTERM);
 	return true;
 end
+
+function reload()
+	local ok, ret = _M.isrunning();
+	if not ok then
+		return ok, ret;
+	end
+	if not ret then
+		return false, "not-running";
+	end
+	
+	local ok, pid = _M.getpid()
+	if not ok then return false, pid; end
+	
+	signal.kill(pid, signal.SIGHUP);
+	return true;
+end