Find the answer to your Linux question:
Results 1 to 3 of 3
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 problem: Adding date into cron job

    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
    Just Joined!
    Join Date
    Aug 2009
    Location
    Toronto
    Posts
    31
    Try the following

    cp /var/www/html/site1/module.txt /home/amitha/Desktop/backup/module.'date +%F'.txt

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

    Thanks for the reply. I tried what u say but it gives only the following result not the date.

    file name: date +%F.module.txt


Posting Permissions

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