From a79c3d3c803bc2df2b3d31a02f25710810317ecc Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Fri, 12 Aug 2022 23:45:58 -0300 Subject: etc/guix/home.scm: Setup working cronjobs --- bin/with-email | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-) (limited to 'bin') diff --git a/bin/with-email b/bin/with-email index dc2a022..7df101a 100755 --- a/bin/with-email +++ b/bin/with-email @@ -69,15 +69,7 @@ while getopts 's:h' flag; do done shift $((OPTIND - 1)) -assert_arg() { - if [ -z "$1" ]; then - printf 'Missing %s\n\n' "$2" >&2 - usage >&2 - exit 2 - fi -} - -assert_arg "${1:-}" 'COMMAND...' +eval "$(assert-arg "${1:-}" 'COMMAND...')" now() { date '+%Y-%m-%dT%H:%M:%S%Z' @@ -90,10 +82,10 @@ OUT="$(mkstemp)" printf '\n' STATUS=0 - "$@" 2>&1 || STATUS=$? + "$@" || STATUS=$? printf '\n' printf '\nFinished at: %s\n' "$(now)" -} 2>&1 1>"$OUT" +} 1>"$OUT" 2>&1 email -s "(exit status: $STATUS) - $SUBJECT" eu@euandre.org < "$OUT" -- cgit v1.2.3