Results 1 to 2 of 2

Thread: Help With Cron Auto Backup

  1. #1
    plstim is offline Junior Member
    Join Date
    Jul 2010
    Posts
    2

    Default Help With Cron Auto Backup

    Hi Alll,

    First post here. What I want to do is schedule cron on a shared server to once a day copy my mysql database and sugarcrm folder to backup folders. I have been so far unsuccessful so perhaps you could help. Here is what I have so far:

    01 00 * * * mysqldump --opt -u[user] -[password] [database] > /backup/db/sugarce_backup_current.sql;mv /backup/db/sugarce_backup_current.sql /backup/db/$(date +%m%d%Ysugarce_backup.sql);gzip -f /backup/db/$(date +%m%d%Ysugarce_backup.sql);

    45 00 * * * cp -rf /public_html/sugarcrm /backup/apps/sugarce;tar -cf /backup/apps/sugarce.tar /backup/apps/sugarce;rm -rf /backup/apps/sugarce;gzip -f /backup/apps/sugarce.tar; mv /backup/apps/sugarce.tar.gz /backup/apps/$(date +%m%d%Ysugarce_backup.tar.gz);

    here is the error I am getting emailed to me from both cron jobs:

    /bin/sh: -c: line 0: unexpected EOF while looking for matching `)'
    /bin/sh: -c: line 1: syntax error: unexpected end of file

    Now I have them set up as 2 separate cron jobs. Is this the problem? any help here? I am very new to this. I found this code somewhere on the forums but I didn't know if I should resurrect an ancient thread. Sorry if I should have.

    Thanks in advance

  2. #2
    plstim is offline Junior Member
    Join Date
    Jul 2010
    Posts
    2

    Default Re: Help With Cron Auto Backup

    Hi All,

    I found this solution the solution below that mostly works. The problem was with the timestamp that was being added. I have one more issue though. I can only get this to work when I send the output to the root directory so like /home/nameofserver.

    If I use /home/nameofserver/backup I get an error saying "no such file or directory". I have added the directory and even changed the permissions to 777 just to see if that works and it still didn't. Any ideas?



    mysqldump -u[user] -p[password] db > /home/name/example.sql;mv /home/name/example.sql /home/name/`date +\%Y-\%m-\%d-\%H-\%M-\%S`example.sql;gzip -f /home/name/`date +\%Y-\%m-\%d-\%H-\%M-\%S`example.sql

    cp -rf /home/name/public_html/sugarcrm /home/name/sugar;tar -cf /home/name/sugar.tar /home/name/sugar;rm -rf /home/name/sugar;gzip -f /home/name/sugar.tar; mv /home/name/sugar.tar.gz /home/name/`date +\%Y-\%m-\%d-\%H-\%M-\%S`sugar_backup.tar.gz
    Last edited by plstim; 2010-07-06 at 08:10 PM. Reason: clarification

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Replies: 12
    Last Post: 2011-07-12, 10:54 AM
  2. Cron Job
    By kevpool1 in forum Help
    Replies: 1
    Last Post: 2007-03-29, 06:48 PM
  3. Cron.php Failure
    By usannsell in forum Help
    Replies: 2
    Last Post: 2006-07-12, 06:51 AM
  4. how to cron tab?? HELP PLEASE!!!
    By aashish in forum Help
    Replies: 2
    Last Post: 2006-02-20, 08:44 AM
  5. Backup as web service or cron-executable routine
    By eeric in forum Feature Requests
    Replies: 1
    Last Post: 2005-10-05, 06:28 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
  •