Results 1 to 4 of 4
Hi all, I am a newbie on Bash script as well. And How can I actually implement the task below?
a. Check the user's storage. If a user storage at ...
- 09-30-2008 #1Just Joined!
- Join Date
- Sep 2008
- Posts
- 2
Bash script help!
Hi all, I am a newbie on Bash script as well. And How can I actually implement the task below?
a. Check the user's storage. If a user storage at /home/username directory has reached preset storage limit like 100MB, send him an email.
b. And also shows the files which is larger than 100K at /home/username directory, giving the user an option either to delete it or compress it, then show him the next file.
c. Write a "safe" delete command script. Filenames passed as command-line arguments to this script are not deleted, but instead gzipped if not already compressed, then moved to a /home/username/trash directory.
Thanks in advance...
- 09-30-2008 #2
This sounds like a homework assignment to me, which it is against forum rules for us to straight up give answers to questions. Look online for bash tutorials and linux commands to give you those informations.
- 09-30-2008 #3
You could use the du command for the particular home directory with the 's' and 'h' option. Faster than this is to employ quotas, but the filesystem has to be formated in a certain format for this.
"find /home/username -size +100k" lists all such files.
You can have aliases for commands via the shell. If the user executes 'rm', a wrapper application is executed instead. This wrapper applies gzip on the file, deletes the original and moves the file to a /home/username/trash directory. The "trash" had better to begin with a dot so that it is not shown in the normal directory listing but is hidden.Debian GNU/Linux -- You know you want it.
- 09-30-2008 #4Just Joined!
- Join Date
- Sep 2008
- Posts
- 2


Reply With Quote
