~ubuntu-branches/ubuntu/utopic/libuser/utopic-proposed

« back to all changes in this revision

Viewing changes to python/quota-script

  • Committer: Bazaar Package Importer
  • Author(s): Ghe Rivero
  • Date: 2005-09-30 16:22:04 UTC
  • Revision ID: james.westby@ubuntu.com-20050930162204-qubxaa7e2lbovdgh
Tags: upstream-0.54.dfsg.1
ImportĀ upstreamĀ versionĀ 0.54.dfsg.1

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#!/usr/bin/python
 
2
import libuserquota
 
3
import os
 
4
 
 
5
user = "nalin"
 
6
 
 
7
quota.on()
 
8
quotas = quota.get(quota.USER, user)
 
9
print quotas.keys()
 
10
for key in quotas.keys():
 
11
        item = quotas[key]
 
12
        print item.special + ":"
 
13
        print " inodes (usage, soft limit, hard limit, grace period) = ",
 
14
        print item.inode_usage, item.inode_soft,
 
15
        print item.inode_hard, item.inode_grace
 
16
        print " blocks (usage, soft limit, hard limit, grace period) = ",
 
17
        print item.block_usage, item.block_soft,
 
18
        print item.block_hard, item.block_grace
 
19
        save = item.copy()
 
20
 
 
21
item.inode_soft = 102400
 
22
item.inode_hard = 204800
 
23
item.inode_grace = 300
 
24
item.block_soft = 102400
 
25
item.block_hard = 204800
 
26
item.block_grace = 300
 
27
 
 
28
print("Manipulating quota structure (before):")
 
29
print save
 
30
print("Manipulating quota structure (after):")
 
31
print item
 
32
 
 
33
print("Before setting quota:")
 
34
os.system("quota -v -u " + user);
 
35
quota.set(item)
 
36
print("After setting quota:")
 
37
os.system("quota -v -u " + user);
 
38
quota.set(save)
 
39
print("After resetting quota:")
 
40
os.system("quota -v -u " + user);