source: trunk/third/moira/gen/zero_quotas @ 24319

Revision 24319, 1.2 KB checked in by broder, 14 years ago (diff)
New Moira snapshot from SVN.
Line 
1#!/bin/csh -f
2#
3# $HeadURL: svn+ssh://svn.mit.edu/moira/trunk/moira/gen/zero_quotas $ $Id: zero_quotas 3956 2010-01-05 20:56:56Z zacheiss $
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
9set MR_SETQUOTA = 47836471
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 $<`
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 $MR_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
35        setquota -r $dev $current_uid $uid_high 0
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).
44   if ($current_uid != 32767) setquota -r $dev $current_uid 32766 0
45
46endif
47
48exit 0
49
Note: See TracBrowser for help on using the repository browser.