LinuxQuestions.org
Register a domain and help support LQ
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices

Reply
 
Search this Thread
Old 12-05-2008, 02:58 PM   #1
jojothedogboy
LQ Newbie
 
Registered: Jun 2008
Posts: 12

Rep: Reputation: 0
Bash script for listing FTP usage as the file name of a file created in each share


I admin a FTP server and need help setting something up to allow the FTP users to see if their individual share is full.

Set-up:
A Fedora Core 6 system running vsftp using LVM to segregate FTP shares (matching the directory names to the logical volume names).
Also, there are multiple accounts per share (ex: share "sales" has accounts "john" and "tom" that are separate chrooted directories inside of the "sales" Logical Volume.

Idea:
I have a cron script that does this:
Code:
df -H /dev/mapper/SCSI_RAID5-LogVolName | grep -v /dev/mapper/SCSI_RAID5-LogVolName | cut -c 24-47 > /data/LogVolName/ShareName/_FTP_Usage.txt
Results look like this:
Code:
Size   Used  Avail Use% 
 37G    33G   2.9G  92% 
20081205-1201
I couldn't figure out how to put the usage info into the file name (just an empty file titled "Usage-2.9G_Avail_out_of_37G.txt" or something) and each login/account needs to be a separate line of code.

What I'm looking for is help writing a script that will dynamically read which LogVols are currently in use then create files titled with account usage info written into the root of the appropriate account directories.

Any ideas? Even if you can just get me part of the way... any little bit helps. And if I'm totally missing the mark on this then please tell me! Anyway to let users see the amount of available space in their share will do the job.

-Thanks,
 
Old 12-05-2008, 03:35 PM   #2
jojothedogboy
LQ Newbie
 
Registered: Jun 2008
Posts: 12

Original Poster
Rep: Reputation: 0
Maybe something like:
Code:
#!/bin/bash
for i in $( cat fstab.test | grep /dev/SCSI-RAID5 | cut -f 1 ); do
df -H $i | cut -c 24-47 | grep -v Size | tee ~/df.test.log
done
Would something like that work?
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Save ftp directory listing into a file Vitalie Ciubotaru Linux - Software 1 06-30-2007 06:37 PM
ftp file listing: how to pipe to less? Lotharster Linux - Newbie 2 11-29-2005 08:45 PM
Using BASH script to transfer a file via (s)ftp senther Linux - Newbie 2 07-19-2005 04:47 PM
HELP: PERL script to retrieve file listing xboxter Programming 2 05-19-2005 09:19 AM
locking a usage policy file/ftp file permissions gbow Linux - Newbie 0 02-16-2004 05:35 AM


All times are GMT -5. The time now is 06:15 AM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration