Find the answer to your Linux question:
Results 1 to 2 of 2
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Just Joined! parabuzzle's Avatar
    Join Date
    Jun 2007
    Oakland, CA

    MySQL Dump script help - Date HASH...


    I have a dump sql script that I am running on my database machine right now but the problem is I have to manually run it everyday because I have to edit the file to change the dump file name to reflect the current date. I want to know if there is a way to hash the name to grab the system date and use that in the name so that I can run the script via cron... Any help will be appreciated...

    This is the outfile part of the script:
    SELECT *
    INTO OUTFILE "/data/export/06-18-2007_all_user_dump.txt"
    I need the file to auto generate the date everyday...


  2. #2
    You're probably best writing a bash script that cron fires off. With this, in the bash script would be something like:

    DATE=`date +%d-%m-%Y`
    SELECT * INTO OUTFILE /data/export/$DATE_all_user_dump.txt
    Then run that bash script from the cron job.
    "I am not an alcoholic, alcoholics go to meetings"
    Registered Linux user = #372327

Posting Permissions

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