The Community Forums

Interact with an entire community of cPanel & WHM users!
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Help with Cron Job Syntax

Discussion in 'General Discussion' started by marcodeluca, Feb 16, 2011.

  1. marcodeluca

    marcodeluca Registered

    Joined:
    Feb 16, 2011
    Messages:
    1
    Likes Received:
    0
    Trophy Points:
    1
    Hi there - realize this isn't a cPanel "problem" so I'm not regarding it as a support issue - just looking for some help with some cron job syntax. If you can help, I appreciate your time!

    I currently have a bunch of cronjobs backing up my databases, looks like this ( and works fine ): mysqldump -u worklabs -pXXXXXXX worklabs_one | gzip -c > /home/worklabs/backup/backup_worklabsone.sql.gz

    So I end up with a list of zipped SQL files in a folder called BACKUP, which is what I want. It's the next step that I'm having troubles with: I want to zip that entire BACKUP folder, append the current date to it, and place that zipped folder into another folder, backup_archive. Afterwards I can set up a local script to retrieve the file using SSH.

    I'm having troubles getting the syntax right for the process of zipping a folder, appending the current date, and moving it into another folder. I set up my crons using the cPanel cron job module. Any suggestions?

    Marco
     
  2. vanessa

    vanessa Well-Known Member
    PartnerNOC

    Joined:
    Sep 26, 2006
    Messages:
    817
    Likes Received:
    22
    Trophy Points:
    18
    Location:
    Virginia Beach, VA
    cPanel Access Level:
    DataCenter Provider
    Code:
    tar -cvf /home/worklabs/backup_archive/backup-$(date +%m.%d.%y).tar /home/worklabs/backup && rm -rf /home/worklabs/backup
     
Loading...

Share This Page