Re: Running a cron job for the last day of the month

From: Javier Gostling (jgd_at_samwan.homeip.net)
Date: 04/01/04

  • Next message: Javier Gostling: "Re: Running a cron job for the last day of the month"
    Date: Thu, 1 Apr 2004 12:34:04 -0400
    To: General Red Hat Linux discussion list <redhat-list@redhat.com>
    
    

    On Thu, Apr 01, 2004 at 08:25:32AM -0800, Mike Koponick wrote:
    > Hello,
    >
    > I would like to run a script on the last day of the month, preferably at
    > 23:59 hours. The problem that I am seeing is that each month has a
    > slightly different last day IE: (28/29, 30, or 31) I can see how I can
    > run the report for the first day of the month, which works fine, but it
    > names all the directories/files for the following month, rather than the
    > month the report data comes from.
    >
    > I use the:
    >
    > #!/bin/sh
    > date=`/bin/date -d now '+%b'`
    >
    > to set the date to name the files/directories.
    >
    > Any help is appreciated.

    Mike,

    Try changing the date calculation like this:

    #!/bin/sh
    date=`/bin/date -d yesterday '+b%+'`

    That would allow you to run the script on the first of every month and get
    the month name of the previous month.

    Cheers,

    -- 
    Javier Gostling D.
    <jgd@samwan.homeip.net>
    -- 
    redhat-list mailing list
    unsubscribe mailto:redhat-list-request@redhat.com?subject=unsubscribe
    https://www.redhat.com/mailman/listinfo/redhat-list
    

  • Next message: Javier Gostling: "Re: Running a cron job for the last day of the month"

    Relevant Pages

    • RE: Running a cron job for the last day of the month
      ... Mike ... > I would like to run a script on the last day of the month, ... > month the report data comes from. ... unsubscribe mailto:redhat-list-request@redhat.com?subject=unsubscribe ...
      (RedHat)
    • No -e allowed in setuid scripts - perl/ksh.
      ... There is another script called: main.sh, ... Now, whenever I run a report in our ERP system & invoke main.sh, ... report data stream to it, the pg_format.sh works just fine without ...
      (comp.unix.shell)
    • Running a cron job for the last day of the month
      ... I would like to run a script on the last day of the month, ... month the report data comes from. ... Mike ... -- redhat-list mailing list unsubscribe mailto:redhat-list-request@redhat.com?subject=unsubscribe ...
      (RedHat)
    • RE: forwarding logs
      ... Same with another script. ... >> You should not need to cange anything in the log script itself. ... >> Reuben D. Budiardja ...
      (RedHat)
    • RE: forwarding logs
      ... Same with another script. ... >> You should not need to cange anything in the log script itself. ... >> Reuben D. Budiardja ...
      (RedHat)