Solved

How Do I Get HARD DISK FREE SPACE?

Posted on 1998-02-05
3
197 Views
Last Modified: 2006-11-17
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()).

Thanks.
0
Comment
Question by:mirror
3 Comments
 
LVL 5

Expert Comment

by:icd
ID: 1209720
Need to know what operating system your web site is running on. Unix or NT for example?

0
 

Accepted Solution

by:
grsshpper earned 50 total points
ID: 1209721
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
system("command");

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

anyway here's how it works ....

#!/usr/bin/perl

# 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


0
 

Expert Comment

by:ljaques
ID: 1209722
Operating systemn is for both NT and Unix.
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Email validation in proper way is  very important validation required in any web pages. This code is self explainable except that Regular Expression which I used for pattern matching. I originally published as a thread on my website : http://www…
A year or so back I was asked to have a play with MongoDB; within half an hour I had downloaded (http://www.mongodb.org/downloads),  installed and started the daemon, and had a console window open. After an hour or two of playing at the command …
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
This Micro Tutorial will give you a basic overview how to record your screen with Microsoft Expression Encoder. This program is still free and open for the public to download. This will be demonstrated using Microsoft Expression Encoder 4.

867 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now