How do I get Perl to report the remaining disk space on my web site.  I want my perl script to email me back this free disk space.  Also what about free memory?

I know in C I used special commands for getting free disk space and free amount of memory (free()).

Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Need to know what operating system your web site is running on. Unix or NT for example?

I am making the assumption that you are using a Unix system of
dsome sort. but even if that is wrong, the following program should give you enough of an idea so that you can substitute where necessary.

You can execute system commands in Perl with the command

so system("cp abc def");
will copy file abc to file def in Unix

anyway here's how it works ....


# nb you may have a different location for your perl interpreter
# set line 1 to point to wherever it is.

# execute standard Unix command "df" to report disk space and
# usage and redirect output to the file called space.out
# alternatively if you have compiled C program that reports
# on disk statistics then you could call that and redirect
# its output to the file space.out

system("df > space.out");

#at this point you should call a script to email you the
#contents of space.out


Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Operating systemn is for both NT and Unix.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.