X-Git-Url: http://git.rot13.org/?a=blobdiff_plain;f=gearman%2Fnarada_s1_quota;h=ba8fe1fe05918622fc70e536787e94ffd6961255;hb=HEAD;hp=114d02ce8fc6a8193800f5c975031ddf127a6e60;hpb=f60e030a70afd8803da9daeca58561058a78d232;p=cloudstore.git diff --git a/gearman/narada_s1_quota b/gearman/narada_s1_quota index 114d02c..ba8fe1f 100755 --- a/gearman/narada_s1_quota +++ b/gearman/narada_s1_quota @@ -1,5 +1,8 @@ #!/bin/sh -e +# sudo /mnt/narada/rootfs/srv/cloudstore/gearman/narada_s1_quota start get +# sudo /mnt/narada/rootfs/srv/cloudstore/gearman/narada_s1_quota start set + name=`basename $0` op=$2 test -z "$op" && op="get" @@ -9,14 +12,15 @@ log_file="${tmp_file}.log" echo "# $name $op" >> $log_file if [ "$1" = "get" ] ; then - while read uid ; do + while read login ; do + uid=`echo $login | sed 's/^u//'` echo -n "get $uid = " >> $log_file quota --raw-grace --no-wrap -u $uid | tail -1 \ - | awk '{ print $2 " " $3 }' | tee -a $log_file \ - | grep '^[0-9][0-9]*' + | awk '{ print $2 " " $3 }' | sed -e 's/*//' | tee -a $log_file done elif [ "$1" = "set" ] ; then - while read uid quota ; do + while read login quota ; do + uid=`echo $login | sed 's/^u//'` echo "set $uid $quota" >> $log_file setquota -u $uid $quota 0 0 0 /mnt/narada/ #quota --raw-grace --no-wrap -u $uid | tail -1 @@ -25,7 +29,7 @@ elif [ "$1" = "start" ] ; then test -e $pid_file && kill `cat $pid_file` || true; LD_PRELOAD=/mnt/narada/rootfs/usr/lib/libgearman.so.4 /mnt/narada/rootfs/usr/bin/gearman \ -h 10.60.0.244 -p 4730 -i $pid_file \ - -n -f ${name}_${op} -w `pwd`/$0 $op & + -n -f ${name}_${op} -w $0 $op & elif [ "$1" = "stop" ] ; then kill `cat $pid_file` && rm $pid_file elif [ "$1" = "status" ] ; then