]> andersk Git - moira.git/blame - gen/zero_quotas
Command line printer manipulation client, and build goo.
[moira.git] / gen / zero_quotas
CommitLineData
14d85af7 1#!/bin/csh -f
2#
3# $Header$
4#
5# This script zeros quotas for uid's which are not in standard input
6# Note that the input must be sorted in increasing order by uid.
7
8set dev=$1
2ce085d2 9set MR_SETQUOTA = 47836471
14d85af7 10
11# Checking for /etc/zero_old_quotas allows us to release this program
12# one server at a time.
13
14if ( -f /etc/zero_old_quotas ) then
15
16 set current_uid = 0
17
18 while (1)
19 # set args = $< will NOT work. $< will be treated as a single word
20 set args = `echo $<`
5eaef520 21
14d85af7 22 if (${#args} != 2) break # end of input
23
24 set uid = $args[1]
25 @ checksorted = ($current_uid <= $uid)
26
5eaef520 27 if (checksorted == 0) then
14d85af7 28 echo "Input not sorted"
2ce085d2 29 exit $MR_SETQUOTA
14d85af7 30 endif
31
32 # zero all quotas between current_uid and uid (not including uid)
33 if ($current_uid != $uid) then
34 @ uid_high = $uid - 1
d97e880e 35 setquota -r $dev $current_uid $uid_high 0
14d85af7 36 endif
37
38 # skip over $uid
39 @ current_uid = $uid + 1
40
41 end
5eaef520 42
14d85af7 43 # zero all remaining quotas, except for nobody (32767).
d97e880e 44 if ($current_uid != 32767) setquota -r $dev $current_uid 32766 0
5eaef520 45
14d85af7 46endif
47
48exit 0
49
This page took 0.150181 seconds and 5 git commands to generate.