Add a macro strcat for more readability of (concatenate 'string &body) Use ~/.reed-alert/states instead of $PWD/states/ for saving states - reed-alert - Lightweight agentless alerting system for server HTML git clone git://bitreich.org/reed-alert/ git://enlrupgkhuxnvlhsf6lc3fziv5h2hhfrinws65d7roiv6bfj7d652fid.onion/reed-alert/ DIR Log DIR Files DIR Refs DIR Tags DIR README DIR LICENSE --- DIR commit 64185e6f15946e6842a082578a778184a99a3abd DIR parent 0657e70c7767a58c22ebdbe34c0a18420555b017 HTML Author: Solene Rapenne <solene@perso.pw> Date: Sun, 21 Oct 2018 21:38:46 +0200 Add a macro strcat for more readability of (concatenate 'string &body) Use ~/.reed-alert/states instead of $PWD/states/ for saving states Diffstat: M functions.lisp | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) --- DIR diff --git a/functions.lisp b/functions.lisp @@ -2,7 +2,8 @@ (defparameter *tries* 3) (defparameter *alerts* '()) -(ensure-directories-exist "states/") +(defparameter *states-dir* "~/.reed-alert/states/") +(ensure-directories-exist *states-dir*) (defun color(num1 num2) (format nil "~a[~a;~am" #\Escape num1 num2)) @@ -57,7 +58,11 @@ `(progn (defparameter ,name ',name) (push (list ',name ,string) - *alerts*))) + *alerts*))) + +(defmacro strcat(&body body) + `(progn + (concatenate 'string ,@body))) (defun trigger-alert(level function params result state) (let* ((notifier-command (assoc level *alerts*)) @@ -91,7 +96,7 @@ (let* ((hash (fnv-hash (format nil "~{~a~}" (remove-if #'symbolp params)))) (result (funcall fonction params)) (filename (format nil "~a-~a-~a" level fonction hash)) - (filepath (format nil "states/~a" filename))) + (filepath (format nil "~a/~a" *states-dir* filename))) ;; we open the file to read the number of tries ;; if no fail then we have 0 try