Author Archive

Simple mySQL backup script for cron – updated version

In this example, each database will be stored separately and like earlier example we will save all databases and we will have the last 4 copies.

#!/bin/bash
#Simple mySQL backup script for cron – updated version

# Modify the following to suit your environment
export DB_BACKUP=”/home/user/mysql_backup”
export DB_USER=”root”
export DB_PASSWD=”***********”
export DATE=”`date +”%d%b”`”
export MYSQL=”/usr/bin/mysql”
export MYSQLDUMP=”/usr/bin/mysqldump”

# Backup part
echo “mySQL_backup”
echo “———————-”
echo “* Rotating backups…”
rm -rf $DB_BACKUP/04
mv $DB_BACKUP/03 $DB_BACKUP/04
mv $DB_BACKUP/02 $DB_BACKUP/03
mv $DB_BACKUP/01 $DB_BACKUP/02
mkdir $DB_BACKUP/01

cd $DB_BACKUP/ && cd $DB_BACKUP/01
$MYSQL -u $DB_USER –password=$DB_PASSWD -Bse ‘show databases’ |while read m; \
do $MYSQLDUMP -u $DB_USER –password=$DB_PASSWD `echo $m` > `echo $m`.sql;done
bzip2 *sql

echo “* Creating new backup…”
echo “Backup done! `date`” > /tmp/my_report.log

# You can set the script to send you mail when backup it’s finished.
mail -s “MySql Backup report” you@yourmail.com < /tmp/my_report.log
echo "----------------------"
echo "Done"
exit 0

Enjoy


Multitail Logs on Linux

Have you ever having to control more than a single file with your tail -f ?

I will and I just recently found out that you can run the tail command specifying the -f flag several times so you can give the command:

tail -f /var/log/messages -f /var/log/syslog

You’ll get an output like this:

==> messages <== Nov 22 00:43:07 laptop kernel: [ 61.487969] ADDRCONF(NETDEV_UP): eth0: link is not ready

==> syslog <== Nov 22 00:43:31 laptop pulseaudio[1773]: ratelimit.c: 1 events suppressed

==> messages <== Nov 22 00:43:31 laptop pulseaudio[1773]: ratelimit.c: 1 events suppressed

==> syslog <==

Nov 22 00:45:44 laptop ntpd[1118]: kernel time sync status change 6001


Debian 6.0 Squeeze Release Update

The Debian Release Team has made a status update on Debian 6.0, “Squeeze”. They are proud to report that Debian is moving towards the release like a glacier: “inevitably and unstoppingly”.

Squeeze is almost in its final state: testing of the installer and upgrades are welcome. Once the latest version of the Debian Installer is added, a deep freeze will begin, with minimal changes allowed while the remaining bugs are fixed. Your help is welcome in:

There are two upcoming bug squashing parties you can join: Bern, Switzerland, November 27-28; and Boulogne-Billancourt, France,December 4-5.

More : news.debian.net


Bash: Declaring Variables in Shell Scripting

In Bash Shell Scripting the variables do not need to  be declared.

However, if the variable is not declared it will only produce an empty string.  When you declare variables you are telling the shell what value the variable contains.  In this example, the variable $var, note that it can be lower case, has a value of “time”.

Each time the variable is called it will have this value.  You can also declare variables with the declare command.

var=time

or

declare var=time

If you had a variable constructed without declaring the value it would look like this:

var=

Or you may call a variable that has no value attached with something like this:

echo $VAR

If the VAR variable has not been declared you just get an empty string.


Make shared folder in VirtualBox permanently

First create he folder you want to share:
mkdir /mnt/shared_folder
Then open to edit the rc.local file:
nano /etc/rc.local
And add the following line:
  mount -t vboxsf -w -o uid=1000,gid=1000 my_shared_folder /mnt/shared_folder

And the last step: save, quit. Reboot

reboot


Social Media

  
FeedBurner Subscribe



Categories

Page 30 of 47« First...1020282930313240...Last »
Copyright © 2012 Linux Debian Tutorials | Debian Squeeze Tutorials. All rights reserved.
↑ Back to Top