Solved

How Do I Get HARD DISK FREE SPACE?

Posted on 1998-02-05
3
201 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

I've just discovered very important differences between Windows an Unix formats in Perl,at least 5.xx.. MOST IMPORTANT: Use Unix file format while saving Your script. otherwise it will have ^M s or smth likely weird in the EOL, Then DO NOT use m…
In the distant past (last year) I hacked together a little toy that would allow a couple of Manager types to query, preview, and extract data from a number of MongoDB instances, to their tool of choice: Excel (http://dilbert.com/strips/comic/2007-08…
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…
Six Sigma Control Plans

726 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