Welcome to the JaguarPC Community
JaguarPC
Sales: (888) 338-5261
Support: (888)-551-3050
Results 1 to 5 of 5

This is a discussion on Who 'owns' my cron jobs? in the Shared & Semi-Dedicated forum
Just a quick question: when I enter a cron job into the system, under what user name + rights will it run? Is user+group myname+myname ...

  1. #1
    the Windlord Gwaihir's Avatar
    Join Date
    Jun 2002
    Posts
    2,562

    Who 'owns' my cron jobs?

    Just a quick question: when I enter a cron job into the system, under what user name + rights will it run? Is user+group myname+myname as I assume, or something different?

    (I'm writing a little MySQL backup script and would like to set the password file as secure as possible.)
    Regards,

    Wim Heemskerk
    ---
    Visit MeCCG.net - Cardgaming in J.R.R. Tolkien's Middle-earth
    And Gwaihir.net - The Middle-earth CCG store

  2. #2
    Community Leader jason's Avatar
    Join Date
    Sep 2001
    Location
    Rochester, NY
    Posts
    6,003
    It should run as your user and group.

    --Jason
    Jason Pitoniak
    Interbrite Communications
    www.interbrite.com www.kodiakskorner.com

  3. #3
    the Windlord Gwaihir's Avatar
    Join Date
    Jun 2002
    Posts
    2,562

    Automated database backups

    Thanks Works like a charm.

    For those wrestling with the same question, here's how I'm now making back-ups of my databases:

    A shell script, database-dump.sh, makes the backups and puts them in my account-space:
    Code:
    #!/bin/sh
    date=`date +%a`
    cd /home/<username>/database-backup
    nice mysqldump -A -f > backup-$date.sql
    nice gzip -f *.sql
    echo -n "Dump of all databases completed: "
    date
    Both the script and the backups are in the folder I made for those. The -A means it will make a dump of all databases your user has access to (and through the CPanel you can give one user access to all your own databases). The date stuff adds the day of the week to the name, so each backup "lives" for one week. This gives you time to correct a problem before it has corrupted all your backups too.

    I don't want my password on that mysqldump line, as it would then show up in the server's process list too, so I use a .my.cnf file in my /home/<username> folder:
    Code:
    [mysqldump]
    opt
    user=<database-username>
    password=<database-password>
    As this file holds your password you'll want to lock it down as much as possible. I set the permissions on 700. opt is a little bonus that keeps MySQL memory use during the dump down a bit.

    And then I call it with a cronjob (set from CPanel) that sends its output to a log file for me.
    Code:
    33 2 * * * /home/<username>/database-backup/database-dump.sh >> /home/<username>/log/cron 2>&1
    The 33 2 * * * is a random time at a (probably) quiet hour.

    Of course, to make it really useful, this assumes that you do regularly make backups of your account space in some way.
    Last edited by Gwaihir; 05-17-2005 at 09:48 AM.
    Regards,

    Wim Heemskerk
    ---
    Visit MeCCG.net - Cardgaming in J.R.R. Tolkien's Middle-earth
    And Gwaihir.net - The Middle-earth CCG store

  4. #4
    Jag Veteran
    Join Date
    Sep 2002
    Posts
    650
    Quote Originally Posted by Gwaihir
    Of course, to make it really useful, this assumes that you do regularly make backups of your account space in some way.
    Once you take care of backing up DB data, you can use rsync to back up the whole site.

    There is Windows binary of rsync available from Cygwin project.

  5. #5
    the Windlord Gwaihir's Avatar
    Join Date
    Jun 2002
    Posts
    2,562
    Right; that's exactly what I use. I'll leave it to you to write that part of the tutorial though.
    Regards,

    Wim Heemskerk
    ---
    Visit MeCCG.net - Cardgaming in J.R.R. Tolkien's Middle-earth
    And Gwaihir.net - The Middle-earth CCG store

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
  •