All pastes #190802 Raw Edit

Untitled

public text v1 · immutable
·published 2006-10-04 09:59 UTC
rendered paste body
start() {
    return 0
}

stop() {
    return 0
}

reload() {
    return 1
}

restart() {
    stop
    start
}

shutdown() {
    return 0
}

help() {
    cat <<EOF
Syntax: $0 [command]

Available commands:
    start   Start the service
    stop    Stop the service
    restart Restart the service
    reload  Reload configuration files (or restart if that fails)
$EXTRA_HELP
EOF
}

init_service() {
    local action="$1"
    local cmds
    for cmd in $EXTRA_COMMANDS; do
        cmds="$cmd) $cmd;;"
    done
    eval "case \"\$action\" in
        start) start;;
        stop) stop;;
        reload) reload || restart;;
        restart) restart;;
        $cmds
        *) help;;
    esac"
}