dot

packages and services management
Log | Files | Refs | README

commit 2ae4a2713f11230b4c26005971d502ebe0a259be
parent 2cb174cc881f7d72d1678733e4fe1c43dd45cd30
Author: Josuah Demangeon <josuah.demangeon@gandi.net>
Date:   Thu, 22 Jun 2017 11:23:26 +0200

wipe at the end

Diffstat:
MSERVICE | 15+++++++++++----
1 file changed, 11 insertions(+), 4 deletions(-)

diff --git a/SERVICE b/SERVICE @@ -3,7 +3,7 @@ usage() { - echo 'service start|stop|restart|status [name]' + echo 'service start|stop|restart|status name' exit 1 } @@ -12,7 +12,7 @@ usage() [ $# -lt 2 ] && usage -cmd=$1 srv=$2 +cmd=$1 srv=${2%/} shift 2 case "$cmd" in ( start | stop | restart | status ) : ;; ( * ) usage ;; esac @@ -38,7 +38,7 @@ do if [ "$cmd" = stop ] || [ "$cmd" = restart ] then - kill -14 "$pid" && rm -f "$VAR/pid/$srv/$pid" && + kill -14 "$pid" && printf '%-15s [stoping] %s\n' "$srv" "$cmdline" else run=1 @@ -47,7 +47,7 @@ do fi done -[ "$act" = 0 ] && [ "$cmd" = status ] && printf '%-15s [stopped]\n' "$srv" +[ "$act""$cmd" = '0''status' ] && printf '%-15s [stopped]\n' "$srv" if [ "$run" = 0 ] && [ "$cmd" = start ] || [ "$cmd" = restart ] then @@ -60,4 +60,11 @@ then printf '\n' fi + +# --- wipe --------------------------------------------------------------------- + +find "$VAR/pid" -type f | while IFS='' read path +do cmp "$path" "/proc/${path##*/}/cmdline" 2> /dev/null || rm -f "$path" +done + find "$VAR/pid" -depth -type d -exec rmdir {} + 2> /dev/null