<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>shell script &#8211; lifeLinux: Linux Tips, Hacks, Tutorials, Ebooks</title>
	<atom:link href="http://lifelinux.com/tag/shell-script/feed/" rel="self" type="application/rss+xml" />
	<link>http://lifelinux.com</link>
	<description>All About Linux !</description>
	<lastBuildDate>Tue, 23 Aug 2011 13:28:25 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=5.5.3</generator>
	<item>
		<title>Auto Backup Server Files &#038; MySQL To FTP Server</title>
		<link>http://lifelinux.com/auto-backup-server-files-mysql-to-ftp-server/</link>
					<comments>http://lifelinux.com/auto-backup-server-files-mysql-to-ftp-server/#comments</comments>
		
		<dc:creator><![CDATA[lifeLinux]]></dc:creator>
		<pubDate>Tue, 23 Aug 2011 13:12:00 +0000</pubDate>
				<category><![CDATA[Bash Shell]]></category>
		<category><![CDATA[Sys Admin]]></category>
		<category><![CDATA[backup data]]></category>
		<category><![CDATA[backup mysql]]></category>
		<category><![CDATA[backup script]]></category>
		<category><![CDATA[backup service]]></category>
		<category><![CDATA[centralized storage]]></category>
		<category><![CDATA[ftp backup]]></category>
		<category><![CDATA[ftp servers]]></category>
		<category><![CDATA[gnu tar]]></category>
		<category><![CDATA[incremental backup]]></category>
		<category><![CDATA[incremental backups]]></category>
		<category><![CDATA[MySQL]]></category>
		<category><![CDATA[mysql databases]]></category>
		<category><![CDATA[mysql server]]></category>
		<category><![CDATA[mysqldump]]></category>
		<category><![CDATA[nas backup]]></category>
		<category><![CDATA[script generator]]></category>
		<category><![CDATA[shell script]]></category>
		<category><![CDATA[storage array]]></category>
		<category><![CDATA[tape backups]]></category>
		<category><![CDATA[tar command]]></category>
		<category><![CDATA[tar gz]]></category>
		<guid isPermaLink="false">http://www.lifelinux.com/?p=1000</guid>

					<description><![CDATA[<p>This is a simple script take to daily backup server files and MySQL databases to FTP server. Make sure you have lftp client installed. Type the following command if you are using Centos/Fedora/RedHat # yum install lftp If you are using Ubuntu/Debian # sudo apt-get install install lftp Create the folder /backup, enter # mkdir [&#8230;]</p>
<p>The post <a rel="nofollow" href="http://lifelinux.com/auto-backup-server-files-mysql-to-ftp-server/">Auto Backup Server Files &#038; MySQL To FTP Server</a> appeared first on <a rel="nofollow" href="http://lifelinux.com">lifeLinux: Linux Tips, Hacks, Tutorials, Ebooks</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p></p><p>This is a simple script take to daily backup server files and MySQL databases to FTP server. Make sure you have lftp client installed. Type the following command if you are using Centos/Fedora/RedHat</p>
<pre>
# yum install lftp
</pre>
<p><span id="more-1000"></span><br />
If you are using Ubuntu/Debian</p>
<pre>
# sudo apt-get install install lftp
</pre>
<p>Create the folder /backup, enter</p>
<pre>
# mkdir /backup
# chmod 0600 /backup
</pre>
<p>Create backup.sh file, enter</p>
<pre>
# vi /backup/backup.sh
</pre>
<p>Add the following content to backup.sh</p>
<pre>
#!/bin/bash
# Daily backup script
# Backup Server Files & MySQL
# Support backup multiple directories and multiple databases
# Copyright (c) 2010-2011 lifeLinux <http://www.lifelinux.com/>
# This script is licensed under GNU GPL version 2.0 or above

### Webserver directory
WD="/var/www/domain"

### MySQL Server Login Info ###
MUSER="root"
MPASS="MYSQL_ROOT_PASSWORD"
MHOST="localhost"
DBS="DATABASE_NAME_1 DATABASE_NAME_2"
MYSQL="$(which mysql)"
MYSQLDUMP="$(which mysqldump)"
GZIP="$(which gzip)"
TAR="$(which tar)"

### Backup directory
BAK="/backup"

### FTP SERVER Login info ###
FTPU="FTP USER"
FTPP="FTP PASSWORD"
FTPS="FTP SERVER IP"
DAILY=$(date +"%u")

[ ! -d $BAK/$DAILY ] && mkdir -p $BAK/$DAILY || /bin/rm -f $BAK/$DAILY/*

for db in $DBS
do
	FILE=$BAK/$DAILY/mysql-$db.gz
	$MYSQLDUMP -u $MUSER -h $MHOST -p$MPASS $db | $GZIP -9 > $FILE
done

WDS=`dir $WD`

for w in $WDS
do
	FILE=$BAK/$DAILY/source-$w.gz
	$TAR -zcvf $FILE $WD/$w/* 
done

lftp -u $FTPU,$FTPP -e "mkdir $DAILY;cd $DAILY; mput $BAK/$DAILY/*; quit" $FTPS
</pre>
<p>Set cron job</p>
<pre>
# crontab -e
</pre>
<p>If you want to auto backup at 3:00AM, add the following line to crontab</p>
<pre>
00 03 * * * /backup/backup.sh > /dev/null 2>&1
</pre>
<g:plusone href="http://lifelinux.com/auto-backup-server-files-mysql-to-ftp-server/" size="standard"  annotation="none"   ></g:plusone><p>The post <a rel="nofollow" href="http://lifelinux.com/auto-backup-server-files-mysql-to-ftp-server/">Auto Backup Server Files &#038; MySQL To FTP Server</a> appeared first on <a rel="nofollow" href="http://lifelinux.com">lifeLinux: Linux Tips, Hacks, Tutorials, Ebooks</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>http://lifelinux.com/auto-backup-server-files-mysql-to-ftp-server/feed/</wfw:commentRss>
			<slash:comments>2</slash:comments>
		
		
			</item>
		<item>
		<title>How To Display vi / vim Text Editor Line Numbers</title>
		<link>http://lifelinux.com/how-to-display-vi-vim-text-editor-line-numbers/</link>
					<comments>http://lifelinux.com/how-to-display-vi-vim-text-editor-line-numbers/#respond</comments>
		
		<dc:creator><![CDATA[lifeLinux]]></dc:creator>
		<pubDate>Mon, 30 May 2011 02:14:50 +0000</pubDate>
				<category><![CDATA[Bash Shell]]></category>
		<category><![CDATA[Sys Admin]]></category>
		<category><![CDATA[c program]]></category>
		<category><![CDATA[display vi line nymber]]></category>
		<category><![CDATA[line numbers]]></category>
		<category><![CDATA[readability]]></category>
		<category><![CDATA[shell script]]></category>
		<category><![CDATA[Show Line Numbers In vi]]></category>
		<category><![CDATA[Show Line Numbers In vim]]></category>
		<category><![CDATA[Vim]]></category>
		<category><![CDATA[vim off line number]]></category>
		<category><![CDATA[vim on line number]]></category>
		<category><![CDATA[vim text editor]]></category>
		<guid isPermaLink="false">http://www.lifelinux.com/?p=857</guid>

					<description><![CDATA[<p>Displaying line numbers in vi/vim can be very useful for debugging code errors and to improve overall readability of a program. For example, if we are writing C program or Shell script and want to check coding mistakes after running or compiling it, turning on or off this feature may help a lot to identify [&#8230;]</p>
<p>The post <a rel="nofollow" href="http://lifelinux.com/how-to-display-vi-vim-text-editor-line-numbers/">How To Display vi / vim Text Editor Line Numbers</a> appeared first on <a rel="nofollow" href="http://lifelinux.com">lifeLinux: Linux Tips, Hacks, Tutorials, Ebooks</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p></p><p>Displaying line numbers in vi/vim can be very useful for debugging code errors and to improve overall readability of a program. For example, if we are writing C program or Shell script and want to check coding mistakes after running or compiling it, turning on or off this feature may help a lot to identify coding problem.<br />
<span id="more-857"></span></p>
<h3>Display line numbers in vi/vim</h3>
<p>To display line numbers along the left side of a window, type any one of the following:</p>
<pre>:set nu</pre>
<p>or</p>
<pre>:set number</pre>
<p>Sample output<br />
<a href="http://www.lifelinux.com/wp-content/uploads/2011/05/vi_show_line_numbers.png"><img class="aligncenter size-full wp-image-862" title="vi_show_line_numbers" src="http://www.lifelinux.com/wp-content/uploads/2011/05/vi_show_line_numbers.png" alt="vi_show_line_numbers" width="500" srcset="http://lifelinux.com/wp-content/uploads/2011/05/vi_show_line_numbers.png 641w, http://lifelinux.com/wp-content/uploads/2011/05/vi_show_line_numbers-300x180.png 300w" sizes="(max-width: 641px) 100vw, 641px" /></a></p>
<h3>Hide line numbers in vi/vim</h3>
<p>To turn off line number again, type the following command:</p>
<pre>
:set nu!
</pre>
<h3>Make vi/vim show line numbers by default</h3>
<p>The vimrc files contains optional runtime configuration settings to initialize vi/vim when it starts. On Unix/Linux based systems, the file is named .vimrc. To display line numbers every time you start vi/vim, append following line to your ~/.vimrc file:</p>
<pre>
set number
</pre>
<p>Save and close the file, type</p>
<pre>
:wq!
</pre>
<g:plusone href="http://lifelinux.com/how-to-display-vi-vim-text-editor-line-numbers/" size="standard"  annotation="none"   ></g:plusone><p>The post <a rel="nofollow" href="http://lifelinux.com/how-to-display-vi-vim-text-editor-line-numbers/">How To Display vi / vim Text Editor Line Numbers</a> appeared first on <a rel="nofollow" href="http://lifelinux.com">lifeLinux: Linux Tips, Hacks, Tutorials, Ebooks</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>http://lifelinux.com/how-to-display-vi-vim-text-editor-line-numbers/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>How to backup and restore large mysql database</title>
		<link>http://lifelinux.com/how-to-backup-and-restore-large-mysql-database/</link>
					<comments>http://lifelinux.com/how-to-backup-and-restore-large-mysql-database/#respond</comments>
		
		<dc:creator><![CDATA[lifeLinux]]></dc:creator>
		<pubDate>Sun, 01 May 2011 07:00:13 +0000</pubDate>
				<category><![CDATA[MySQL]]></category>
		<category><![CDATA[Sys Admin]]></category>
		<category><![CDATA[backup data]]></category>
		<category><![CDATA[backup mysql]]></category>
		<category><![CDATA[backup script]]></category>
		<category><![CDATA[backup service]]></category>
		<category><![CDATA[centralized storage]]></category>
		<category><![CDATA[ftp backup]]></category>
		<category><![CDATA[ftp servers]]></category>
		<category><![CDATA[gnu tar]]></category>
		<category><![CDATA[incremental backup]]></category>
		<category><![CDATA[incremental backups]]></category>
		<category><![CDATA[mysql databases]]></category>
		<category><![CDATA[mysql server]]></category>
		<category><![CDATA[mysqldump]]></category>
		<category><![CDATA[nas backup]]></category>
		<category><![CDATA[script generator]]></category>
		<category><![CDATA[shell script]]></category>
		<category><![CDATA[storage array]]></category>
		<category><![CDATA[tape backups]]></category>
		<category><![CDATA[tar command]]></category>
		<category><![CDATA[tar gz]]></category>
		<guid isPermaLink="false">http://www.lifelinux.com/?p=317</guid>

					<description><![CDATA[<p>If you have very large mysql database then it is very hard to backup and restore using the conventional phpmyadmin or any other programs. In this Tutorial I will explain you how to backup and restore a larger database. This tutorial can be used while moving your database from one server to another. First you [&#8230;]</p>
<p>The post <a rel="nofollow" href="http://lifelinux.com/how-to-backup-and-restore-large-mysql-database/">How to backup and restore large mysql database</a> appeared first on <a rel="nofollow" href="http://lifelinux.com">lifeLinux: Linux Tips, Hacks, Tutorials, Ebooks</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p></p><p>If you have very large <strong>mysql database</strong> then it is very hard to backup and restore using the conventional phpmyadmin or any other programs.<br />
In this Tutorial I will explain you how to backup and restore a larger database. This tutorial can be used while moving your database from one server to another.<span id="more-317"></span><br />
First you need to have shell (ssh) access to your server. Then follow the steps:</p>
<h3>To Backup Mysql Database</h3>
<pre>
root@lifelinux:~# mysqldump  -u [username] -p[password] [dbname] > [backup.sql]
</pre>
<p>[username] is your database user name<br />
[password] is the password for your database (Note: there is no space between -p and the password)<br />
[dbname] is The name of your database<br />
[backup.sql] is The file name for your database backup</p>
<h3>Backup Mysql Database with compress</h3>
<p>If your mysql database is very big, you might want to compress the output of mysql dump. Just use the mysql backup command below and pipe the output to gzip, then you will get the output as gzip file.</p>
<pre>
root@lifelinux:~# mysqldump -u [username] -p[password] [dbname] | gzip -9 > [backup.sql.gz]
</pre>
<h3>Restore Mysql Database</h3>
<p>To restore the database you need to create the database in target machine then use this command</p>
<pre>
root@lifelinux:~# mysql -u [username] -p[password] [dbname] < [backup.sql]
</pre>
<h3>Restore Compressed Mysql Database</h3>
<pre>
root@lifelinux:~# gunzip < [backup.sql.gz] | mysql -u [username] -p[password] [dbname]
</pre>
<g:plusone href="http://lifelinux.com/how-to-backup-and-restore-large-mysql-database/" size="standard"  annotation="none"   ></g:plusone><p>The post <a rel="nofollow" href="http://lifelinux.com/how-to-backup-and-restore-large-mysql-database/">How to backup and restore large mysql database</a> appeared first on <a rel="nofollow" href="http://lifelinux.com">lifeLinux: Linux Tips, Hacks, Tutorials, Ebooks</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>http://lifelinux.com/how-to-backup-and-restore-large-mysql-database/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
	</channel>
</rss>
