]>
Commit | Line | Data |
---|---|---|
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 | ||
8 | set dev=$1 | |
9 | set SMS_SETQUOTA = 47836471 | |
10 | ||
11 | # Checking for /etc/zero_old_quotas allows us to release this program | |
12 | # one server at a time. | |
13 | ||
14 | if ( -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 $<` | |
21 | ||
22 | if (${#args} != 2) break # end of input | |
23 | ||
24 | set uid = $args[1] | |
25 | @ checksorted = ($current_uid <= $uid) | |
26 | ||
27 | if (checksorted == 0) then | |
28 | echo "Input not sorted" | |
29 | exit $SMS_SETQUOTA | |
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 | |
42 | ||
43 | # zero all remaining quotas, except for nobody (32767). | |
d97e880e | 44 | if ($current_uid != 32767) setquota -r $dev $current_uid 32766 0 |
14d85af7 | 45 | |
46 | endif | |
47 | ||
48 | exit 0 | |
49 |