dot

packages and services management
Log | Files | Refs | README

commit 786bb9bf8cf5e4f2513ddfc0067e4197d520cbed
parent f1b191b18eaba72b411a3df1b9e70dd94d665007
Author: Josuah Demangeon <josuah.demangeon@gandi.net>
Date:   Sat, 12 Aug 2017 21:46:06 +0200

pkg/bin/pkg-service: print status of all available services

Diffstat:
Mpkg/bin/pkg-service | 23++++++++++++-----------
1 file changed, 12 insertions(+), 11 deletions(-)

diff --git a/pkg/bin/pkg-service b/pkg/bin/pkg-service @@ -1,17 +1,18 @@ cmd=$1 srv=${2%/} error=0 running=0 acted=0 -case "$cmd" in (start | stop | restart | status) ;; ( * ) error=1 ;; esac -[ $# -ge 2 ] && shift 2 || error=1 - -if [ "$error" = 1 ] -then +case "$cmd" in +(start | stop | restart | status) + shift 2 + ;; +('') + cd "$PKG" || exit 1 + for service in */start + do "$0" status "${service%/start}" + done + exit 0 +(*) printf '%s (start | stop | restart | status) <pkg>\n' "${0##*/}" - exit 1 -elif [ ! -f "$PKG/$srv/start" ] -then - printf 'no start scrit found in %s\n' "$PKG/$1" - exit 1 -fi +esac mkdir -p "$VAR/pid" "$VAR/log"