<?xml version="1.0" encoding="UTF-8"?><rss
version="2.0"
xmlns:content="http://purl.org/rss/1.0/modules/content/"
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/"
> <channel><title>Comments on: HowTo: Backup MySQL Databases, Web server Files to a FTP Server Automatically</title> <atom:link href="http://www.cyberciti.biz/tips/how-to-backup-mysql-databases-web-server-files-to-a-ftp-server-automatically.html/feed" rel="self" type="application/rss+xml" /><link>http://www.cyberciti.biz/tips/how-to-backup-mysql-databases-web-server-files-to-a-ftp-server-automatically.html</link> <description>This is a Linux sys admin journal by Vivek about sys admin work, Linux tips &#38; tricks, hacks, news and more.</description> <lastBuildDate>Fri, 10 Feb 2012 20:37:43 +0000</lastBuildDate> <sy:updatePeriod>hourly</sy:updatePeriod> <sy:updateFrequency>1</sy:updateFrequency> <generator>http://wordpress.org/?v=3.3.1</generator> <item><title>By: Seldon</title><link>http://www.cyberciti.biz/tips/how-to-backup-mysql-databases-web-server-files-to-a-ftp-server-automatically.html#comment-178923</link> <dc:creator>Seldon</dc:creator> <pubDate>Mon, 23 Jan 2012 23:44:01 +0000</pubDate> <guid
isPermaLink="false">http://www.cyberciti.biz/tips/how-to-backup-mysql-databases-web-server-files-to-a-ftp-server-automatically.html#comment-178923</guid> <description>Ok, It is doing the file system backup so that works. Also the &quot;DIRS&quot; is set to &quot;/var/www&quot; not &quot;var/www&quot; (That was a typo sorry). So it is doing the backup but still failing because of this error. Also why cant I uncompress the data? For example I downloaded the FS file to my mac and tried to extract it, but I got a permissions error.</description> <content:encoded><![CDATA[<p>Ok, It is doing the file system backup so that works. Also the &#8220;DIRS&#8221; is set to &#8220;/var/www&#8221; not &#8220;var/www&#8221; (That was a typo sorry). So it is doing the backup but still failing because of this error. Also why cant I uncompress the data? For example I downloaded the FS file to my mac and tried to extract it, but I got a permissions error.</p> ]]></content:encoded> </item> <item><title>By: Seldon</title><link>http://www.cyberciti.biz/tips/how-to-backup-mysql-databases-web-server-files-to-a-ftp-server-automatically.html#comment-178896</link> <dc:creator>Seldon</dc:creator> <pubDate>Mon, 23 Jan 2012 00:38:50 +0000</pubDate> <guid
isPermaLink="false">http://www.cyberciti.biz/tips/how-to-backup-mysql-databases-web-server-files-to-a-ftp-server-automatically.html#comment-178896</guid> <description>I keep getting the following error, I have copied the script three times now. I would also like to add that I had to add the following to the &lt;a href=http://www.cyberciti.biz/faq/linux-unix-mysqldump-got-error1044-access-denied/ rel=&quot;nofollow&quot;&gt;script to make the mySQL&lt;/a&gt; work. It also looks like it is not doing the file system backup. For the &quot;DIRS&quot; i have var/www
Error: &quot;[: 79: 0: unexpected operator&quot;</description> <content:encoded><![CDATA[<p>I keep getting the following error, I have copied the script three times now. I would also like to add that I had to add the following to the <a
href=http://www.cyberciti.biz/faq/linux-unix-mysqldump-got-error1044-access-denied/ rel="nofollow">script to make the mySQL</a> work. It also looks like it is not doing the file system backup. For the &#8220;DIRS&#8221; i have var/www</p><p>Error: &#8220;[: 79: 0: unexpected operator&#8221;</p> ]]></content:encoded> </item> <item><title>By: Ronsky</title><link>http://www.cyberciti.biz/tips/how-to-backup-mysql-databases-web-server-files-to-a-ftp-server-automatically.html#comment-178703</link> <dc:creator>Ronsky</dc:creator> <pubDate>Tue, 17 Jan 2012 07:41:06 +0000</pubDate> <guid
isPermaLink="false">http://www.cyberciti.biz/tips/how-to-backup-mysql-databases-web-server-files-to-a-ftp-server-automatically.html#comment-178703</guid> <description>I got an error &quot;syntax error near unexpected token ‘do&quot;. What could be the possible cause of this error message?
Your reply will be greatly appreciated :)</description> <content:encoded><![CDATA[<p>I got an error &#8220;syntax error near unexpected token ‘do&#8221;. What could be the possible cause of this error message?</p><p>Your reply will be greatly appreciated :)</p> ]]></content:encoded> </item> <item><title>By: Andrew</title><link>http://www.cyberciti.biz/tips/how-to-backup-mysql-databases-web-server-files-to-a-ftp-server-automatically.html#comment-174645</link> <dc:creator>Andrew</dc:creator> <pubDate>Wed, 05 Oct 2011 03:57:22 +0000</pubDate> <guid
isPermaLink="false">http://www.cyberciti.biz/tips/how-to-backup-mysql-databases-web-server-files-to-a-ftp-server-automatically.html#comment-174645</guid> <description>The answer is sitting right in front of me. The file naming of the mysql files is different to the normal files. The time function used to create the name of the mysql files puts in &quot;:&quot; in the time segment of the name which is not allowed as part of a file name. Trying to figure out how to fix this up apart from just copying the way the time is done with the files, but this would change the way the incremental backups are done I presume.</description> <content:encoded><![CDATA[<p>The answer is sitting right in front of me. The file naming of the mysql files is different to the normal files. The time function used to create the name of the mysql files puts in &#8220;:&#8221; in the time segment of the name which is not allowed as part of a file name. Trying to figure out how to fix this up apart from just copying the way the time is done with the files, but this would change the way the incremental backups are done I presume.</p> ]]></content:encoded> </item> <item><title>By: Andrew</title><link>http://www.cyberciti.biz/tips/how-to-backup-mysql-databases-web-server-files-to-a-ftp-server-automatically.html#comment-174629</link> <dc:creator>Andrew</dc:creator> <pubDate>Tue, 04 Oct 2011 09:57:08 +0000</pubDate> <guid
isPermaLink="false">http://www.cyberciti.biz/tips/how-to-backup-mysql-databases-web-server-files-to-a-ftp-server-automatically.html#comment-174629</guid> <description>I am getting an issue when it goes to save the mysql dump file
NcFTP 3.2.2 (Aug 18, 2008) by Mike Gleason (http://www.NcFTP.com/contact/).
Connecting to 137.219.74.64...
FileZilla Server version 0.9.39 beta
written by Tim Kosse (Tim.Kosse@gmx.de)
Please visit http://sourceforge.net/projects/filezilla/
Logging in...
Logged on
Logged in to 137.219.74.64.
Usage: mkdir dir1 [dir2...]
CWD successful. &quot;/04-10-2011&quot; is current directory.
fs-i-04-10-2011-14h39m01s.tar.gz:                      160.00 B  112.98 kB/s
...mysql.04-10-2011-14:39:02.gz:  ETA:   0:00   32.00/131.51 kB  133.55 MB/s   Lost data connection to remote host: Broken pipe.
mysql-mysql.04-10-2011-14:39:02.gz:             128.00/131.51 kB    7.95 MB/s
put *: socket write error.
/tmp/backup.3661/fs-i-04-10-2011-14h39m01s.tar.gz /tmp/backup.3661/mysql-mysql.04-10-2011-14:39:02.gz
The first file is saved fine, the database dump is not.
Any ideas?</description> <content:encoded><![CDATA[<p>I am getting an issue when it goes to save the mysql dump file</p><p>NcFTP 3.2.2 (Aug 18, 2008) by Mike Gleason (<a
href="http://www.NcFTP.com/contact/" rel="nofollow">http://www.NcFTP.com/contact/</a>).<br
/> Connecting to 137.219.74.64&#8230;<br
/> FileZilla Server version 0.9.39 beta<br
/> written by Tim Kosse (Tim.Kosse@gmx.de)<br
/> Please visit <a
href="http://sourceforge.net/projects/filezilla/" rel="nofollow">http://sourceforge.net/projects/filezilla/</a><br
/> Logging in&#8230;<br
/> Logged on<br
/> Logged in to 137.219.74.64.<br
/> Usage: mkdir dir1 [dir2...]<br
/> CWD successful. &#8220;/04-10-2011&#8243; is current directory.<br
/> fs-i-04-10-2011-14h39m01s.tar.gz:                      160.00 B  112.98 kB/s<br
/> &#8230;mysql.04-10-2011-14:39:02.gz:  ETA:   0:00   32.00/131.51 kB  133.55 MB/s   Lost data connection to remote host: Broken pipe.<br
/> mysql-mysql.04-10-2011-14:39:02.gz:             128.00/131.51 kB    7.95 MB/s<br
/> put *: socket write error.<br
/> /tmp/backup.3661/fs-i-04-10-2011-14h39m01s.tar.gz /tmp/backup.3661/mysql-mysql.04-10-2011-14:39:02.gz</p><p>The first file is saved fine, the database dump is not.</p><p>Any ideas?</p> ]]></content:encoded> </item> <item><title>By: Kabuwa Mbulo</title><link>http://www.cyberciti.biz/tips/how-to-backup-mysql-databases-web-server-files-to-a-ftp-server-automatically.html#comment-173461</link> <dc:creator>Kabuwa Mbulo</dc:creator> <pubDate>Sun, 21 Aug 2011 14:38:07 +0000</pubDate> <guid
isPermaLink="false">http://www.cyberciti.biz/tips/how-to-backup-mysql-databases-web-server-files-to-a-ftp-server-automatically.html#comment-173461</guid> <description>Would like to backup a database running on linux to windows server where I would like to use data protection manager to backing the database!! How do I script this do dumps my database to a windows folder and then put it to tape? Help</description> <content:encoded><![CDATA[<p>Would like to backup a database running on linux to windows server where I would like to use data protection manager to backing the database!! How do I script this do dumps my database to a windows folder and then put it to tape? Help</p> ]]></content:encoded> </item> <item><title>By: MKZA</title><link>http://www.cyberciti.biz/tips/how-to-backup-mysql-databases-web-server-files-to-a-ftp-server-automatically.html#comment-173418</link> <dc:creator>MKZA</dc:creator> <pubDate>Fri, 19 Aug 2011 13:52:05 +0000</pubDate> <guid
isPermaLink="false">http://www.cyberciti.biz/tips/how-to-backup-mysql-databases-web-server-files-to-a-ftp-server-automatically.html#comment-173418</guid> <description>I had a problem last night and I hope someone can help with a solution. This script went rogue on one of my servers and did not complete but instead got into some horrible loop.
This morning I started noticing errors on my web sites and eventually tracked that down to a lack of disk space. I then looked in the /tmp/ folder on the server and found about 200 backup.xxxx directories created by this script.
What could have caused this script to have gone haywire like that?? I deleted the cron job, recreated it and reset it to run at midnight and will see if it happens again but it does worry me somewhat. The same script works perfectly on my other 2 servers.
Is there some way to force this script to die and email me if it runs into an error of ANY sort ????
Any help or suggestions would be greatly appreciated.</description> <content:encoded><![CDATA[<p>I had a problem last night and I hope someone can help with a solution. This script went rogue on one of my servers and did not complete but instead got into some horrible loop.</p><p>This morning I started noticing errors on my web sites and eventually tracked that down to a lack of disk space. I then looked in the /tmp/ folder on the server and found about 200 backup.xxxx directories created by this script.</p><p>What could have caused this script to have gone haywire like that?? I deleted the cron job, recreated it and reset it to run at midnight and will see if it happens again but it does worry me somewhat. The same script works perfectly on my other 2 servers.</p><p>Is there some way to force this script to die and email me if it runs into an error of ANY sort ????</p><p>Any help or suggestions would be greatly appreciated.</p> ]]></content:encoded> </item> <item><title>By: MKZA</title><link>http://www.cyberciti.biz/tips/how-to-backup-mysql-databases-web-server-files-to-a-ftp-server-automatically.html#comment-173346</link> <dc:creator>MKZA</dc:creator> <pubDate>Wed, 17 Aug 2011 10:25:46 +0000</pubDate> <guid
isPermaLink="false">http://www.cyberciti.biz/tips/how-to-backup-mysql-databases-web-server-files-to-a-ftp-server-automatically.html#comment-173346</guid> <description>This script is the BEES KNEES !!! I have this running on 3 servers like an absolute charm and now I can sleep at night knowing it&#039;s all taken care of.
I tried Shane&#039;s suggestion above for removing older backup folders but all I get is &quot;Directory not Empty&quot; back from ncftp. Will have to experiment a bit more with this.
What I found is a nice addition for is to include the following command in your ftpbackup.sh script just below the line ### Other Stuff ###
Add the following:
### Backup DPKG Software List ###
dpkg --get-selections &gt; /etc/installed-software-dpkg.log
Then you also have your list of all your installed applications and you can use that to restore them too as per this article: http://www.cyberciti.biz/tips/linux-get-list-installed-software-reinstallation-restore.html#comment-173345</description> <content:encoded><![CDATA[<p>This script is the BEES KNEES !!! I have this running on 3 servers like an absolute charm and now I can sleep at night knowing it&#8217;s all taken care of.</p><p>I tried Shane&#8217;s suggestion above for removing older backup folders but all I get is &#8220;Directory not Empty&#8221; back from ncftp. Will have to experiment a bit more with this.</p><p>What I found is a nice addition for is to include the following command in your ftpbackup.sh script just below the line ### Other Stuff ###</p><p>Add the following:</p><p>### Backup DPKG Software List ###<br
/> dpkg &#8211;get-selections &gt; /etc/installed-software-dpkg.log</p><p>Then you also have your list of all your installed applications and you can use that to restore them too as per this article: <a
href="http://www.cyberciti.biz/tips/linux-get-list-installed-software-reinstallation-restore.html#comment-173345" rel="nofollow">http://www.cyberciti.biz/tips/linux-get-list-installed-software-reinstallation-restore.html#comment-173345</a></p> ]]></content:encoded> </item> <item><title>By: Sanya</title><link>http://www.cyberciti.biz/tips/how-to-backup-mysql-databases-web-server-files-to-a-ftp-server-automatically.html#comment-172740</link> <dc:creator>Sanya</dc:creator> <pubDate>Mon, 25 Jul 2011 12:21:59 +0000</pubDate> <guid
isPermaLink="false">http://www.cyberciti.biz/tips/how-to-backup-mysql-databases-web-server-files-to-a-ftp-server-automatically.html#comment-172740</guid> <description>Hello, your script is that what i need. Thanks! But i have a question: i have several databases on my host,  how can i set single database, which i need to backup?</description> <content:encoded><![CDATA[<p>Hello, your script is that what i need. Thanks! But i have a question: i have several databases on my host,  how can i set single database, which i need to backup?</p> ]]></content:encoded> </item> <item><title>By: Shane</title><link>http://www.cyberciti.biz/tips/how-to-backup-mysql-databases-web-server-files-to-a-ftp-server-automatically.html#comment-172612</link> <dc:creator>Shane</dc:creator> <pubDate>Wed, 20 Jul 2011 15:57:18 +0000</pubDate> <guid
isPermaLink="false">http://www.cyberciti.biz/tips/how-to-backup-mysql-databases-web-server-files-to-a-ftp-server-automatically.html#comment-172612</guid> <description>If you want to delete old backups:
In my case, I only wanted to keep backups around for 1 week. So every day, when this runs, it removes the backup from 7 days ago. This is very easy to accomplish. Just add this code Before the ### Dump backup using FTP ### line:
REMOVAL_DATE=$(date -d &quot;1 week ago&quot; +&quot;%d-%m-%Y&quot;)
Then add this right after you open NCFTP, like so:
ncftp -u&quot;$FTPU&quot; -p&quot;$FTPP&quot; $FTPS&lt;&lt;EOF
rmdir $FTPD/$REMOVAL_DATE
You can change &quot;1 week ago&quot; as needed. &quot;1 day ago&quot; or &quot;1 month ago&quot; or &quot;3 months ago&quot; etc etc etc are all fine.</description> <content:encoded><![CDATA[<p>If you want to delete old backups:</p><p>In my case, I only wanted to keep backups around for 1 week. So every day, when this runs, it removes the backup from 7 days ago. This is very easy to accomplish. Just add this code Before the ### Dump backup using FTP ### line:</p><p>REMOVAL_DATE=$(date -d &#8220;1 week ago&#8221; +&#8221;%d-%m-%Y&#8221;)</p><p>Then add this right after you open NCFTP, like so:</p><p>ncftp -u&#8221;$FTPU&#8221; -p&#8221;$FTPP&#8221; $FTPS&lt;&lt;EOF<br
/> rmdir $FTPD/$REMOVAL_DATE</p><p>You can change &quot;1 week ago&quot; as needed. &quot;1 day ago&quot; or &quot;1 month ago&quot; or &quot;3 months ago&quot; etc etc etc are all fine.</p> ]]></content:encoded> </item> <item><title>By: Brad</title><link>http://www.cyberciti.biz/tips/how-to-backup-mysql-databases-web-server-files-to-a-ftp-server-automatically.html#comment-172407</link> <dc:creator>Brad</dc:creator> <pubDate>Mon, 11 Jul 2011 19:20:01 +0000</pubDate> <guid
isPermaLink="false">http://www.cyberciti.biz/tips/how-to-backup-mysql-databases-web-server-files-to-a-ftp-server-automatically.html#comment-172407</guid> <description>I would also like to have it email me every day, successful or not. How can I make this happen?</description> <content:encoded><![CDATA[<p>I would also like to have it email me every day, successful or not. How can I make this happen?</p> ]]></content:encoded> </item> <item><title>By: Pat O'Brien</title><link>http://www.cyberciti.biz/tips/how-to-backup-mysql-databases-web-server-files-to-a-ftp-server-automatically.html#comment-171332</link> <dc:creator>Pat O'Brien</dc:creator> <pubDate>Mon, 16 May 2011 01:01:57 +0000</pubDate> <guid
isPermaLink="false">http://www.cyberciti.biz/tips/how-to-backup-mysql-databases-web-server-files-to-a-ftp-server-automatically.html#comment-171332</guid> <description>I&#039;m not an expert by any means, but I wanted a way to inform me of failures as well. The script above only notified on successes. So I removed the ncftp portion of the script, and replaced it with this:
&lt;pre&gt;
ncftpput -E -u $FTPU -p $FTPP -m $FTPS $FTPD/$NOW $BACKUP/*
&lt;/pre&gt;
I had to use the -E option because I can&#039;t use passive mode at this time. Remove -E if you can use passive mode.
I then modified the last portion of the script to include my text for when the backup failed. It looks like this
&lt;pre&gt;
### Find out if ftp backup failed or not ###
if [ &quot;$?&quot; == &quot;0&quot; ]; then
rm -rf $BACKUP
T=/tmp/backup.good
echo &quot;Date: $(date)&quot;&gt;$T
echo &quot;Hostname: $(hostname)&quot; &gt;&gt;$T
echo &quot;&quot; &gt;&gt;$T
echo &quot;This email is to inform you that the latest backup was a success&quot; &gt;&gt;$T
mail  -s &quot;[host.example.com] - Backup Successful&quot; &quot;$EMAILID&quot; $T
echo &quot;Hostname: $(hostname)&quot; &gt;&gt;$T
echo &quot;&quot; &gt;&gt;$T
echo &quot;This email is to inform you that the latest backup has failed&quot; &gt;&gt;$T
echo &quot;&quot; &gt;&gt;$T
echo &quot;Please investigate why the backup failed. The backup files are still available at $BACKUP&quot; &gt;&gt;$T
echo &quot;&quot; &gt;&gt;$T
echo &quot;Don&#039;t forget to delete this directory when done&quot; &gt;&gt;$T
mail  -s &quot;[host.example.com] - Backup Failed&quot; &quot;$EMAILID&quot; &lt;$T
rm -f $T
fi
&lt;/pre&gt;</description> <content:encoded><![CDATA[<p>I&#8217;m not an expert by any means, but I wanted a way to inform me of failures as well. The script above only notified on successes. So I removed the ncftp portion of the script, and replaced it with this:</p><pre>
ncftpput -E -u $FTPU -p $FTPP -m $FTPS $FTPD/$NOW $BACKUP/*
</pre><p>I had to use the -E option because I can&#8217;t use passive mode at this time. Remove -E if you can use passive mode.</p><p>I then modified the last portion of the script to include my text for when the backup failed. It looks like this</p><pre>
### Find out if ftp backup failed or not ###
if [ "$?" == "0" ]; then
 rm -rf $BACKUP
 T=/tmp/backup.good
 echo "Date: $(date)"&gt;$T
 echo "Hostname: $(hostname)" &gt;&gt;$T
 echo "" &gt;&gt;$T
 echo "This email is to inform you that the latest backup was a success" &gt;&gt;$T
 mail  -s "[host.example.com] - Backup Successful" "$EMAILID" $T
 echo "Hostname: $(hostname)" &gt;&gt;$T
 echo "" &gt;&gt;$T
 echo "This email is to inform you that the latest backup has failed" &gt;&gt;$T
 echo "" &gt;&gt;$T
 echo "Please investigate why the backup failed. The backup files are still available at $BACKUP" &gt;&gt;$T
 echo "" &gt;&gt;$T
 echo "Don't forget to delete this directory when done" &gt;&gt;$T
 mail  -s "[host.example.com] - Backup Failed" "$EMAILID" &lt;$T
 rm -f $T
fi
</pre>]]></content:encoded> </item> <item><title>By: artware</title><link>http://www.cyberciti.biz/tips/how-to-backup-mysql-databases-web-server-files-to-a-ftp-server-automatically.html#comment-170748</link> <dc:creator>artware</dc:creator> <pubDate>Thu, 21 Apr 2011 09:28:00 +0000</pubDate> <guid
isPermaLink="false">http://www.cyberciti.biz/tips/how-to-backup-mysql-databases-web-server-files-to-a-ftp-server-automatically.html#comment-170748</guid> <description>Hello,
... is there a way to put in script a rule to delete backups older then,.... let say 3 months?,...for limited ftp space!</description> <content:encoded><![CDATA[<p>Hello,<br
/> &#8230; is there a way to put in script a rule to delete backups older then,&#8230;. let say 3 months?,&#8230;for limited ftp space!</p> ]]></content:encoded> </item> <item><title>By: Josh</title><link>http://www.cyberciti.biz/tips/how-to-backup-mysql-databases-web-server-files-to-a-ftp-server-automatically.html#comment-170435</link> <dc:creator>Josh</dc:creator> <pubDate>Sat, 02 Apr 2011 03:19:40 +0000</pubDate> <guid
isPermaLink="false">http://www.cyberciti.biz/tips/how-to-backup-mysql-databases-web-server-files-to-a-ftp-server-automatically.html#comment-170435</guid> <description>Well I have moded the script to do what I want. I used rar for compression and splitting the files up as its being made so I dont have a 100 gig file then have to call split to finish the job. Here it is. Hope this helps someone.
### System Setup ###
DIRS=&quot;/home/data&quot;
BACKUP=/olddrive/backup
NOW=$(date +&quot;%Y%m%d&quot;)
INCFILE=&quot;/olddrive/backup/tar-inc-backup.dat&quot;
DAY=$(date +&quot;%a&quot;)
FULLBACKUP=&quot;FRI&quot;
### FTP server Setup ###
FTPU=&quot;YOUR_USER&quot;
FTPP=&quot;YOUR_PASS&quot;
FTPS=&quot;YOUR_SERVER&quot;
NCFTP=&quot;$(which ncftpput)&quot;
### Other stuff ###
EMAILID=&quot;admin@barrettnetworks.com&quot;
### Start Backup for file system ###
[ ! -d $BACKUP ] &amp;&amp; mkdir -p $BACKUP &#124;&#124; :
### See if we want to make a full backup ###
if [ &quot;$DAY&quot; == &quot;$FULLBACKUP&quot; ]; then
FTPD=&quot;//full&quot;
FILE=&quot;full-$NOW.rar&quot;
rm $INCFILE
rar a -m5 -v50m $INCFILE $BACKUP/$FILE $DIRS
else
i=$(date +&quot;%Hh%Mm%Ss&quot;)
rar a -m5 -v50m FILE=&quot;inc-$NOW-$i.rar&quot;
rar a -m5 -v50m $INCFILE $BACKUP/$FILE $DIRS
fi
### Dump backup using FTP ###
#Start FTP backup using ncftp
ncftp -u&quot;$FTPU&quot; -p&quot;$FTPP&quot; $FTPS&lt;$T
echo &quot;Hostname: $(hostname)&quot; &gt;&gt;$T
echo &quot;Backup failed&quot; &gt;&gt;$T
mail  -s &quot;BACKUP FAILED&quot; &quot;$EMAILID&quot; &lt;$T
rm -f $T
fi</description> <content:encoded><![CDATA[<p>Well I have moded the script to do what I want. I used rar for compression and splitting the files up as its being made so I dont have a 100 gig file then have to call split to finish the job. Here it is. Hope this helps someone.</p><p>### System Setup ###<br
/> DIRS=&#8221;/home/data&#8221;<br
/> BACKUP=/olddrive/backup<br
/> NOW=$(date +&#8221;%Y%m%d&#8221;)<br
/> INCFILE=&#8221;/olddrive/backup/tar-inc-backup.dat&#8221;<br
/> DAY=$(date +&#8221;%a&#8221;)<br
/> FULLBACKUP=&#8221;FRI&#8221;</p><p>### FTP server Setup ###<br
/> FTPU=&#8221;YOUR_USER&#8221;<br
/> FTPP=&#8221;YOUR_PASS&#8221;<br
/> FTPS=&#8221;YOUR_SERVER&#8221;<br
/> NCFTP=&#8221;$(which ncftpput)&#8221;</p><p>### Other stuff ###<br
/> EMAILID=&#8221;admin@barrettnetworks.com&#8221;</p><p>### Start Backup for file system ###<br
/> [ ! -d $BACKUP ] &amp;&amp; mkdir -p $BACKUP || :</p><p>### See if we want to make a full backup ###<br
/> if [ "$DAY" == "$FULLBACKUP" ]; then<br
/> FTPD=&#8221;//full&#8221;<br
/> FILE=&#8221;full-$NOW.rar&#8221;<br
/> rm $INCFILE<br
/> rar a -m5 -v50m $INCFILE $BACKUP/$FILE $DIRS<br
/> else<br
/> i=$(date +&#8221;%Hh%Mm%Ss&#8221;)<br
/> rar a -m5 -v50m FILE=&#8221;inc-$NOW-$i.rar&#8221;<br
/> rar a -m5 -v50m $INCFILE $BACKUP/$FILE $DIRS<br
/> fi</p><p>### Dump backup using FTP ###<br
/> #Start FTP backup using ncftp<br
/> ncftp -u&#8221;$FTPU&#8221; -p&#8221;$FTPP&#8221; $FTPS&lt;$T<br
/> echo &#8220;Hostname: $(hostname)&#8221; &gt;&gt;$T<br
/> echo &#8220;Backup failed&#8221; &gt;&gt;$T<br
/> mail  -s &#8220;BACKUP FAILED&#8221; &#8220;$EMAILID&#8221; &lt;$T<br
/> rm -f $T<br
/> fi</p> ]]></content:encoded> </item> <item><title>By: Josh</title><link>http://www.cyberciti.biz/tips/how-to-backup-mysql-databases-web-server-files-to-a-ftp-server-automatically.html#comment-170416</link> <dc:creator>Josh</dc:creator> <pubDate>Fri, 01 Apr 2011 05:17:48 +0000</pubDate> <guid
isPermaLink="false">http://www.cyberciti.biz/tips/how-to-backup-mysql-databases-web-server-files-to-a-ftp-server-automatically.html#comment-170416</guid> <description>Also is there a way to split the files in say 50-100mb files before they go to FTP?
Thanks Again!</description> <content:encoded><![CDATA[<p>Also is there a way to split the files in say 50-100mb files before they go to FTP?</p><p>Thanks Again!</p> ]]></content:encoded> </item> <item><title>By: Josh</title><link>http://www.cyberciti.biz/tips/how-to-backup-mysql-databases-web-server-files-to-a-ftp-server-automatically.html#comment-170391</link> <dc:creator>Josh</dc:creator> <pubDate>Wed, 30 Mar 2011 23:37:47 +0000</pubDate> <guid
isPermaLink="false">http://www.cyberciti.biz/tips/how-to-backup-mysql-databases-web-server-files-to-a-ftp-server-automatically.html#comment-170391</guid> <description>Is there a way to have it email you on a successful backup not just if it failed?
Thanks!!</description> <content:encoded><![CDATA[<p>Is there a way to have it email you on a successful backup not just if it failed?</p><p>Thanks!!</p> ]]></content:encoded> </item> <item><title>By: mordaha</title><link>http://www.cyberciti.biz/tips/how-to-backup-mysql-databases-web-server-files-to-a-ftp-server-automatically.html#comment-170037</link> <dc:creator>mordaha</dc:creator> <pubDate>Fri, 18 Mar 2011 15:49:38 +0000</pubDate> <guid
isPermaLink="false">http://www.cyberciti.biz/tips/how-to-backup-mysql-databases-web-server-files-to-a-ftp-server-automatically.html#comment-170037</guid> <description>And this is modification - using lftp mirroring (so you always have a copy of backup locally) and automaticaly deleting old backup files (you can have 1-2-4-... weeks of backup as you wish)
&lt;pre&gt;
### System Setup ###
DIRS=&quot;/etc /var /home&quot;
BACKUP=/backup/backup
NOW=$(date +&quot;%Y%m%d&quot;)
INCFILE=&quot;/root/tar-inc-backup.dat&quot;
DAY=$(date +&quot;%a&quot;)
FULLBACKUP=&quot;Sun&quot;
### FTP server Setup ###
FTPU=&quot;uu&quot;
FTPP=&quot;ppp&quot;
FTPS=&quot;ftps&quot;
NCFTP=&quot;$(which ncftpput)&quot;
### Other stuff ###
EMAILID=&quot;mail@gmail.com&quot;
### Start Backup for file system ###
[ ! -d $BACKUP ] &amp;&amp; mkdir -p $BACKUP &#124;&#124; :
### See if we want to make a full backup ###
if [ &quot;$DAY&quot; == &quot;$FULLBACKUP&quot; ]; then
FTPD=&quot;//full&quot;
FILE=&quot;full-$NOW.tar.gz&quot;
rm $INCFILE
tar -g $INCFILE -zcvf $BACKUP/$FILE $DIRS
else
i=$(date +&quot;%Hh%Mm%Ss&quot;)
FILE=&quot;inc-$NOW-$i.tar.gz&quot;
tar -g $INCFILE -zcvf $BACKUP/$FILE $DIRS
fi
### Dump backup using FTP ###
#Start FTP backup using ncftp
lftp &lt;&lt;EOF
open -u $FTPU,$FTPP $FTPS
mkdir //backup
&lt;strong&gt;mirror -c -e -R /backup/backup //backup&lt;/strong&gt;
quit
EOF
### Find out if ftp backup failed or not ###
if [ &quot;$?&quot; == &quot;0&quot; ]; then
&lt;strong&gt;find $BACKUP/*gz -ctime +8 -delete&lt;/strong&gt;
else
T=/tmp/backup.fail
echo &quot;Date: $(date)&quot;&gt;$T
echo &quot;Hostname: $(hostname)&quot; &gt;&gt;$T
echo &quot;Backup failed&quot; &gt;&gt;$T
mail  -s &quot;BACKUP FAILED&quot; &quot;$EMAILID&quot; &lt;$T
rm -f $T
fi
&lt;/pre&gt;</description> <content:encoded><![CDATA[<p>And this is modification &#8211; using lftp mirroring (so you always have a copy of backup locally) and automaticaly deleting old backup files (you can have 1-2-4-&#8230; weeks of backup as you wish)</p><pre>
### System Setup ###
DIRS="/etc /var /home"
BACKUP=/backup/backup
NOW=$(date +"%Y%m%d")
INCFILE="/root/tar-inc-backup.dat"
DAY=$(date +"%a")
FULLBACKUP="Sun"
### FTP server Setup ###
FTPU="uu"
FTPP="ppp"
FTPS="ftps"
NCFTP="$(which ncftpput)"
### Other stuff ###
EMAILID="mail@gmail.com"
### Start Backup for file system ###
[ ! -d $BACKUP ] &amp;&amp; mkdir -p $BACKUP || :
### See if we want to make a full backup ###
if [ "$DAY" == "$FULLBACKUP" ]; then
  FTPD="//full"
  FILE="full-$NOW.tar.gz"
  rm $INCFILE
  tar -g $INCFILE -zcvf $BACKUP/$FILE $DIRS
else
  i=$(date +"%Hh%Mm%Ss")
  FILE="inc-$NOW-$i.tar.gz"
  tar -g $INCFILE -zcvf $BACKUP/$FILE $DIRS
fi
### Dump backup using FTP ###
#Start FTP backup using ncftp
lftp &lt;&lt;EOF
open -u $FTPU,$FTPP $FTPS
mkdir //backup
<strong>mirror -c -e -R /backup/backup //backup</strong>
quit
EOF
### Find out if ftp backup failed or not ###
if [ "$?" == "0" ]; then
 <strong>find $BACKUP/*gz -ctime +8 -delete</strong>
else
 T=/tmp/backup.fail
 echo "Date: $(date)"&gt;$T
 echo "Hostname: $(hostname)" &gt;&gt;$T
 echo "Backup failed" &gt;&gt;$T
 mail  -s "BACKUP FAILED" "$EMAILID" &lt;$T
 rm -f $T
fi
</pre>]]></content:encoded> </item> <item><title>By: mordaha</title><link>http://www.cyberciti.biz/tips/how-to-backup-mysql-databases-web-server-files-to-a-ftp-server-automatically.html#comment-170035</link> <dc:creator>mordaha</dc:creator> <pubDate>Fri, 18 Mar 2011 15:39:32 +0000</pubDate> <guid
isPermaLink="false">http://www.cyberciti.biz/tips/how-to-backup-mysql-databases-web-server-files-to-a-ftp-server-automatically.html#comment-170035</guid> <description>Your script making monday-inc.tgz as incrementary backup from saturday, not from sunday full backup.
When you are doing FULL backup, you must first delete $INCFILE
&lt;pre&gt;
if [ &quot;$DAY&quot; == &quot;$FULLBACKUP&quot; ]; then
FTPD=&quot;/home/vivek/full&quot;
FILE=&quot;fs-full-$NOW.tar.gz&quot;
&lt;strong&gt;rm $INCFILE&lt;/strong&gt;
tar &lt;strong&gt;-g $INCFILE&lt;/strong&gt; -zcvf $BACKUP/$FILE $DIRS
else
i=$(date +&quot;%Hh%Mm%Ss&quot;)
FILE=&quot;fs-i-$NOW-$i.tar.gz&quot;
tar -g $INCFILE -zcvf $BACKUP/$FILE $DIRS
fi
&lt;/pre&gt;</description> <content:encoded><![CDATA[<p>Your script making monday-inc.tgz as incrementary backup from saturday, not from sunday full backup.</p><p>When you are doing FULL backup, you must first delete $INCFILE</p><pre>
if [ "$DAY" == "$FULLBACKUP" ]; then
  FTPD="/home/vivek/full"
  FILE="fs-full-$NOW.tar.gz"
  <strong>rm $INCFILE</strong>
  tar <strong>-g $INCFILE</strong> -zcvf $BACKUP/$FILE $DIRS
else
  i=$(date +"%Hh%Mm%Ss")
  FILE="fs-i-$NOW-$i.tar.gz"
  tar -g $INCFILE -zcvf $BACKUP/$FILE $DIRS
fi
</pre>]]></content:encoded> </item> <item><title>By: shahid parvez</title><link>http://www.cyberciti.biz/tips/how-to-backup-mysql-databases-web-server-files-to-a-ftp-server-automatically.html#comment-168433</link> <dc:creator>shahid parvez</dc:creator> <pubDate>Mon, 24 Jan 2011 18:39:12 +0000</pubDate> <guid
isPermaLink="false">http://www.cyberciti.biz/tips/how-to-backup-mysql-databases-web-server-files-to-a-ftp-server-automatically.html#comment-168433</guid> <description>i have a shared hosting. can anybody please help me that how can i set my cronjob for shared hosting.</description> <content:encoded><![CDATA[<p>i have a shared hosting. can anybody please help me that how can i set my cronjob for shared hosting.</p> ]]></content:encoded> </item> <item><title>By: Mitchell</title><link>http://www.cyberciti.biz/tips/how-to-backup-mysql-databases-web-server-files-to-a-ftp-server-automatically.html#comment-167071</link> <dc:creator>Mitchell</dc:creator> <pubDate>Thu, 30 Dec 2010 18:07:56 +0000</pubDate> <guid
isPermaLink="false">http://www.cyberciti.biz/tips/how-to-backup-mysql-databases-web-server-files-to-a-ftp-server-automatically.html#comment-167071</guid> <description>Hi. The page at https://bash.cyberciti.biz/backup/wizard-ftp-script.php (the SSL script generator) seems to be broken.</description> <content:encoded><![CDATA[<p>Hi. The page at <a
href="https://bash.cyberciti.biz/backup/wizard-ftp-script.php" rel="nofollow">https://bash.cyberciti.biz/backup/wizard-ftp-script.php</a> (the SSL script generator) seems to be broken.</p> ]]></content:encoded> </item> </channel> </rss>
