%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /lib/systemd/system-generators/
Upload File :
Create Path :
Current File : //lib/systemd/system-generators/nfdump-generator

#!/bin/sh

set -eu

SERVICEFILE="/lib/systemd/system/nfdump@.service"
WANTDIR="$1/nfdump.service.wants"

CONFIG_DIR=/etc/nfdump/

if [ -d "$CONFIG_DIR" ] ; then
    mkdir -p "$WANTDIR"
    cd "$CONFIG_DIR"
    for CONFIG in *.conf ; do
        [ -f "$CONFIG" ] || continue
        INSTANCE="$(systemd-escape "${CONFIG%%.conf}")"
        LINK="$WANTDIR/nfdump@$INSTANCE.service"

        sh -n "$CONFIG_DIR$CONFIG" 2>/dev/null || continue

        cache_dir=
        user=
        group=
        options=

        . "$CONFIG_DIR$CONFIG"

        [ "$options" ] || continue
        if [ "$cache_dir" ] ; then
            mkdir -p "$cache_dir"
            if [ "$user" ] && [ "$group" ] ; then
                chown "$user:$group" "$cache_dir"
            elif [ "$user" ] ; then
                chown "$user" "$cache_dir"
            fi
        fi

        ln -s "$SERVICEFILE" "$LINK"
    done
fi

exit 0

Zerion Mini Shell 1.0