diff options
Diffstat (limited to 'skripti/service.sh')
-rwxr-xr-x | skripti/service.sh | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/skripti/service.sh b/skripti/service.sh new file mode 100755 index 0000000..2617253 --- /dev/null +++ b/skripti/service.sh @@ -0,0 +1,28 @@ +#!/bin/bash +[ x$INITPATH = x ] && for i in `tr : ' ' <<<$MORE_INITPATH` `tr : ' ' <<<$XDG_CONFIG_DIRS` ~/.config ~ /etc +do + [ -d $i/init.d ] && INITPATH=$INITPATH:$i/init.d +done +if [ x$1 = xlist ] +then + for i in `tr : ' ' <<<$INITPATH` + do + if [ -w $i ] + then + ls $i + else + for j in $i/* + do + [ ! -x $j ] && continue + head -n1 $j | grep "#!.*openrc-run" > /dev/null 2> /dev/null && continue + echo `rev <<<$j | cut -f/ -d1 | rev` + done + fi + done + exit 1 +fi +[ x$1 = x ] && { echo -e "Uporaba:\n\t$0 list\n\t$0 <storitev> <dejanje>"; exit 1; } +for i in `tr : ' ' <<<$INITPATH` +do + [ -x $i/$1 ] && exec $i/$@ +done |