Results 1 to 6 of 6

Thread: cron jobs

  1. #1
    Join Date
    Aug 2000
    Posts
    2,750

    cron jobs

    Hi,

    I want to set it up so that my community website backs it's self up to a certain directory. How would i set it up so that it will tar mysite up and send it to a directory not accesable on the web?

  2. #2
    Join Date
    Nov 2002
    Location
    Michigan
    Posts
    695
    1. Log in as root
    2. mkdir -p /home/backups
    3. crontab -e
    4. 55 0 * * * tar czvf /home/backups/backup.tgz /home/sites/siteX/web/*

    (where siteX is the site number of your domain)

    This will run at 00:55 every night and put a compressed tarball of the web dir for siteX in /home/backups
    http://www.lamphowto.com/ - LAMP and LAMP+SSL HowTo
    http://www.cobaltfaqs.com/ - Cobalt FAQs and HowTos

  3. #3
    Join Date
    Aug 2000
    Posts
    2,750
    Thanks thats very helpful!

    Could you help with a few other options:

    How could i do this but send it too another server?

    How can i perform the samething with the websites mysql database?

  4. #4
    Join Date
    Nov 2002
    Location
    Michigan
    Posts
    695
    To send to a different server, you'd need to use rsync, scp, etc.

    If you have SSH installed, you have scp (secure copy). You can do 'man scp' for all the options which are available (they're pretty involved so i don't want to try and list them all out here).

    For MySQL, do a schema dump first (MySQL site has documentation), then tar up the schema file, and either keep it local, or use scp, etc, to copy to another server.

    I'll be gone all weekend, but if you still want more specifics, please PM me and I'll try to do up some specific instructions on Monday for you.
    http://www.lamphowto.com/ - LAMP and LAMP+SSL HowTo
    http://www.cobaltfaqs.com/ - Cobalt FAQs and HowTos

  5. #5
    Join Date
    Jan 2003
    Location
    London
    Posts
    144
    Bruce

    I tried what you said about setting up this cron job, but when I typed crontab -e I got a page full of ~ down the left and at the bottom was "/tmp/crontab.3770" OL. OC. I could not use and keys to move the cursor or type anything in.

    Bob

  6. #6
    Join Date
    Nov 2002
    Location
    Michigan
    Posts
    695
    Yeah, you're in 'vi' when you edit the crontab file. 'man vi' for more info, but here's some quick info:

    press 'i' to go into insert mode (then it works like any regular screen editor - just start typing. use arrows, delete, etc)

    press 'esc' to go to command mode. common commands are:

    :wq 'write changes and exit'

    :q! 'quit, don't save changes'

    dd 'delete the entire line my cursor is on'

    x 'delete the character under my cursor'

    A 'go to the end of the line, and go into insert mode'

    That should get you started... with vi, when in doubt, hit escape a couple of times, and do :q! to exit without saving any changes
    http://www.lamphowto.com/ - LAMP and LAMP+SSL HowTo
    http://www.cobaltfaqs.com/ - Cobalt FAQs and HowTos

Posting Permissions

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