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] ]