disk quotas shell script


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting disk quotas shell script
# 1  
Old 02-16-2012
Question disk quotas shell script

Hello.. I wrote the following shell script to run disk quotas for assigning limits to users. I need to know the partition which the user has created and mount it. So i copied the partitions (which will be displayed after running fdisk -l) and separted the last line from it and cut the required partition name from it. Then this should be passed to the next line (using mount). Here I am facing the problem.. It is returning the error "device not found", that means the variable "$part" is not giving the partition name..

The following is my code:
Code:
VSIZE=100m;

fdisk /dev/sda >/dev/null 2>&1 <<EOF
n
p
3

+${VSIZE}M
w
EOF

partprobe /dev/sda

fdisk -l > file1

awk 'NF{s=$0}END{print s}' file1 > file2

part=(`cut -c "1 2 3 4 5 6 7 8 9 10" file2`)

mkfs.ext3 $part

mkdir /var/likes

mount $part /var/likes

chmod 777 /var/likes

quotacheck -cugv /var/likes

quotaon $part

setquota -u kal 2 3 4 5 -a $part

Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Help me with C-shell Script: Disk checking

Hi, i am new in shell script. i have given a task to make a C-shell script. I have list of ip address and device name respectively. For example; cal 1 : 100.21.25.10 cal 2 : 100.21.25.11 cal 3 : 100.21.25.12 cal 4 : 100.21.25.14 and so on... Right now, i have this. #! /bin/csh -f ... (0 Replies)
Discussion started by: lattey
0 Replies

2. UNIX for Dummies Questions & Answers

Disk Quotas

Hi, I'm practicing new things with Linux/Unix and I need someone to point me at the right direction. Lets say I create a user named user1. After creating it, how would I enable quotas for it. I have already added "userquota" under "/etc/fstab" and rebooted my system, but after I run the command... (1 Reply)
Discussion started by: abhi7514
1 Replies

3. Homework & Coursework Questions

Disk Capacity Shell Script

Use and complete the template provided. The entire template must be completed. If you don't, your post may be deleted! I am pretty close I think, but stuck. I don't know how to send an email to the user specified on the command line, and I receive an error stating -ge expecting a unary value(lines... (14 Replies)
Discussion started by: polyglot0727
14 Replies

4. Shell Programming and Scripting

Help with Disk Space script in bash shell

Hi Guys, I'm a newb at shell scripting and successfully attempted a small disk space script (victory!!) but i'm wondering whether it actually takes into consideration KB,MB,GB. Please take a look at the script and advise. ##script to check if file sys has reached threshold. ... (3 Replies)
Discussion started by: Irishboy24
3 Replies

5. Shell Programming and Scripting

shell script to alert cpu memory and disk usage help please

Hi all can any one help me to script monitoring CPU load avg when reaches threshold value and disk usage if it exceeds some % tried using awk but when df -h out put is in two different lines awk doesnt work for the particular output in two different line ( output for df -h is in two... (7 Replies)
Discussion started by: robo
7 Replies

6. Shell Programming and Scripting

Disk Monitoring shell script giving incorrect information

Hi All, OS: Linux 86x64 bits Red Hat Linux I get the email alert for the following when Alert condition is set for 30: /dev/sda1 99M 21M 74M 22% /boot -> Below 30%(Should not get the email alert) Expected output as per E-Mail alert: /dev/sda3 20G ... (2 Replies)
Discussion started by: a1_win
2 Replies

7. Shell Programming and Scripting

shell script to create disk load

friends , need a shell script to create a disk load. can any one pls guide me with how this can be implemented. Pls provide the concept. from there i will try to design my script. (3 Replies)
Discussion started by: achak01
3 Replies

8. Shell Programming and Scripting

Kill shell script when host program not running/disk unmounted

I have my Mac OS X program executing a shell script (a script that copies files to a drive). I want to make it so that the shell script automatically kills itself if it finds that the host .app is not running OR kill itself if the drive that it is copying files to has been unmounted. Right now what... (2 Replies)
Discussion started by: pcwiz
2 Replies

9. Shell Programming and Scripting

Need help!! script for quotas

here is the file i must use to write my script (from a repquota -g) : Group used soft grace ... group1 -- 270000 0 0 ... group2 -- 1500005 0 0 ... group3 -- 55 0 0 ... ... ... ... ... the script has to... (2 Replies)
Discussion started by: tomapam
2 Replies

10. UNIX for Advanced & Expert Users

disk quotas in UNIX?

RedHat 7.0 Caldera 2.4 From Windows 2000 server, you can allow ceratin users to use only so much disk space when they login. I'm sure you can do that in Linux/UNIX, but I just don't know how or what you call them here (disk quotas maybe?). Anyway, any kind help is always greatly appreciated.... (1 Reply)
Discussion started by: zorro81
1 Replies
Login or Register to Ask a Question
REPQUOTA(8)						    BSD System Manager's Manual 					       REPQUOTA(8)

NAME
repquota -- summarize quotas for a file system SYNOPSIS
repquota [-g] [-u] [-v] filesystem ... repquota [-g] [-u] [-v] -a DESCRIPTION
Repquota prints a summary of the disk usage and quotas for the specified file systems. Available options: -a Print the quotas of all the filesystems configured with a quota mount option file at its root. -g Print only group quotas (the default is to print both group and user quotas if they exist). -u Print only user quotas (the default is to print both group and user quotas if they exist). -v Print a header line before printing each filesystem quotas. For each user or group, the current number of files and amount of space (in kilobytes) is printed, along with any quotas created with edquota(8). Only members of the operator group or the super-user may use this command. FILES
Each of the following quota files is located at the root of the mounted filesystem. The mount option files are empty files whose existence indicates that quotas are to be enabled for that filesystem. .quota.user data file containing user quotas .quota.group data file containing group quotas .quota.ops.user mount option file used to enable user quotas .quota.ops.group mount option file used to enable group quotas SEE ALSO
quota(1), quotactl(2), edquota(8), quotacheck(8), quotaon(8) DIAGNOSTICS
Various messages about inaccessible files; self-explanatory. HISTORY
The repquota command appeared in 4.2BSD. 4.2 Berkeley Distribution March 28, 2002 4.2 Berkeley Distribution