Results 1 to 4 of 4

Thread: Processing file and import

  1. #1
    Join Date
    Nov 2009
    Posts
    333

    Processing file and import

    Hi
    For one of my website, I have a sql file that I pass every day in my mysql database with a cronjob. In addition, I would like to date fields in the sql file that I get before doing the import.
    - The sql is on the Internet. I would therefore:
    1 - download.
    2 - Add the file a field day with today's date:
    A line of file:
    INSERT INTO `x_wd` VALUES (1856,1,352,1,15847, 'D)', 594 'ssdgfdp', 59, 'BO', 761);
    I want to turn into:
    INSERT INTO `x_wd` VALUES (1583,1,345,1,11478, 'D)', 594 'sesdgp', 59, 'BO', 761,'09/12');
    and then move the new file in my database.
    I am not familiar with crontab, then all assistance will be welcome . Thank you in advance
    Last edited by Linux-Us; 11-12-2009 at 11:31 AM.

  2. #2
    Join Date
    Nov 2009
    Posts
    333

    Re: Processing file and import

    Hi
    Here's what I started doing, yet it has no area to work. This is the output what I am getting. Please check and reply soon that I can start my work fluently.
    Code:
    wget http://s1.trv.fr/map.sql
    echo / home / trv/ www / map.sql | sed 's /);/, CURDATE ());/'
    mysqldump - host = mysql.xxxxxxx - user = xxxxx - password = xxxxxx tr
    </ home / trv/ www / map.sql
    mysql - user = xxxxxx - password = xxxxxxxx
    delete from travian_django where mydate = CURDATE () - 5;
    exit;
    Any suggestion on this.

  3. #3
    Join Date
    May 2008
    Posts
    4,345

    Re: Processing file and import

    Hi,
    Import your dump is as follows:
    Code:
    mysql database <backup-file.sql
    Crontab allows you to run scripts at a frequency set (the script must be executable).
    For your problem I would suggest you
    1. Recovering the SQL dump.
    2. Cleaning of the base.
    3. Insert the dump.
    4. Updating the database with the current date on the records did not know this information.
    Any more problem do post back.

  4. #4
    Join Date
    Nov 2009
    Posts
    333

    Re: Processing file and import

    Hi
    Finally I managed to sort out the things properly. Thanks for your help.
    Code:
    rm map.sql
    wget http://s1.trv.fr/map.sql
    sed 's /);/, CURDATE ());/ g' map.sql> new_map.sql
    mv new_map.sql map.sql
    mysql - host = mysql.asdata.com - user = xxxxx - password = xxxxxx trv_django <map.sql
    mysql - host = mysql.asdata.com - user = xxxxx - password = xxxxxx
    use trv_django
    delete from x_wd where mydate = CURDATE () - 5;
    exit;
    What I did was
    - Delete the file if it exists sql
    - Download the file sql
    - Updated table
    - Erase data dating back to 5 days on the table

Similar Threads

  1. Replies: 8
    Last Post: 12-03-2012, 08:45 PM
  2. Replies: 5
    Last Post: 13-01-2012, 05:18 PM
  3. Replies: 7
    Last Post: 02-06-2011, 10:06 PM
  4. wmm won't import MPG file
    By gemss in forum Windows XP Support
    Replies: 2
    Last Post: 06-12-2009, 09:12 PM
  5. What is file processing system
    By Amanat in forum Windows Software
    Replies: 3
    Last Post: 12-12-2008, 06:10 PM

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
  •  
Page generated in 1,714,233,092.09758 seconds with 17 queries