summaryrefslogtreecommitdiffstats
path: root/skripti/service.sh
diff options
context:
space:
mode:
authorAnton Luka Šijanec <anton@sijanec.eu>2024-06-03 18:54:14 +0200
committerAnton Luka Šijanec <anton@sijanec.eu>2024-06-03 18:54:14 +0200
commit3a239dd1b3bc6536ea663ab12567f7a9b71dfbeb (patch)
treedc51ea1b9dc4429546c50dd54d232e81dd0538fd /skripti/service.sh
parentds2teor (diff)
parentrazne stvari iz b (diff)
downloadr-3a239dd1b3bc6536ea663ab12567f7a9b71dfbeb.tar
r-3a239dd1b3bc6536ea663ab12567f7a9b71dfbeb.tar.gz
r-3a239dd1b3bc6536ea663ab12567f7a9b71dfbeb.tar.bz2
r-3a239dd1b3bc6536ea663ab12567f7a9b71dfbeb.tar.lz
r-3a239dd1b3bc6536ea663ab12567f7a9b71dfbeb.tar.xz
r-3a239dd1b3bc6536ea663ab12567f7a9b71dfbeb.tar.zst
r-3a239dd1b3bc6536ea663ab12567f7a9b71dfbeb.zip
Diffstat (limited to 'skripti/service.sh')
-rwxr-xr-xskripti/service.sh28
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