<?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>TECH.kulish.com &#187; Perl</title>
	<atom:link href="http://tech.kulish.com/category/scripting/perl/feed/" rel="self" type="application/rss+xml" />
	<link>http://tech.kulish.com</link>
	<description>Technical Goulash</description>
	<lastBuildDate>Thu, 01 Dec 2011 00:39:52 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Simple MySQL Backup Script</title>
		<link>http://tech.kulish.com/2005/12/15/simple-mysql-backup-script/</link>
		<comments>http://tech.kulish.com/2005/12/15/simple-mysql-backup-script/#comments</comments>
		<pubDate>Thu, 15 Dec 2005 05:00:36 +0000</pubDate>
		<dc:creator>Null</dc:creator>
				<category><![CDATA[Databases]]></category>
		<category><![CDATA[FreeBSD]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[MySQL]]></category>
		<category><![CDATA[OS]]></category>
		<category><![CDATA[Perl]]></category>
		<category><![CDATA[Scripting]]></category>
		<category><![CDATA[Unix]]></category>
		<category><![CDATA[backup]]></category>
		<category><![CDATA[Backup Script]]></category>
		<category><![CDATA[BSD]]></category>
		<category><![CDATA[database]]></category>

		<guid isPermaLink="false">http://tech.lan.side/?p=109</guid>
		<description><![CDATA[Below is a simple database backup script to use with MySQL. #!/usr/bin/perl -w use strict; # Backup &#8211; Script used to backup MySQL databases to an NFS share. # VERSION: 1.2 # DATE: 12152005 # AUTHOR: packetmad # This is a Freebsd 4.x-centric script. It may run on other # versions of Freebsd, or any [...]]]></description>
			<content:encoded><![CDATA[<p>Below is a simple database backup script to use with MySQL.</p>
<p>#!/usr/bin/perl -w</p>
<p>use strict;</p>
<p># Backup &#8211; Script used to backup MySQL databases to an NFS share.<br />
# VERSION: 1.2<br />
# DATE: 12152005<br />
# AUTHOR: packetmad</p>
<p># This is a Freebsd 4.x-centric script. It may run on other<br />
# versions of Freebsd, or any other BSD for that matter, but I<br />
# wrote it on a Freebsd 4.7 system. It&#8217;s not even guaranteed<br />
# to run on that.</p>
<p># Speaking of guarantees, warranties, etc., there ain&#8217;t one, so<br />
# don&#8217;t even try. :P<br />
# I am not responsible for the output of this script, nor am I<br />
# responsible for any damage or data loss as a result of using<br />
# this script. In short, I am not responsible for anything<br />
# regarding this script.<br />
# Furthermore, I am not responsible if this script causes<br />
# Your dog to die, your wife to leave you, or<br />
# your truck to break down.<br />
# I am releasing this script under the conventions of the BSD<br />
# license. You can use it, modify it, sleep with it, or<br />
# whatever. If you do find this script useful or have<br />
# suggestions on a better way to do some things contained here<br />
# in, I welcome all correspondence.<br />
# The latest version of this script can be obtained at:<br />
# http://tech.kulish.com</p>
<p># USE THIS SCRIPT AT YOUR OWN RISK!!!!!!!!!!!!!!!!!!</p>
<p># Change Log<br />
# v1.1<br />
# Date: 11302002<br />
# Initial Release, absolutely BUG FREE! :)<br />
# v1.2<br />
# Date: 12152005<br />
# Added compression functionality<br />
# Added naming of backup files by date<br />
# Changed longterm storeage directory for 1back to store1</p>
<p>###<br />
# Declare variables and arrays.<br />
###</p>
<p>my (<br />
$bdir, $sysname, $logfile, %databases, $key, $database, $rightnow<br />
);</p>
<p>$bdir = &#8216;/databases/&#8217;;<br />
chomp ( $sysname = `uname -n` );<br />
chomp ( $rightnow = `date +%m%d%G%H%M` );<br />
#print $rightnow;<br />
# Databases we want to backup and associated archive names.<br />
# Database => sql file pairs.</p>
<p>%databases = (&#8216;testdb1&#8242; => &#8216;testdb1.sql&#8217;,<br />
&#8216;testdb2&#8242; => &#8216;testdb2.sql&#8217;);</p>
<p>###<br />
# Backup Section<br />
###<br />
foreach $key (sort keys %databases) {<br />
$database = $databases{$key};<br />
`mysqldump -uUSERNAME -pPASSWORD $key >> $bdir$sysname/$database`;}</p>
<p>###<br />
# Compression Functionality<br />
###</p>
<p>foreach $key (sort keys %databases) {<br />
$database = $databases{$key};<br />
`gzip -c $bdir$sysname/$database > $bdir$sysname/$rightnow$database.gz`;}</p>
<p># scp them to the fileshare<br />
#`scp $bdir$sysname/*.gz USERNAME\@SERVER:databases`;</p>
<p>###<br />
# Clean backup dir<br />
###</p>
<p>`rm -rf $bdir$sysname/*.sql`;<br />
`mv $bdir$sysname/*.gz $bdir$sysname/store1`;</p>
]]></content:encoded>
			<wfw:commentRss>http://tech.kulish.com/2005/12/15/simple-mysql-backup-script/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Win32 Perl</title>
		<link>http://tech.kulish.com/2003/02/19/win32-perl/</link>
		<comments>http://tech.kulish.com/2003/02/19/win32-perl/#comments</comments>
		<pubDate>Wed, 19 Feb 2003 23:22:44 +0000</pubDate>
		<dc:creator>Null</dc:creator>
				<category><![CDATA[OS]]></category>
		<category><![CDATA[Perl]]></category>
		<category><![CDATA[Scripting]]></category>
		<category><![CDATA[Windows]]></category>
		<category><![CDATA[backup]]></category>
		<category><![CDATA[print]]></category>

		<guid isPermaLink="false">http://tech.lan.side/?p=142</guid>
		<description><![CDATA[Actually did my first win32 perl script at work today. What a pita that can be when you are changing from *n?x perl. Most of the problems I encountered were editor issues. Guess I should have just gotten vi for Windows and been done with it. ### # First we&#8217;ll change into the directory passed [...]]]></description>
			<content:encoded><![CDATA[<p>Actually did my first win32 perl script at work today. What a pita that can be when you are changing from *n?x perl. Most of the problems I encountered were editor issues. Guess I should have just gotten vi for Windows and been done with it.</p>
<p>###<br />
# First we&#8217;ll change into the directory passed in the command line<br />
###<br />
$workdirectory = @ARGV[0];<br />
#print (&#8220;$workdirectory\n&#8221;);<br />
chdir (&#8220;$workdirectory&#8221;) || die &#8220;cannot cd to $workdirectory&#8221;;</p>
<p>###<br />
# Lets get a numeric date for use in naming the zip files<br />
###<br />
$insanedate = `date /t`;<br />
# print $insanedate;<br />
$insanedate =~ /.*?(\d{2})\/(\d{2})\/(\d{4})/;<br />
$sanedate = &#8220;$1$2$3&#8243;;<br />
# print &#8220;$sanedate\n&#8221;;</p>
<p>###<br />
# Time to backup the .bak files<br />
###<br />
# must include the extension in the form of *.ext<br />
@baklist = `dir /b *.bak`;<br />
if (!@baklist)<br />
{<br />
# Drop out of the script if there is nothing to backup!<br />
print &#8220;No files to backup&#8221;;<br />
die;<br />
}<br />
else<br />
{<br />
# This will create a zipfile with the current date.zip<br />
`pkzip $sanedate.zip *.bak`;</p>
<p>###<br />
# Take care of directory cleanup<br />
###<br />
@filelist = `dir /b /o:d *.zip`;<br />
# The $keeperN files are the ones that will be (newest) saved,<br />
# anything left in the list will be removed from the directory<br />
if (@filelist)<br />
{<br />
$keeper1 = pop (@filelist);<br />
$keeper2 = pop (@filelist);<br />
# $keeper3 = pop (@filelist);<br />
# print (&#8220;$keeper1&#8243;);<br />
# print (&#8220;$keeper2&#8243;);<br />
# print (&#8220;$keeper3&#8243;);</p>
<p># DANGER Will Robinson!! DANGER!!<br />
`del *.bak`;<br />
# Activating the following del statement has the potential to<br />
# do lots of damage. Please check working directory first!<br />
foreach $leftover (@filelist)<br />
{<br />
print $leftover;<br />
# `del $leftover`;<br />
}<br />
}<br />
else<br />
{<br />
print &#8220;No zip files, CAUTION!&#8221;;<br />
die;<br />
}<br />
}</p>
]]></content:encoded>
			<wfw:commentRss>http://tech.kulish.com/2003/02/19/win32-perl/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

<!-- Served from: kulish.com @ 2012-02-07 18:59:52 by W3 Total Cache -->
