get SLICE and ZSLICE from group name
authorDobrica Pavlinusic <dpavlin@rot13.org>
Sat, 11 Feb 2012 16:37:10 +0000 (17:37 +0100)
committerDobrica Pavlinusic <dpavlin@rot13.org>
Sat, 11 Feb 2012 16:37:10 +0000 (17:37 +0100)
init.d/_start_stop
init.d/s1-transmission
init.d/s1-zfs

index 009eaed..c712d4d 100755 (executable)
@@ -1,5 +1,11 @@
+# by default, detach from terminal
 BACKGROUND=1
+# deduce name from script name
 NAME=`basename $0`
+# generate ZSLICE and SLICE from group name
+SLICE_GROUP=`echo $NAME | cut -d\- -f1`
+export SLICE=`grep $SLICE_GROUP /var/lib/extrausers/group | cut -d: -f2`
+export ZSLICE=`echo $SLICE | sed 's;^;;'`
 
 _start_stop() {
 
index 903de7f..b0b0398 100755 (executable)
@@ -1,6 +1,5 @@
 #!/bin/sh
 
-export ZSLICE=rsync1/s1
 DAEMON="./gearman/transmission.pl"
 
 . /srv/cloudstore/init.d/_start_stop
index ecb4164..890c190 100755 (executable)
@@ -2,8 +2,6 @@
 
 DAEMON="./gearman/zfs.pl"
 
-export ZSLICE=rsync1/s1
-
 . /srv/cloudstore/init.d/_start_stop
 _start_stop $*