Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
mxqdctl-hostconfig: add 'quit' and usage
  • Loading branch information
donald committed May 24, 2016
1 parent ca3cc47 commit 4fe98d4
Showing 1 changed file with 25 additions and 1 deletion.
26 changes: 25 additions & 1 deletion mxqdctl-hostconfig.sh
Expand Up @@ -57,6 +57,19 @@ function stop_all_started()
done
}

function quit_all_started()
{
for pidfile in ${pidfilebase}* ; do
ouid=$(stat --format "%u" "${pidfile}")
if [ "${UID}" != "${ouid}" ] ; then
continue
fi
pid=$(cat ${pidfile})
echo "${pidfile}: sending signal SIGQUIT to ${pid}"
kill -QUIT ${pid}
done
}

function reload_all_started()
{
for pidfile in ${pidfilebase}* ; do
Expand Down Expand Up @@ -93,11 +106,22 @@ case "${BASH_ARGV[0]}" in
kill)
kill_all_started
;;
quit)
quit_all_started
;;
reload|restart)
reload_all_started
;;
stopall)
killall -u "${USER}" "${mxqd}"
;;
*)
echo "usage $0 CMD"
echo " start : start mxqd (if configured by hostconfig)"
echo " stop : tell mxqd to stop accepting new jobs, wait for running jobs, exit"
echo " kill : tell mxqd to stop accepting new jobs, kill and wait for running jobs, exit"
echo " quit : tell mxqd to exit (leave jobs running)"
echo " reload|restart : tell mxqd to re-exec itself, leave jobs running"
echo " stopall : as 'stop', but to any mxqd owned by calling user"
;;
esac

0 comments on commit 4fe98d4

Please sign in to comment.