Archive for the ‘Linux’ Category

Automatically backup MySQL database

I needed to backup a couple of MySQL databaes automatically. Here is what I did to accomplish this.

I created a folder called mysqlbackup. I then created a script called ”mysqldbbackup.sh” and put this script file in the mysqlbackup folder.

It contains “rm /mysqlbackup/DBNAME_backup.sql
mysqldump -u USERNAME -pPASSWORD DBNAME > /mysqlbackup/DBNAME_backup.sql

I used the “rm” command to remove the last database backup before the new backup runs. For one of my old blogs on mysqldump command click here.

You have to make the script executable. To do this use the following command

chmod +x  /mysqlbackup/mysqldbbackup.sh

Now test your script to make sure it works. CD to the mysqlbackup directory and run the script using by typing “mysqldbbackup.sh

Ok after it works you need to now schedule it. Use cron to schedule it. I set it to run ever Tuseday at 3am. Use this command to set it via cron  “0 3 * * 2 /mysqlbackup/mysqldbbackup.sh

For more on cron visit ABOUT CRONJOBS . For more about Linux Shell scripst visit LINUX BASH SHELL SCRIPT

CP Omitting Linux Command Error

So I was trying to copy one folder to another location and kept getting this error:

cp: omitting directory

and it would not copy the directory over. This is the command I was running

 cp FOLDER /root/DRIVE

I am fairly new to Linux so I did not know what I was doing wrong.  After looking at the man page and some searching I found that I needed to put a -r after CP. Here is the syntax:

 cp -r FOLDER /root/DRIVE

the -r is copying the folder recursively.

Setup VNC Server on Cent OS

I recently had the task of setting up VNC Server on Cent OS for a client of mine. VNC is very much like remote desktop in windows. You can even use VNC on Windows servers. I found VNC to be a little bit slower then remote desktop and it kept kicking me out every once in a while. Here are the steps I took to set it up:

First I opened the necessary ports.

Path to access the firewall:

Read the rest of this entry »

Favorite Forums
  • Tech Exams
  • Tek-Tips