Search This Blog

Showing posts with label linux. Show all posts
Showing posts with label linux. Show all posts

Tuesday, March 27, 2012

Making a mysql back up every day midnight using cron

This is a simple way to back up your database everyday Go to ubuntu command line and log in as root user, type following command to open crontab file

 >crontab -e

 type the following command in the file

 0 0 * * * mysqldump -uYOURUSER -pYOURPASSWORD YOURDBNAME > /home/tommy/my_back_up/mydb_`date +\%y-\%m-\%d`.sql

 you can restart cron by typing

 >restart cron

 OR

 >/etc/init.d/cron restart

This will create a sql dump file everyday midnight
file name would be mydb_2012-04-21.sql

Tuesday, February 21, 2012

list all cron jobs for all users

for user in $(cut -f1 -d: /etc/passwd); do echo $user; crontab -u $user -l; done

Monday, November 8, 2010

How to Uninstall Netbeans

root@user:/usr/local/netbeans-6.9# ./uninstall.sh

Friday, October 15, 2010

How to create a new svn project and upload files

First create a new directory by issuing this command in the terminal
>svn mkdir -m "message" 
http://svnserver.com/repos/abc

now go to your working directory

abc>svn import -m "message" 
http://svnserver.com/repos/abc 
-m  has the comment you can write anything inside

Thursday, October 14, 2010

How to restore accidentally deleted crontab file

If you have accidentally deleted crontab file, probably using -r instead of -e. It happens because the keys are at the same place :-) , this is could be the rescue. Try to find the file inside Tmp folder.

go to /tmp

ls -ltr cron*

This will show a history of files. Choose the most reason one.

Monday, October 11, 2010

Command to list the disk partitions in Ubuntu

Command to list the disk partitions in Ubuntu . Login as the admin type this in command line

>fdisk -l