Run your server with
run-with-timer. In this way you can do anything you like with it. For an instance you can instrument
edebug or redefine
check-server while it is still running.
An example how to run the
Each started server has its own buffer. The variable
my-server-status is buffer local to this buffer. If you want to see its value first switch to this buffer.
(defun check-server ()
(let ((time (current-time)))
(message "Running server at %s" time)
(defun my-server-start (time fun)
"Run `fun' with timer for every time seconds."
(interactive "nTime in seconds:\naServer to run:")
(let ((buf (generate-new-buffer (concat "*my-server(" (symbol-name fun) ")"))))
(setq-local my-server-fun fun)
(setq-local my-server-timer (run-with-timer 0 time `(lambda () (with-current-buffer ,buf (setq-local my-server-status (funcall my-server-fun))))))
(add-hook 'kill-buffer-hook (lambda () (cancel-timer my-server-timer)) t t))))
EDIT: You get rid of the server timer when you kill the server buffer.