Hi i am new to shell scripting, i need some help please.

I have a folder that i am sharing between my linux server and my windows computer. I want to do a shell script that let me know when the size of that folder has passed 110 gb, and i want to limit that folder to not take more disk space than 120 gb?

How do i accomplish this?

Thanks!:)

I remember on Solaris there was something called logadm. It used to manage file sizes (not folder). See if there is something similar in linux, if so it'll give you much more facilities without any coding.


Else write a script that will check the size. If you're looking for GB, -h option on ls might help.
Use ls and cut / awk to find the size.
Use expr to compare.
Once you have it just add it to crontab (linux scheduler), so cron will keep calling your script based on specified schedule like every minute, second, month,...
Post code if there is something more..

Else write a script that will check the size. If you're looking for GB, -h option on ls might help.
Use ls and cut / awk to find the size.
Use expr to compare.

Else write a script that will check the size. If you're looking for GB, -h option on ls might help.
Use ls and cut / awk to find the size.
Use expr to compare.

??

I remember on Solaris there was something called logadm. It used to manage file sizes (not folder). See if there is something similar in linux, if so it'll give you much more facilities without any coding.


Else write a script that will check the size. If you're looking for GB, -h option on ls might help.
Use ls and cut / awk to find the size.
Use expr to compare.
Once you have it just add it to crontab (linux scheduler), so cron will keep calling your script based on specified schedule like every minute, second, month,...
Post code if there is something more..

Thanks for your help,

I need som help, this is my script so far:-/

#!/bin/bash

space_used=`du -hs /home/blabla/Download`
echo "$space_used"

but i want to put this instead in my shell script.
When i do this in command prompt it works fine but when i put it in the shell script it does not work?

du -hs `/home/blabla/Download` | awk ' { print $1}' | cut -c 1,2

so how do i put this in the shell script to work?


Thanks

>> it does not work?
Can you tell something more abt the error?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.