Please whitelist cPanel in your adblocker so that you’re able to see our version release promotions, thanks!

The Community Forums

Interact with an entire community of cPanel & WHM users!

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:
    51
    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:
    830
    Likes Received:
    26
    Trophy Points:
    178
    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
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
Loading...

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice