Results 1 to 3 of 3

Thread: Regular backup by date. Please correct me the command

  1. #1
    Join Date
    Mar 2012
    Beans
    2

    Cool Regular backup by date. Please correct me the command

    I've created a script for backup up my Zimbra folder according to this
    Code:
    http://www.youtube.com/watch?v=xhUksAhpBxw&feature=related
    But exact command doesn't seem to work on ubuntu. here's the script

    Code:
    !/bin/bash
    service zimbra stop
    
    cp -rp /opt/zimbra /zimbkp/'date+%d%m%Y'/
    
    service zimbra start
    The copied folder will names as "date+%d%m%Y" not the date I require. Please help

  2. #2
    Join Date
    Dec 2009
    Beans
    18

    Re: Regular backup by date. Please correct me the command

    You need to use backquotes:

    Code:
    cp -rp /opt/zimbra /zimbkp/`date+%d%m%Y`

    Please note the backquote "`" instead of the single quote "'"

  3. #3
    Join Date
    Jan 2010
    Location
    Kolkata India
    Beans
    Hidden!
    Distro
    Ubuntu

    Re: Regular backup by date. Please correct me the command

    Wrapping 'date+%d%m%Y' in single quotes prevents shell from understanding the special meanings of command and symbols .You need use command substitution as suggested by athampan above .Below syntax you can also use :

    Code:
    cp -rp /opt/zimbra /zimbkp/$(date+%d%m%Y)
    “Progress is made by lazy men looking for easier ways to do things”
    — Robert A. Heinlein

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
  •