Category Archives: tutorials

Bash Shell File to backup Mysql Server and Save it over FTP

today i was trying to move mysql server from one to another , so i had to use this bash shell file , and just wanna share it to public
1-requirement :
Good FTP Client like lftp , you can download it by : yum install lftp (redhat or any RPM dependent distro ) or apt-get install lftp (debian or ubuntu )

2-create file name “mysql.backup.sh”

and write down

#!/bin/bash
### MySQL Server Login Info ###
MUSER="root"
MPASS=""
MHOST="localhost"
MYSQL="$(which mysql)"
MYSQLDUMP="$(which mysqldump)"
BAK="/backup/mysql"
GZIP="$(which gzip)"
### FTP SERVER Login info ###
FTPU="ftpusernane"
FTPP="ftppassword"
FTPS="targetServer"
NOW=$(date +"%d-%m-%Y")
[ ! -d $BAK ] && mkdir -p $BAK || /bin/rm -f $BAK/*
DBS="$($MYSQL -u $MUSER -h $MHOST -p$MPASS -Bse 'show databases')"
for db in $DBS
do
FILE=$BAK/$db.$NOW-$(date +"%T").gz
$MYSQLDUMP -u $MUSER -h $MHOST -p$MPASS $db | $GZIP -9 > $FILE
done
lftp -u $FTPU,$FTPP -e "mkdir /mysql/$NOW;cd /mysql/$NOW; mput /backup/mysql/*; quit" $FTPS

3- run this command  chmod +x mysql.backup.sh to give the file execute permission

4- one more tip , you can add it to crontab ……………….. so it can run automatically  as you want

easy , isn’t it ??

how to choose the right xdebug version for your development environment ????

one last tip for apache 2 use the threaded version and non threaded version is for apache 1.3

yesterday i was moving my development environment to the new php 5.3 , I used to work with  some of php  extension  every time every where , one of the most important extension is xdebug basically its

The Xdebug extension helps you debugging your script by providing a lot of valuable debug information.

its really very handy tool but every time i need to add it i lose some time of choosing the right version until i found a rule :
Read more »

Easy download torrent files from command line(Linux Terminal)

This can be achieved by using the ultra-lightweight text-based BitTorrent client “rTorrent”.
If you are using Ubuntu, you can install rTorrent via Synaptic Package Manager, or with this command:

sudo apt-get install rtorrent

You can also get  rTorrent HERE.

Now, we will start using rTorrent. But first, download a ‘.torrent’ file. You can download it through this command:

rtorrent  filename.torrent