5 test -z "$op" && op="get"
6 tmp_file="/mnt/narada/rootfs/tmp/${name}_${op}"
7 pid_file="${tmp_file}.pid"
8 log_file="${tmp_file}.log"
9 echo "# $name $op" >> $log_file
11 if [ "$1" = "get" ] ; then
13 echo -n "get $uid = " >> $log_file
14 quota --raw-grace --no-wrap -u $uid | tail -1 \
15 | awk '{ print $2 " " $3 }' | tee -a $log_file \
18 elif [ "$1" = "set" ] ; then
19 while read uid quota ; do
20 echo "set $uid $quota" >> $log_file
21 setquota -u $uid $quota 0 0 0 /mnt/narada/
22 quota --raw-grace --no-wrap -u $uid | tail -1
24 elif [ "$1" = "start" ] ; then
25 test -e $pid_file && kill `cat $pid_file` || true;
26 LD_PRELOAD=/mnt/narada/rootfs/usr/lib/libgearman.so.4 /mnt/narada/rootfs/usr/bin/gearman \
27 -h 10.60.0.244 -p 4730 -i $pid_file \
28 -n -f ${name}_${op} -w `pwd`/$0 $op &
29 elif [ "$1" = "stop" ] ; then
30 kill `cat $pid_file` && rm $pid_file
31 elif [ "$1" = "status" ] ; then
32 kill -s 0 `cat $pid_file` && echo "$name $op OK";