LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 04-20-2011, 04:38 PM   #16
unSpawn
Moderator
 
Registered: May 2001
Posts: 29,415
Blog Entries: 55

Rep: Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600

Quote:
Originally Posted by SigTerm View Post
I don't care.
Well, you should IMHO. Sure we'd like to get more people to become self-reliant by knowing what to read and actually reading the manual pages and you did get your point across but there's no need to drive the point home post after post: just once should do.


That said this thread started off on the wrong foot by the OP also not giving a rats *ss about how to talk to other members let alone the fact his "This isn't my first time writing scripts" claim doesn't come across as completely believable...
 
Old 04-20-2011, 06:57 PM   #17
dagummit
LQ Newbie
 
Registered: Sep 2009
Posts: 26

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by SigTerm View Post
It doesn't matter and I don't care.

I learned what I know by reading documentation - because when you read documents, in addition to what you need, you'll pick many additional bits of information that will help you later. When somebody gives you complete solution, you won't get those extra bits of info, and you'll learn less.

Another problem is that you asked in the wrong place and it looks like you haven't asked a moderator to move your thread.
I have asked for the thread to be moved. Have a wonderful day!
 
Old 04-20-2011, 06:59 PM   #18
dagummit
LQ Newbie
 
Registered: Sep 2009
Posts: 26

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by dugan View Post
He's referring to this, in case anyone's wondering:

http://www.linuxforums.org/forum/red...ercentage.html
no, this is where I got it from:
http://bashscripts.org/forum/viewtopic.php?f=8&t=1358
 
Old 04-20-2011, 07:08 PM   #19
dagummit
LQ Newbie
 
Registered: Sep 2009
Posts: 26

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by unSpawn View Post
Well, you should IMHO. Sure we'd like to get more people to become self-reliant by knowing what to read and actually reading the manual pages and you did get your point across but there's no need to drive the point home post after post: just once should do.


That said this thread started off on the wrong foot by the OP also not giving a rats *ss about how to talk to other members let alone the fact his "This isn't my first time writing scripts" claim doesn't come across as completely believable...
Maybe you are directing this elsewhere besides me, but I thought I asked quite politely for my question. And if you are driving at the fact that I stood my ground to his (or her) BS response to my first post...and still can't see where he (or she) was being a complete a$$ in the response...then you are blind.

I have also asked for this thread to be moved in a couple of different avenues. As far as the poke on about me writing scripts before, fine, believe what you want...but I am not a NAUF on them...I just didn't know how to grab this particular aspect. But I am glad that there are folks out there that can answer simple questions (wasn't anyone here)...without the need to demoralize people (and that last part of the statement includes you as well).
 
0 members found this post helpful.
Old 04-20-2011, 07:27 PM   #20
unSpawn
Moderator
 
Registered: May 2001
Posts: 29,415
Blog Entries: 55

Rep: Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600
Quote:
Originally Posted by dagummit View Post
I thought I asked quite politely for my question.
And that's about where it ended as you focused on being argumentative from there on. Sure it's not nice to find there's no immediate silver spooning happening but that should not force you to tell your fellow LQ members to shut up, qualify them as "meaningless response" or a member as "an ass".


Quote:
Originally Posted by dagummit View Post
I have also asked for this thread to be moved in a couple of different avenues.
Not the way it should have been done: by using the report button on your initial post.


Quote:
Originally Posted by dagummit View Post
As far as the poke on about me writing scripts before, fine, believe what you want...but I am not a NAUF on them...I just didn't know how to grab this particular aspect. But I am glad that there are folks out there that can answer simple questions (wasn't anyone here)...without the need to demoralize people (and that last part of the statement includes you as well).
What you should understand is tht there are different ways of learning. Like a lot of members here I prefer the Socratic method. Not only in the hope that asking the right questions helps people to learn but also because it helps me gauge to what extent help is needed. That's why I asked you to post (pseudo) code. If you're this easily miffed then please take that into account next time before you reply, OK?
 
Old 04-20-2011, 07:44 PM   #21
dagummit
LQ Newbie
 
Registered: Sep 2009
Posts: 26

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by unSpawn View Post
And that's about where it ended as you focused on being argumentative from there on. Sure it's not nice to find there's no immediate silver spooning happening but that should not force you to tell your fellow LQ members to shut up, qualify them as "meaningless response" or a member as "an ass".
and his first response was all roses? Don't think so... his post was completely unneeded...and quite frankly for a Linux community, very anti-"open source". Heck, he even was disappointed in not getting paid for his 'work'. Of which I would have gladly done if it was allowed, but he painted the path...so he should be able to deal with it. Personally, I don't think he knew the answer to begin with... most people that like to chime in in that manner are nothing more than bogart'ers that don't know the answer to begin with.


Quote:
Not the way it should have been done: by using the report button on your initial post.
I did that, this morning, when reading another posters feedback.



Quote:
What you should understand is tht there are different ways of learning. Like a lot of members here I prefer the Socratic method. Not only in the hope that asking the right questions helps people to learn but also because it helps me gauge to what extent help is needed. That's why I asked you to post (pseudo) code. If you're this easily miffed then please take that into account next time before you reply, OK?
And yet another great example of learning is in fact, learning by example. Sun Tzu used it all of the time...as well as most military and academic settings. To tell someone to 'read the manual' is about as disingenuous as providing mockery of the question (which was also done under this thread...ie, "this is trivial).

And to the posting my code already...as I have already stated...why does that matter? Why was it possible for someone else on a different site able to answer my question without all of the "what ifs"? Sometimes a question can be answered in its basic form without reading into the question (also by Sun Tzu...paraphrased).
 
0 members found this post helpful.
Old 04-21-2011, 01:43 AM   #22
XavierP
Moderator
 
Registered: Nov 2002
Location: Kent, England
Distribution: Debian Testing
Posts: 19,192
Blog Entries: 4

Rep: Reputation: 475Reputation: 475Reputation: 475Reputation: 475Reputation: 475
As requested, moved to Linux-General
 
Old 04-21-2011, 06:35 PM   #23
lisle2011
Member
 
Registered: Mar 2011
Location: Surrey B.C. Canada (Metro Vancouver)
Distribution: Slackware 2.6.33.4-smp
Posts: 183
Blog Entries: 1

Rep: Reputation: 25
Talking Scripts

The resource you connected with gave you a good script. I only wonder if you may have dissected it to understand how it works.

Here are some other options, maybe not the best coding but they work well.

Perl
#!/usr/bin/perl
open PS, "df -h /var | grep /var |"|| die "Error, cannot open pipe: $!\n";
while(<PS>) {
chomp;
@tmp=split(/\s+/,$_);
$var = substr($pct = @tmp[4],0,2);
}
# what to do if $var > 90

# what to do if $var < 90
exit 0;

php
#!/usr/bin/php
<?php
error_reporting(E_ALL);

$handle = popen("df -h /var | grep /var","r");
$read = fread($handle, 2096);
$pos = strpos($read, "%");
$pct = substr($read, $pos-2, 2);
pclose($handle);

# what to do if $var > 90

# what to do if $var < 90

exit(0);
?>

I do have a concern to share with you. 90% disk usage is a little dangerous. No disk drive was ever mean't to be filled up because computers write so heavily to disk it could bring your system down. The general consensus among professionals is that 75% is optimal. 80% is a little edgy but 90% could bring you unhappiness. Computers are not perfect and if your script should fail to run... well you could have a problem.

Hard drives are cheap and the carrier case for them to plug into a USB port is also cheap.

As a parting note, I learned how to write scripts by myself from books and by studying the scripts of others and at times stealing their stuff altogether. Linux is more challenging than Windows or Mac and that is why so many stay away and go with the big boys. Good luck with your backups and your scripting.

Using grep to isolate the actual data from the header is the most expedient way, but only a small amount more of perl or php code would have done as well.
...
...
 
Old 04-27-2011, 11:48 AM   #24
lisle2011
Member
 
Registered: Mar 2011
Location: Surrey B.C. Canada (Metro Vancouver)
Distribution: Slackware 2.6.33.4-smp
Posts: 183
Blog Entries: 1

Rep: Reputation: 25
The resource you connected with gave you a good script. I only wonder if you may have dissected it to understand how it works.

Here are some other options, maybe not the best coding but they work well.

Perl
#!/usr/bin/perl
open PS, "df -h /var | grep /var |"|| die "Error, cannot open pipe: $!\n";
while(<PS>) {
chomp;
@tmp=split(/\s+/,$_);
$var = substr($pct = @tmp[4],0,2);
}
# what to do if $var > 90

# what to do if $var < 90
exit 0;

php
#!/usr/bin/php
<?php
error_reporting(E_ALL);

$handle = popen("df -h /var | grep /var","r");
$read = fread($handle, 2096);
$pos = strpos($read, "%");
$pct = substr($read, $pos-2, 2);
pclose($handle);

# what to do if $var > 90

# what to do if $var < 90

exit(0);
?>

I do have a concern to share with you. 90% disk usage is a little dangerous. No disk drive was ever mean't to be filled up because computers write so heavily to disk it could bring your system down. The general consensus among professionals is that 75% is optimal. 80% is a little edgy but 90% could bring you unhappiness. Computers are not perfect and if your script should fail to run... well you could have a problem.

Hard drives are cheap and the carrier case for them to plug into a USB port is also cheap.

As a parting note, I learned how to write scripts by myself from books and by studying the scripts of others and at times stealing their stuff altogether. Linux is more challenging than Windows or Mac and that is why so many stay away and go with the big boys. Good luck with your backups and your scripting.

Using grep to isolate the actual data from the header is the most expedient way, but only a small amount more of perl or php code would have done as well.
...
...


All the best
David

---------- Post added 04-27-11 at 09:48 AM ----------

You should mark this post as SOLVED
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Reserved blocks percentage for a partition without OS Mr. Alex Linux - Newbie 1 11-30-2010 09:26 AM
Need advice on a script to search many files for list of terms, append hits to list jimmy the saint Programming 1 07-11-2010 03:59 AM
script to tar all files last month and place to another partition packets Programming 4 11-19-2009 05:38 AM
Need help writing a script to tar/delete old files aboleth Programming 5 07-23-2009 10:15 AM
Installing .tar.gz files downloaded to a separate partition talpa_sai Linux - Newbie 3 09-08-2006 02:06 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 05:33 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration