Results 1 to 2 of 2
  1. #1
    Join Date
    Mar 2015
    Posts
    2

    Unanswered: mysqldump creating empty file

    Hi All,

    Not sure where to post this either in linux or mysql page. When i execute the backup script manually in command prompt, it creates the sql file and succeeds. But when i schedule it in crontab it creates zero bytes file. Any idea what could cause this?

    OS - Linux 2.6.32-504.16.2.el6.x86_64
    MySQL 5.5.27-log

    Below is the script i am using

    #!/bin/bash
    ###############
    #MYSQL DB BACKUP
    ###############

    backup_root=/opt/mysql/backup/DBbackup/
    retention="2" #This is in days.
    logfile=/opt/mysql/backup/DBbackup/backup.log

    myname=`hostname -s`
    find ${backup_root} -mtime +$retention -exec rm -rf {} \;
    backup_dir=${backup_root}`date +%Y%m%d`
    mkdir ${backup_dir}
    purgedate="'`date '+%Y-%m-%d %T'`'"
    /opt/isv/mysql/mysql-5.5.27/bin/mysqldump --all-databases --single-transaction --skip-lock-tables | gzip > ${backup_dir}/full_backup.sql.`date +%Y%m%d%H%M%S`.gz
    exit 0



    Thanks
    Pulla
    Last edited by ikr.pulla; 06-03-15 at 15:09.

  2. #2
    Join Date
    Nov 2004
    Location
    out on a limb
    Posts
    13,692
    Provided Answers: 59
    Have you checked the log files?
    My guess, and it is no more than a guess is its going to be a permissions issue. And the problem could be with the database permissions (ie the db doesnt allow those actions for the cron user) or it could be OS issues (the operating system doesnt allow the cron user account to access the files, or write to the disk). The logfiles should give an indication.
    I'd rather be riding on the Tiger 800 or the Norton

Posting Permissions

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