Sponsored Content
Top Forums Shell Programming and Scripting Use date command to find last month Post 302131385 by jim mcnamara on Friday 10th of August 2007 09:53:47 AM
Old 08-10-2007
This will not work for a variety of reasons.
What happens on March 31 - You'll go back to February 31?
What happens on Jan 10?

Check the FAQ for perderabo's datecalc script. It will do just what you want.
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

find out month from a date

I would like to find out the month from a given date, how is it possible. (5 Replies)
Discussion started by: rudoraj
5 Replies

2. Shell Programming and Scripting

How to find the create time of a file if current date is in next month

Hi All, I want to find the time diffrence between currnt time and "abc.txt" file create time. I have solve that but if the abc.txt file created last month then is there any process to find the difftent? Exp: Create time of abc.txt is "Apr 14 06:48" and currect date is "May 17 23:47".... (1 Reply)
Discussion started by: priyankak
1 Replies

3. UNIX for Dummies Questions & Answers

Date command to obtain the last month is not working correctly..

Hello, I could not find the exactly same post here.. so I will explain what I did to get the last month using date command. I used date +%Y-%m -d "-1 months" to get the last month. However, the returned value of above command on 2009/10/31 was 2009 10 and not 2009 09.. and the... (9 Replies)
Discussion started by: tigersk
9 Replies

4. UNIX for Dummies Questions & Answers

print previous month (current month minus 1) with Solaris date and ksh

Hi folks month=`date +%m`gives current month Howto print previous month (current month minus 1) with Solaris date and ksh (7 Replies)
Discussion started by: slashdotweenie
7 Replies

5. UNIX for Dummies Questions & Answers

date command - getting previous month

Hi, On any given day, I want to capture the month that has gone by - said otherwise, how do I capture last month? expr date '+%m' - 1 Above expression is giving error. Please advise thanks ---------- Post updated at 09:28 AM ---------- Previous update was at 09:11 AM... (1 Reply)
Discussion started by: ab_2010
1 Replies

6. UNIX for Dummies Questions & Answers

Unix man command to find out month of the year?

how can i display month of the year i was born with using man command? thanks (2 Replies)
Discussion started by: janetroop95
2 Replies

7. Shell Programming and Scripting

Help with getting last date of previous month and first date of previous 4th month from current date

I have requirment to get last date of previous month and the first date of previous 4th month: Example: Current date: 20130320 (yyyymmdd) Last date of previous month: 20130228 (yyyymmdd) First date of previous 4th month: 20121101 (yyyymmdd) In my shell --date, -d, -v switches are not... (3 Replies)
Discussion started by: machomaddy
3 Replies

8. Red Hat

How to find/display out last Friday's date of the month?

Hello, Can you please help me find/display out last Friday's date of the month using command in Unix/Linux (3 Replies)
Discussion started by: sunnysthakur
3 Replies

9. Shell Programming and Scripting

How to find all files other than first two dates & last date per month and year?

how to find all files other than first two dates & last date per month and year Hi All, lets say there are following files in directory -rwxr-xr-x 1 user userg 1596 Mar 19 2012 a.txt -rwxr-xr-x 1 user userg 1596 Mar 19 2012 b.txt -rwxr-xr-x 1 user userg ... (6 Replies)
Discussion started by: Makarand Dodmis
6 Replies

10. Shell Programming and Scripting

Find one month before date

Hi, I want two dates one will be the current date and the other one will be just one month before. Say if current month is 11/4/2014 then the other date should be 11/3/2014. #!/bin/ksh currentDtae=`date` oneMonthBefore= ? I dont know how to do it. Went through some of the related threads... (15 Replies)
Discussion started by: Sharma331
15 Replies
FAQ(1)								       mrtg								    FAQ(1)

NAME
help - How to get help if you have problems with MRTG SYNOPSIS
MRTG seems to raise a lot of questions. There are a number of resources apart from the documentation where you can find help for mrtg. FAQ
Alex van den Bogaerdt <alex@ergens.op.Het.Net> maintains the MRTG FAQ website on http://faq.mrtg.org In the following sections you find some additonal Frequently Asked Questions, with Answers. Why is there no "@#$%" (my native language) version of MRTG Nobody has contributed a @#$%.pmd file yet. Go into the mrtg-2.9.17/translate directory and create your own translation file. When you are happy with it send it to me for inclusion with the next mrtg release. I need a script to make mrtg work with my xyz device. Probably this has already been done. Check the stuff in the mrtg-2.9.17/contrib directory. There is a file called 00INDEX in that directory which tells what you can find in there. How does this SNMP thing work There are many resources on the net, explaining about SNMP. Take a look at this article from the Linux Journal by David Guerrero: http://www.develnet.es/~david/papers/snmp/ And at this rather long document from CISCO http://www.cisco.com/univercd/cc/td/doc/cisintwk/ito_doc/snmp.htm The Images created by MRTG look very strange. Remove the *-{week,day,month,year}.png files and start MRTG again. Using MRTG for the first time, you might have to do this twice. This will also help, when you introduce new routers into the cfg file. What is my Community Name? Ask the person in charge of your Router or try 'public', as this is the default Community Name. My graphs show a flat line during an outage. Why ? Well, the short answer is that when an SNMP query goes out and a response doesn't come back, MRTG has to assume something to put in the graph, and by default it assumes that the last answer we got back is probably closer to the truth than zero. This assumption is not per- fect (as you have noticed), it's a trade-off that happens to fail during a total outage. If this is an unacceptable trade-off,use the unknaszero option. You may want to know what you're trading off, so in the spirit of trade-offs, here's the long answer: The problem is that MRTG doesn't know *why* the data didn't come back, all it knows is that it didn't come back. It has to do something, and it assumes it's a stray lost packet rather than an outage. Why don't we always assume the circuit is down, and use zero, which will (we think) be more nearly right? Well, it turns out that you may be taking advantage of MRTG's "assume last" behaviour without being aware of it. MRTG uses SNMP (Simple Network Management Protocol) to collect data, and SNMP uses UDP (User Datagram Protocol) to ship packets around. UDP is connectionless (not guaranteed) - unlike TCP where packets are tracked and acknowledged and, if needed, re-transmitted, UDP just throws packets at the network and hopes they arrive. Sometimes they don't. One likely cause of lost SNMP data is congestion, another is busy routers. Other possibilities include transient telecommunications prob- lems, router buffer overflows (which may or may not be congestion-related), "dirty lines" (links with high error rates), and acts of God. These things happen all the time, we just don't notice because many interactive services are TCP-based and the lost packets get retransmit- ted automatically. In the above cases where some SNMP packets are lost but traffic is flowing, assuming zero is the wrong thing to do - you end up with a graph that looks like it's missing teeth whenever the link fills up. MRTG interpolates the lost data to produce a smoother graph which is more accurate in cases of intermittent packet loss. But with V2.8.4 and above, you can use the "unknaszero" option to produce whichever graph is best under the conditions typical of your network. AUTHOR
Tobias Oetiker <oetiker@ee.ethz.ch> 3rd Berkeley Distribution 2.9.17 FAQ(1)
All times are GMT -4. The time now is 12:49 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy