Jump to content

Recommended Posts

Posted

(1) Is there way to automate (maybe with cron) the backup of:

( a ) an individual database?

( b ) all my databases into one file?

 

(2) where do these go in my server space / or best place for them?

 

(3) With my server-visitor logs, they are stored as monthly logs in home/logs, correct?

 

(4) When they are stored monthly, is there a clean cutoff at a certain time?

i.e.. one log ends on last day of month at 11:59PM and 59 seconds, the next log starts on first day of next month at 12:00AM and 0 seconds?

 

(5) What's the best strategy for saving/viewing my server-visitor) logs? So that I can refer to them in the future, locally on my office PC, and not keep them stored on the server?

Posted
(1) Is there way to automate (maybe with cron) the backup of:

( a ) an individual database?

( b ) all my databases into one file?

You can do either one by setting up a mysqldump command in a cron job. I use the following to backup a single database:

>mysqldump --quick --all --add-drop-table --add-locks --lock-tables --quote-names --user=cpanelname_username --password=mypassword cpanelname_dbname | gzip -c > /home/username/backup/mysql-backup.sql.gz

a) Replace 'cpanelname_username' with your MySQL username.

B) Replace 'mypassword' with your MySQL password.

c) Replace 'cpanelname_dbname' with your MySQL database name.

d) Replace '/home/username/backup/mysql-backup.sql.gz' with the path and file name you want to save the database backup to.

 

You can backup all of your database by replacing the database name in the above command with the option '--all-databases'. (I'd probably also add the '--add-drop-database' option to the command as well.)

 

There are also scripts available that can do the backup and can be run from a cron job. There was one discussed on the forums recently that could e-mail you the backup file if you wished.

 

(2) where do these go in my server space / or best place for them?

The database backups will go into whatever directory the command or script run by cron puts them in. I created a directory outside of my public_html directory for them (/home/username/backup) so they could not be accessed or downloaded from a browser.

 

(3) With my server-visitor logs, they are stored as monthly logs in home/logs, correct?

The server logs are stored in /home/username/logs (at least they are on my hosting account).

 

(4) When they are stored monthly, is there a clean cutoff at a certain time?

i.e.. one log ends on last day of month at 11:59PM and 59 seconds, the next log starts on first day of next month at 12:00AM and 0 seconds?

I don't know what determines the cutoff of logs from one month to the next, but the monthly logs do not start at 12:00 AM on the 1st day of the month and end at 11:59 PM on the last day of the month. I took a look at my server logs for last month (October), and the first entry is September 30, around 1:00 AM, and the last entry is October 31, around 2:00 AM.

 

(5) What's the best strategy for saving/viewing my server-visitor) logs? So that I can refer to them in the future, locally on my office PC, and not keep them stored on the server?

You can store them on the server (counting against your disk space quota), but since the logs are saved as compressed files, you generally won't be able to view the actual log data from the server. You'd need to download the log file and extract the log, then you could view it in a text editor or use a script or application to process and analyze it.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...