mirror of
https://gitlab.alpinelinux.org/alpine/cloud/tiny-cloud.git
synced 2025-12-15 11:22:43 +03:00
* numerous imds script enhancements, including -h/--help * check imds for secondary ipv4 & ipvs via ifupdown-ng executor * simplify shell source to things /etc/conf.d/ and /lib/tiny-cloud/ * move log function to /lib/tiny-cloud/common
24 lines
553 B
Bash
24 lines
553 B
Bash
# Tiny Cloud - common script functions
|
|
# vim: ts=4 et ft=sh:
|
|
|
|
log() {
|
|
local facility=kern
|
|
local stderr
|
|
local tag=$(basename "$0")
|
|
while [ "${1:0:1}" = '-' ]; do
|
|
case "$1" in
|
|
-f) facility="$2"; shift ;;
|
|
-s) stderr=-s ;;
|
|
-t) tag="$tag/$2"; shift ;;
|
|
esac
|
|
shift
|
|
done
|
|
local level="$1"
|
|
[ -z "$DEBUG" ] && [ "$level" = debug ] && return
|
|
shift
|
|
|
|
logger $stderr -p "$facility.$level" -t "$tag" "$@"
|
|
case "$level" in
|
|
crit|alert|emerg) exit 1 ;;
|
|
esac
|
|
} |