Last month's date in cron?

Hi folks,
I'm trying to write a cron command that'll create a new folder sometime after the first of the month which will be named with the year and month of LAST month. I want to load each month's awstats files in those folders after the log has been analyzed for the entire month. I've got
mkdir /path/to/$(date +%Y%m)
which works to give me the current month.
I'm also open to other approaches if you've got them...
Thanks.

Can't figure out how to do this with date, but this test opened as per spec at 8:30 am today.
30 8 1 * * mkdir /Users/dougp/Desktop/August_09
The way this is though, you have to reset the August_09 date before next month. You could also put a cheap script to write your awstats to a file in that Aug, etc directory too.
Message was edited by: doug pennington

Similar Messages

  • Last month end date based on current date

    Hi,
    How to show last month end date based on the current date.
    Eg:
    Current date = "08/26/09"
    Var- Last Month End Date = "07/31/09" etc...,
    Please help me how to get it...
    Thank You!

    Good to hear that it worked for you. but not for me.
    I tried like this:
    1st::
    1. var1= ToDate("06/30/09","MM/dd/yyyy")
    2.Var2= RelativeDate([Var1];-DayNumberOfMonth([Var1]))
    result: 5/30/09
    2nd:
    RelativeDate('6/30/2009';-DayNumberOfMonth('6/30/2009'))
    result: 5/30/09
    Am working on SAP OLAP cubes.
    Please help me where am going wrong....
    Thank You!

  • Getting Last Month End date

    Dear Experts,
    I want the following result. I have a date parameter. I want to
    get the last / end date of the previous month
    for any given date which the user inputs.
    For ex:
    If user puts the date 15.06.2008
    then i want to get the previous month end date i.e. 31.05.2008.
    The reason being i am creating a program for updating Opening and Closing Stocks of every month in a ZTABLE. The user will put the date in the parameter and system will bring the closing stock of previous month and then calculate for the current month.
    I hope i am not complicating matters too much....
    Basic funda is to arrive at the end date of the previous month for any date which the user puts.
    Please help me... it is mission critical..
    Thanks & Regards,
    Jitesh M Nair

    hi,
    use this to get last month end date.
    ex:
    data: d2 like sy-datum.
    d2 = sy-datum.
    d2+6(2) = '01'.
    d2 = d2 - 1. "prev mnth last date
    write:/ d2.

  • Last month with data  - BEx variable

    Hi guys,
    I am using in the query the char 0CALMONTH to restrict the KF amount, just to get the last month of data that was loaded in the infocube. I tried with content variables but none of them are working. I used 0CYMONTH or 0CMLMON.
    the only thing that I want is to get from the cube always the last month with data that was loaded.
    Do I need to create a customer exit? does anyone has the code to give me?
    any help¡?
    thank u.
    E.V.

    Hi,
    two alternatives:
    VarExit: perform a select statement on your cube joined with your time dimension; or even directly on your time dimension something like:
    SELECT MAX(SID_0CALMONTH) FROM /BIC/D<cube>T.
    This will give the last CALMONTH with posted data in absolute (not considering your query selection)
    <i>Replacement path variable based on a query: create a query which has to return one record an 0CALMONTH in the columns. Put a TOP1 condition on one of your KeyFig. In your original query restrict 0CALMONTH with a variable of type replacement path on the TOP1 query. The advantage of this alternative is that you can get the last CALMONTH posted with data RELATIVE to your query selections if you move your variables input from the user to the TOP1 query...</i>
    Sorry, the above won't work it out; I just has the same requirement and implemented the varexit reading the time dim table.
    hope this helps....
    Olivier.
    Message was edited by:
            Olivier Cora

  • Fetch last month's data

    Version:10gR2
    I want all records created last month. The following query includes records created on October 2009, 2008,.... But i want the records created only this year.
    select * from dba_users where to_Char(created,'MM') = to_char(sysdate,'mm')-1I can't add a hardcoded year filter like
    AND to_char(created,'YYYY') = 2010The year filter should be dynamic.

    Hi,
    As Dombrooks said, don't convert from one data type to another if you don't have to.
    When run during November 2010, the solution Dombrooks posted
    select  *
    from    dba_users
    where   created >= trunc (sysdate, 'MM') - 1
    ;will find created dates on or after October 31, 2010.
    If you want created dates from October 1, 2010 through October 31, 2010, then use:
    SELECT  *
    FROM    dba_users
    WHERE   created >= ADD_MONTHS (TRUNC (SYSDATE, 'MM'), -1)
    AND     created <              TRUNC (SYSDATE, 'MM')
    ;

  • Last Month's data

    How do you report on last months data. I know there is a session variable for current month, i.e. VALUEOF(NQ_SESSION.CURRENT_MONTH), that I've used in a column formula to filter the data, but there doesnt seem to be one for last month, so how do I get around this? I'm creating a report for Sales Pipleline and trying to show the TCV for this month and last month in order to compare the two. Some assistance please?

    Hi Alex,
    Thanks for the reply. So Can you just confirm, are you saying that within analytics there is no way for me to get the TCV value of an opportunity as of last month or last week? I put together a report to try and show the TCV value from last week and I used a filter with the column formula for my TCV value, my formula was; FILTER("Historical Sales Stage".Revenue USING (Opportunity."Close Date" >=  VALUEOF("LAST_WEEK_BEGIN_DT"))), but from what you are saying I dont think this can work and I havent really had time to test it out properly. I then had another TCV column with a filter of; FILTER("Historical Sales Stage".Revenue USING (Opportunity."Close Date" >=  VALUEOF("CURRENT_WEEK_BEGIN_DT"))). At the moment I'm getting the same value which could be because I havent changed any data or like you say you can only report on current values. What do you think?
    Regards

  • Process chain for updating a cube with last month's data everyday.

    Hi everybody,
    I need a suggestion on designing the process chain. I have the cube Zxx_xx. I will explain my requirement with an example. Suppose I uploaded the cube with data up to 201103. Each night in May, I want to upload the cube with April's data. So each night the previous request should be deleted. When May finishes, this time, each night I need to upload the cube with May's data. I handled everything except deleting the data from PSA. I need the data loaded in the cube stay at PSA. In this case the request including data till 201103,  the request loaded for April, and finally in June, I need to see the request loaded for May. In the last step of the process chain I added the process for deleting PSA data choosing my infosource, but I have no option for deleting the requests where I have uploaded from same infopackage with same selections. Please help handling this situation.
    thanks in advance.
    Yasemin.

    hi,
    You can achieve this by loading the cube through two different DTP's.
    DTP1 to have in the routine to pick data for month-2 i.e. in june it picks up April data.
    DTP2 to restrict the month in routine to month-1 i.e. in june it picks up May data.
    Now the design of process chain will be as follows:
    process chain to have an step "Decision Between Multiple Alternatives "
    in this decision step you can write formula to check if sy-datum is 01, first of every month.
    if step: formula
    ( RIGHT( 2, Current Date ) = '01' )
    On first of every month load for month-2 as well as month-1 and delete overlapping request for month-1. Variant described below.  DTP1, DTP2 and then Delete overlapping request step
    Else part of Decision Between Multiple Alternatives will be executed for all other days
    load only month-1 and delete overlapping request from cube. DTP2 and then Delete overlapping request step.
    in the pc there is variant "Delete overlapping request"
    in that choose variant type DTP, give the technical name of DTP2 and save it.
    this way the whole data loading will be automated and you need not intervene to delete data manually,
    regards,
    Arvind.

  • Last month my data cycle was from the 12th to the 12th. Now for the end of this month its til the 20th. Why are there more days between when my data cycle refreshes from last month?

    I guess I said everything in the topic...anyways, from March 12 to April 12 was the data cycle. After April 12 it shot up to May 20th! That's a whole extra week of data that is definitely going to be over because there are more days use data? Why?

    G42od wrote:
    We share 4gb for our plan. It works out perfectly usually. But this month says the new data cycle doesn't start til the 20th. We've already gone over a gig easily in this extra week. My billing cycle is always set at the 15th of every month and that has not been a problem...until we go over in data and get charged more money. Is the data cycle going to fluctuate every month?
    Your billing cycle and your "data cycle" are the same, and that cycle doesn't change, unless you request it or maybe if you bundle services or something.  For example, my bill cycle runs from the 18th of one month through the 17th of the next.  My due date sometimes varies a few days, not really sure why, probably because not all months have the same number of days. If you look at the breakdown by line on your bill, you will see these dates.  What you are describing sounds like the due date is different than usual. All lines on the same account have the same billing cycle for all services...calling/texting plan, data plan, insurance, etc.
    I am a little confused, though, because you stated your "data cycle" is always the 12th through the 12th (it would actually be the 13th through the 12th), then you say the bill cycle is always set for the 15th, and then you say the data cycle is pushed to the 20th this month.  What is the billing cycle for the voice/text plan? What date did the bill print (this should be on the first page)? Finally, what is the due date on the most recent bill?  Bill cycle and due dates are not the same.

  • Need to DELETE and LOAD data of the Last month to

    Hi Experts,
    I need to delete the last month data from cube because One material is not updated with a Required value. We have made some changes in Update routine for a Value. The Same change must be reflected from last month of data ,
    So I need to delate the data based on selection. And reload  the data again. And the data flows from
                                               2LIS_13_VDITM (Info Source ) to ZSD_C03 (Info Cube). 
    I read many SDN threads, but I am getting confused.
    How can I proceed for these  ?
    Thanks,
    Utpal.

    Hi Srikanth,
    Thank you for responding.
    I had a problem on one material. So deleted the request and Reload it from PSA. That issue got solved.
    And Now the problem is , Now my senior is saying Delete the data from April-09 till date and Reload it. The issue is My CUBE ( ZSD_C03 ) is updated with 4 data sources. 2LIS_11_V_ITM   ,  2LIS_13_VDITM   ,  2LIS_12_VCHDR  , 2LIS_11_VAITM .
    And I need to delete data from 2LIS_13_VDITM  data source . How Can I proceed for the current issue   ?
    Please suggest   ...
    Thank you ,
    Utpal

  • Need to get data till last month end by using Calday

    Hello SAPiens,
    Could anybody please guide me how to get the data till last month end date.
    Example: If i m executing a report in 05 November 2009 then i should get all the details of last month till last date of the Calmonth. thanks in advance.
    Regards,
    Sandy.S

    Hi,
    you can do the following:
    Create a Customer Variable for Calday
    EXIT_SAPLRSOO_001 ---> Include ZXRSRUO1 write the code for the variable created above
    DATA : date TYPE sy-datum.
    date = sy-datum. "Today
    date+6(2) = '01'. "First day of this month
    date = date - 1. "Previous day before first day of this month = last day of last month
    Or
    you can you many function Modules
    CALL FUNCTION 'RP_LAST_DAY_OF_MONTHS
    FKK_LAST_DAY_OF_MONTH
    OIL_LAST_DAY_OF_PREVIOUS_MONTH
    Santosh

  • How to set variant which gives date range of last month for sel.scr field

    Hi All,
    I want to set a variant which can do dynamic date calculation, need get last month period i.e when i select a variant it should always pick last month start date & end date for the period selection field. How can i achieve that. Please help me to know that.
    Thanks in advance.
    Regards
    Vishal

    I think in the date selection you can put in the calculations last month start date and end date, did you see what options you are getting in the variant? I am not in front of the system, so can't see.
    <b>I just looked up and found that you can specify the first and last day of the last month in the variant dynamic value setting.</b> When you saving the variant, select the check box for the SELECTION VARIABLE and then click the dynamic value calculation second traffic light. Then you will get drop down where you can select the values.
    Regards,
    Ravi
    Note : Please mark all the helpful answers
    Message was edited by: Ravikumar Allampallam

  • SSRS expression for today,yesterday,Lastweek ,Last fortnight,Last Month, Year to date

    Hi All;
    I have a field called createdon 
    Using this field i need to create the SSRS expression for the table as below 
    Any help much appreciated
    Thanks
    Pradnya07

    use expressions as below
    assuming this is to be done in SSRS
    Today
    =COUNT(IIF(
    DateDiff(DateInterval.Day,Cdate("01/01/1900"),Fields!createdon.Value) = DateDiff(DateInterval.Day,Cdate("01/01/1900"),Now()),Fields!YourRequiredField.Value,Nothing))
    Yesterday
    =COUNT(IIF(
    DateDiff(DateInterval.Day,Cdate("01/01/1900"),Fields!createdon.Value) = DateDiff(DateInterval.Day,Cdate("01/01/1900"),Now())-1,Fields!YourRequiredField.Value,Nothing))
    LastWeek
    =COUNT(IIF(
    DateDiff(DateInterval.Week,Cdate("01/01/1900"),Fields!createdon.Value) = DateDiff(DateInterval.Week,Cdate("01/01/1900"),Now())-1,Fields!YourRequiredField.Value,Nothing))
    Last fortnight
    =COUNT(IIF(
    (DateDiff(DateInterval.Week,Cdate("01/01/1900"),Fields!createdon.Value) = DateDiff(DateInterval.Week,Cdate("01/01/1900"),Now())-1)
    Or (DateDiff(DateInterval.Week,Cdate("01/01/1900"),Fields!createdon.Value) = DateDiff(DateInterval.Week,Cdate("01/01/1900"),Now())-2),Fields!YourRequiredField.Value,Nothing))
    Last Month
    =COUNT(IIF(DateDiff(DateInterval.Month,Cdate("01/01/1900"),Fields!createdon.Value) = DateDiff(DateInterval.Month,Cdate("01/01/1900"),Now())-1,Fields!YourRequiredField.Value,Nothing))
    Year To Date
    =COUNT(IIF(DateDiff(DateInterval.Year,Cdate("01/01/1900"),Fields!createdon.Value) = DateDiff(DateInterval.Year,Cdate("01/01/1900"),Now())
    And
    DateDiff(DateInterval.Day,Cdate("01/01/1900"),Fields!createdon.Value) <= DateDiff(DateInterval.Day,Cdate("01/01/1900"),Now()),Fields!YourRequiredField.Value,Nothing))
    Please Mark This As Answer if it helps to solve the issue Visakh ---------------------------- http://visakhm.blogspot.com/ https://www.facebook.com/VmBlogs

  • For the last month or so my icloud won't back up, it keeps telling me that there is too much storage and I need to delete some data. But I have deleted between 3-400 photos and it is still saying the same, can anyone please help

    For the last month or so my icloud won't back up, it keeps telling me that there is too much storage and I need to delete some data. But I have deleted between 3-400 photos and it is still saying the same, can anyone please help

    If they were deleted from your camera roll that should have resulted in a corresponding decrease in the estimated size of your next backup.
    If it's still saying that you don't have enough storage to back up, read through this article: http://support.apple.com/kb/ht4847.  It provides some suggestions for reducing your iCloud storage, such as deleting unneeded email. 
    The other area to look at is your text messages.  These are included in the backup.  If you have lots of photos and videos attached to your messages, that can significantly increase the size of your backup.  If that's the case, deleting these may make a big difference.

  • Last 6 months of data from current date

    Hi Experts,
    I have a requirement in WebI to display last 6 months of data based on current date.Actually I have a column called "Employee Contract Start date" in my report.Suppose the end user executes the report today,then he should be able to see the Employee's data whose contract started today and in the last 6months from current date.
    Also I have dimension object name "Employee Contract Start Date".
    Please be noted that I am getting the data from Bex Query and I am working on BO 4.1 version.
    I have Objects "Calender day" , "Cal.year/Month" , "Calender month" , "Employee Contract Start Date" in the BEx Query.
    Could anyone please propose me, what are the ways to meet this requirement?

    Hi Cris,
    We can get the 6 Months date in webi.
    Check the below blog , will help you.
    http://scn.sap.com/community/businessobjects-web-intelligence/blog/2014/01/21/time-variablesdimensions
    Regards,
    Javed

  • Powershell Change date to the first day of last month whenever i run the script.

    If I run the script on 2/4/2013 or any other day in February I want the date to be change to 1/1/2013. I am replacing date on line 59 with this value.
    Get the content of the CMS Script.
    $CMSReport = Get-content C:\reports\CMSReport.acsauto
    Go to line 59 and replace the date for Last Month date.
    $CMSReport[58] = $CMSReport[58] -replace "([1-9]|0[1-9]|1[012])- /.- /.\d\d", [datetime]::Today.ToShortDateString() $CMSReport | Set-Content C:\reports\testCMS.acsauto
    Run the CMS script
    Invoke-Expression -command "c:\reports\testCMS.acsauto"

    PS C:\> $lastMonth = (get-date).AddMonths(-1)
    PS C:\> $firstDayOfLastMonth = get-date -year $lastMonth.Year -month $lastMonth.Month -day 1
    PS C:\> "{0:yyyy-MM-dd}" -f $firstDayOfLastMonth
    2013-01-01
    Bill
    Hello AbqBill,
    Thanks for getting me there. I am a lot closer to the final goal. I input what you suggested and I am getting different results as you. here what I did.
    $LastMonth = (Get-Date).AddMonths(-1)
    $FirstDayofLastMonth = Get-Date -year $LastMonth.year -month $LastMonth.month -day 1
    $CMSReport = Get-content C:\reports\CMSReport.acsauto
    $CMSReport[58] = $CMSReport[58] -replace "([1-9]|0[1-9]|1[012])[- /.]([1-9]|0[1-9]|[12][0-9]|3[01])[- /.](19|20)\d\d", "{0:dd/MM/yyyy}" -f $FirstofLastMonth
    $CMSReport | Set-Content C:\reports\testCMS.acsauto
    I get 12/1/2013. Which bring me to 2 questions. How will this solve when it is January and it has to put last month last year? and why is it going back two month instead of 1?

Maybe you are looking for

  • Please help me with the digital signature validation problem?

    Please help me with the digital signature validation problem?

  • Checking For An Empty Value

    Here's my script: on run set AdiumStatus to "" set AdiumStatusType to "" tell application "System Events" count (every process whose name is "Adium") if result = 1 then tell application "Adium" if my status type is available then set AdiumStatusType

  • Drag and drop option for hierarchy through Web Template

    Hi All, I have 2 hierarchies in one report. For example Product Hierarchy and Customer hierarchy. I would like to have an option in query where I can select the node from each hierarchy and the report is displayed only for the selected node/nodes. I

  • How to Create new database from cold backup files.

    Dear Experts, I have an oracle 10g databae on windows 2003 server. The database is in Archive log mode and backup strategy is Taking cold backup ever night. Backup steps: shut down database. copy data files, control files, redo logs, archive logs and

  • Delivery List : Selection criteria in VA05

    Hii Can any body please solve this out? 1. In VA05, I want to set the date of present month. Like if I open that in august then the date range will show by default 01.08.09 initial and ending 31.08.09 and if I open that in september then it will be 0