From f53406b066077fef79968f18a7cb619349f3c8b3 Mon Sep 17 00:00:00 2001 From: Kayou Date: Sun, 3 Feb 2019 21:26:07 +0100 Subject: [PATCH] keep CHECK_VAR... For now --- scripts/_common.sh | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/scripts/_common.sh b/scripts/_common.sh index 8078143..423ac1d 100644 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -1,5 +1,12 @@ #!/bin/bash +CHECK_VAR () { # Verifies that the variable is not empty. + # $1 = Variable to be checked + # $2 = Display text on error + test -n "$1" || (echo "$2" >&2 && false) +} + + # Start (or other actions) a service, print a log in case of failure and optionnaly wait until the service is completely started # # usage: ynh_systemd_action [-n service_name] [-a action] [ [-l "line to match"] [-p log_path] [-t timeout] [-e length] ]