Solved

How Do I Get HARD DISK FREE SPACE?

Posted on 1998-02-05
3
196 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

Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

Join & Write a Comment

Suggested Solutions

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…
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…
In this tutorial you'll learn about bandwidth monitoring with flows and packet sniffing with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're interested in additional methods for monitoring bandwidt…

760 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

20 Experts available now in Live!

Get 1:1 Help Now