Find the answer to your Linux question:
Results 1 to 4 of 4
Hi, I tried to write a cron job in Fedora13 as follows ------------------------------------------------------------------------------------------------------- #!/bin/bash today='date +%d%m%Y' cp /var/www/html/site1/module.txt /home/amitha/Desktop/backup/$today.module.txt --------------------------------------------------------------------------------------------------------- I want the module file in the html folder to ...
  1. #1
    Just Joined! amithad's Avatar
    Join Date
    Sep 2006
    Posts
    64

    Question Date in the file name(cron)

    Hi,

    I tried to write a cron job in Fedora13 as follows

    -------------------------------------------------------------------------------------------------------
    #!/bin/bash

    today='date +%d%m%Y'

    cp /var/www/html/site1/module.txt /home/amitha/Desktop/backup/$today.module.txt

    ---------------------------------------------------------------------------------------------------------
    I want the module file in the html folder to be backed up by attaching the date to it's name but it's not working properly

    an advice is appreciated

    thanks

    amitha

  2. #2
    Linux Guru Rubberman's Avatar
    Join Date
    Apr 2009
    Location
    I can be found either 40 miles west of Chicago, or in a galaxy far, far away.
    Posts
    8,974
    Well, you are using regular single quote characters in today='date +%d%m%Y' but you need to us backquotes as in today=`date +%d%m%Y`
    Sometimes, real fast is almost as good as real time.
    Just remember, Semper Gumbi - always be flexible!

  3. #3
    Just Joined! amithad's Avatar
    Join Date
    Sep 2006
    Posts
    64

    Thumbs up Thanks !!!

    Hi Rubberman,

    Thanks a lot for the help It works perfectly

    Thanks and Regards

    amitha

  4. #4
    Linux Guru Rubberman's Avatar
    Join Date
    Apr 2009
    Location
    I can be found either 40 miles west of Chicago, or in a galaxy far, far away.
    Posts
    8,974
    Happy to help.
    Sometimes, real fast is almost as good as real time.
    Just remember, Semper Gumbi - always be flexible!

Posting Permissions

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