Better launcher experience - 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 ddc902f5463b33bb032bf0ddb441f6975e9dcc66
DIR parent 8e5ebef8af4853fc4b0559235bfa0216622f13b5
HTML Author: Solene Rapenne <solene@perso.pw>
Date: Wed, 24 Oct 2018 07:55:33 +0200
Better launcher experience
Diffstat:
M functions.lisp | 7 +++++--
M reed-alert.in | 26 +++++++++++++++++++-------
2 files changed, 24 insertions(+), 9 deletions(-)
---
DIR diff --git a/functions.lisp b/functions.lisp
@@ -1,4 +1,6 @@
-(require 'asdf)
+;;; let's hide the loading
+(let ((*standard-output* (make-broadcast-stream)))
+ (require 'asdf))
(defparameter *tries* 3)
(defparameter *alerts* '())
@@ -139,5 +141,6 @@
(format stream-out "~a~%~a~%" (+ 1 tries) params))
nil)))))
+;; abort when using ctrl+c instead of dropping to debugger
#+ecl
-(ext:set-signal-handler ext:+sigint+ nil)
+(ext:set-signal-handler ext:+sigint+ #'quit)
DIR diff --git a/reed-alert.in b/reed-alert.in
@@ -3,20 +3,22 @@
REEDDIR=
# check for ecl
-type ecl 2>/dev/null
+type ecl 2>&1 >/dev/null
if [ $? -eq 0 ]
then
LISP="ecl"
+ PARAMS="--norc"
LOADPARAM="-load"
SHELLPARAM="-shell"
else
# check for sbcl if ecl not in PATH
- type sbcl 2>/dev/null
+ type sbcl 2>&1 >/dev/null
if [ $? -eq 0 ]
then
LISP="sbcl"
- LOADPARAM="--load"
- SHELLPARAM="--shell"
+ PARAMS="--noinform --no-userinit"
+ LOADPARAM="--script"
+ SHELLPARAM="--script"
else
echo "ecl or sbcl not found in PATH."
echo "you need at least one of them to use reed-alert"
@@ -24,6 +26,16 @@ else
fi
fi
-$LISP $LOADPARAM $REEDDIR/functions.lisp \
- $LOADPARAM $REEDDIR/probes.lisp \
- $SHELLPARAM $1
+if [ $# -eq 0 ]
+then
+ echo "usage: $0 filename"
+ exit 2
+fi
+
+# prevent interpreter output when loading files
+$LISP $PARAMS --eval \
+"(let ((*standard-output* (make-broadcast-stream)))
+ (require 'asdf)
+ (load \"$REEDDIR/functions.lisp\")
+ (load \"$REEDDIR/probes.lisp\"))" \
+ $SHELLPARAM $1