<?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>Computer support articles &#187; ftp</title>
	<atom:link href="http://www.mycomputeraid.com/tag/ftp/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.mycomputeraid.com</link>
	<description>Free computer support, articles and Guides</description>
	<lastBuildDate>Sat, 18 Sep 2010 03:46:20 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>Simple linux FTP backup script</title>
		<link>http://www.mycomputeraid.com/linux/server/simple-linux-ftp-backup-script/</link>
		<comments>http://www.mycomputeraid.com/linux/server/simple-linux-ftp-backup-script/#comments</comments>
		<pubDate>Mon, 02 Jun 2008 06:30:27 +0000</pubDate>
		<dc:creator>MyComputerAid</dc:creator>
				<category><![CDATA[Linux scripts]]></category>
		<category><![CDATA[Server administration]]></category>
		<category><![CDATA[backup]]></category>
		<category><![CDATA[ftp]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[mysql]]></category>
		<category><![CDATA[mysqldump]]></category>
		<category><![CDATA[script]]></category>
		<category><![CDATA[tar]]></category>

		<guid isPermaLink="false">http://www.mycomputeraid.com/?p=17</guid>
		<description><![CDATA[This is a quick and simple linux FTP backup script we use to run on clients servers that have small backups that need to be shipped off to a remote FTP server somewhere.  You can basically backup anything from here, Mysql, Apache config files, webserver files etc&#8230; Requirments: Shell access ncftp Vi or Pico/Nano editor [...]]]></description>
			<content:encoded><![CDATA[<p>This is a quick and simple linux FTP backup script we use to run on clients servers that have small backups that need to be shipped off to a remote FTP server somewhere.  You can basically backup anything from here, Mysql, Apache config files, webserver files etc&#8230;</p>
<p><strong>Requirments:</strong><br />
Shell access<br />
ncftp<br />
Vi or Pico/Nano editor<br />
Cron</p>
<p><strong>Step 1:</strong><br />
Log into your server as the user you want to run this script as (usually root).  You can then create a file somewhere on your server (I usually put the file in /etc/backup)</p>
<p># cd /etc<br />
# mkdir backup<br />
# cd backup<br />
# nano backup.sh</p>
<p><strong>Step 2:</strong><br />
Cut and paste the script I have written into the file and then edit the parts required (it is spretty streight forward to understand but I will put comments on each line &#8212; the comments will start with a * so do not add these comments into your script).  After you have edited and save the file you must chmod the file 755 to make it executable</p>
<p>#!/bin/sh<br />
HOST=&#8217;192.168.1.3&#8242;<br />
* this can be an ip address or a hostname of the destination FTP server<br />
USER=&#8217;ftpbackup&#8217;<br />
* the username of the ftp server<br />
PASSWD=&#8217;backup0012&#8242;<br />
* the password on the ftp server<br />
DATE=`/bin/date +%Y%m%d`<br />
* no edits for DATE<br />
TIME=`/bin/date +%H`<br />
* No Edits for TIME<br />
HOSTNAME=`/bin/hostname`<br />
* No edits for HOSTNAME</p>
<p>mysqldump -c -B -uroot -pfoobar DB1 DB2 mysql &gt; data.sql &amp;&amp;<br />
* This is if you want to backup your mysql database, DB1 and DB2 represent databases within mysql you want yo backup -uroot -pfoobar (change this to your mysql username and password). if you are not backing up mysql then remove the above line.</p>
<p>tar zcvf $DATE.$TIME.$HOSTNAME.tar.gz ./data.sql /etc/ /var/www &gt; /dev/null &amp;&amp;<br />
* you can edit this line as you wish if you are not backing up mysql you can remove ./data.sql, you can add directories such as /etc and /var/www</p>
<p>ncftpput -u $USER -p $PASSWD $HOST /tobebackedup $DATE.$TIME.$HOSTNAME.tar.gz ;:<br />
* nothing to edit here</p>
<p><strong>The finished script:</strong></p>
<p>#!/bin/sh<br />
HOST=&#8217;192.168.1.3&#8242;<br />
USER=&#8217;ftpbackup&#8217;<br />
PASSWD=&#8217;backup0012&#8242;<br />
DATE=`/bin/date +%Y%m%d`<br />
TIME=`/bin/date +%H`<br />
HOSTNAME=`/bin/hostname`</p>
<p>mysqldump -c -B -uroot -pfoobar DB1 DB2 mysql &gt; data.sql &amp;&amp;<br />
tar zcvf $DATE.$TIME.$HOSTNAME.tar.gz ./data.sql &gt; /dev/null &amp;&amp;</p>
<p>ncftpput -u ftpbackup -p backup0012 $HOST /tobebackedup $DATE.$TIME.$HOSTNAME.tar.gz ;:</p>
<p><strong>Running the script on a schedule (Crontab howto):</strong><br />
as the user that you want to run the backup script as type the following commands:</p>
<p>crontab -e<br />
To run weekly on Sunday enter the line:<br />
* * * * 6 /etc/backup/backup.sh
<p><i>Article written by <a href="http://www.mycomputeraid.com">MyComputerAid.com</a></i></p>
<p class="a2a_link">
<a name="a2a_dd" onmouseover="a2a_show_dropdown(this)" onmouseout="a2a_onMouseOut_delay()" href="http://www.addtoany.com/bookmark?sitename=Computer%20support%20articles&amp;siteurl=http%3A%2F%2Fwww.mycomputeraid.com%2F&amp;linkname=Simple%20linux%20FTP%20backup%20script&amp;linkurl=http%3A%2F%2Fwww.mycomputeraid.com%2Flinux%2Fserver%2Fsimple-linux-ftp-backup-script%2F">
	<img  src= "http://www.mycomputeraid.com/wp-content/plugins/add-to-any/bookmark.gif"  width= "91"  height= "16"  border= "0"  alt= "Bookmark title="bookmark image" />
</a>
<script type="text/javascript">a2a_linkname="Simple linux FTP backup script";a2a_linkurl="http://www.mycomputeraid.com/linux/server/simple-linux-ftp-backup-script/";</script>
<script type="text/javascript" src="http://www.addtoany.com/js.dropdown.js?type=page"></script>

</p><p>Post from: <a href="http://www.mycomputeraid.com">MyComputerAid.com Computer support</a></p>
<p><a href="http://www.mycomputeraid.com/linux/server/simple-linux-ftp-backup-script/">Simple linux FTP backup script</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.mycomputeraid.com/linux/server/simple-linux-ftp-backup-script/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

