Results 1 to 3 of 3

Thread: [SOLVED] Shell script to tar directory with date

Hybrid View

  1. #1
    Join Date
    Mar 2006
    Location
    Suffolk County, NY
    Beans
    158
    Distro
    Ubuntu 8.04 Hardy Heron

    [SOLVED] Shell script to tar directory with date

    EDIT: Problem solved

    I need to write a script to tar a directory /datab/data based on the current date. The date needs to be in the format YYMMDD the filename should be database_YYMMDD. How can I do this? Thanks

    PS: This is actually for a redhat EL 4 database production mysql server but I only belong to my beloved Ubuntu forums. I'm using /bin/bash Thanks
    Last edited by Keymaster; July 18th, 2008 at 04:02 PM. Reason: Problem Resolved
    chown us:us -R /AllYourBase
    Quote Originally Posted by Black Razor View Post
    It takes an intelligent open minded individual to come from windows to Linux.

  2. #2
    Join Date
    Jun 2006
    Location
    Switzerland
    Beans
    Hidden!
    Distro
    Kubuntu Jaunty Jackalope (testing)

    Re: Shell script to tar directory with date

    Code:
    #!/bin/bash
    DATE=/bin/date;
    NOW=`$DATE '+%Y-%m'-%d_%H:%M`
    echo $NOW
    that will give you a variable $NOW with YYYY-MM-DD_HH:mm

    you can change it accordingly

  3. #3
    Join Date
    Mar 2006
    Location
    Suffolk County, NY
    Beans
    158
    Distro
    Ubuntu 8.04 Hardy Heron

    Re: Shell script to tar directory with date

    Thank you. I actually figured it out through some books I found laying around the office.
    chown us:us -R /AllYourBase
    Quote Originally Posted by Black Razor View Post
    It takes an intelligent open minded individual to come from windows to Linux.

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •