[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [cobalt-developers] Cron job to backup MySQL



"Jay Nelson" <jay@xxxxxxxxxxx> wrote:
> I got around the problem by using the /etc/my.cnf file instead of
/root/.my.cnf

Just be careful about the permissions on /etc/my.cnf.  If it contains the
MySQL root user's password you don't want it readable by other users.  I
don't recall off-hand what permissions on the file *have to* be to be
accessible by MySQL, but if there's an issue you may be better off putting
the root user password in ~root/.my.cnf.

> I don't like to use the password in a command-line script as a parameter
> because it will show up in all the history logs and possibly on the
process
> list as part of the process name in ps.

Very good reasons.

> Is it necessary to run crontab?  I just put the file in the cron.daily
> directory.

cron.daily is part of the system cron.  crontab creates and manages user
crons.  User crons are stored as /var/spool/cron/<user>.  User crons allow
for exact control over when a cron job is run.  The frequency of system
crons is controlled by /etc/crontab which makes it slightly easier to add
cron jobs since you only need to add them to the best directory mentioned in
/etc/crontab (you can always add your own custom entries to /etc/crontab).
I prefer to use user crons.  It's pretty simple.  Here's one way to do it.

1. pico -w ~root/cron.master
2. Add cron entry to above file and save.
3. crontab /usr/share/mysql/my-small.cn~root/cron.master to [re-]load cron
entry which updates cron at /var/spool/cron/<user>.

> I thought that the directory was monitored and the process automatically
> added to the crontab because of the file timestamps.

It's controlled by the frequency settings in /etc/crontab, not file
timestamps.  Google for "cron tutorial" and you'll be up to speed in a few
minutes if you aren't used to how cron works.

> It is running nightly
> now and I have not used the crontab command.

/etc/crontab says to run scripts found in the /etc/cron.daily directory at
4:02 AM (at least on a RaQ 4 I'm looking at)

02 4 * * * root run-parts /etc/cron.daily

--
Steve Werby
President, Befriend Internet Services LLC
http://www.befriend.com/