Find the answer to your Linux question:
Results 1 to 3 of 3
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1

    how to use date command in filenaming for cron job?

    I'm not an advanced linux user though I've been using for years, here's my question.

    I'm trying to setup a cron job to backup my websites daily, normally when I manually do this I include the date in the name of the created file, like: website-12-10-09.tar.gz

    now I'm wondering if there is a way to dynamically include the date, something like:

    tar -zcvf websites[date '+-%d-%m-%y'].tar.gz websites/

    any ideas would be great!

  2. #2
    You're real close. It would be:

    tar -zcvf websites`date '+-%d-%m-%y'`.tar.gz websites/

  3. #3
    hehe,, yes I knew it was something simple but wasn't sure of the syntax. but that did the trick!

    much appreciated!

  4. $spacer_open

Posting Permissions

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