<?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>BenMcGrail.com &#187; My Notes</title>
	<atom:link href="http://benmcgrail.com/category/my-notes/feed/" rel="self" type="application/rss+xml" />
	<link>http://benmcgrail.com</link>
	<description>&#60;--------------- new palm pre!!</description>
	<lastBuildDate>Thu, 15 Oct 2009 15:59:05 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Windows file names with space at end</title>
		<link>http://benmcgrail.com/2009/06/windows-file-names-with-space-at-end/</link>
		<comments>http://benmcgrail.com/2009/06/windows-file-names-with-space-at-end/#comments</comments>
		<pubDate>Thu, 18 Jun 2009 23:45:33 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[My Notes]]></category>

		<guid isPermaLink="false">http://benmcgrail.com/?p=31</guid>
		<description><![CDATA[Have a file or directory that you can&#8217;t delete because there is a space at the end of the file name? 
If you try and delete from windows you will get the error message
&#8220;Error Deleting File or Folder&#8221;
&#8220;Cannot delete file: Cannot read from the source file or disk.&#8221;
To manipulate these files you need to address their [...]]]></description>
			<content:encoded><![CDATA[<p>Have a file or directory that you can&#8217;t delete because there is a space at the end of the file name? </p>
<p>If you try and delete from windows you will get the error message<br />
&#8220;Error Deleting File or Folder&#8221;<br />
&#8220;Cannot delete file: Cannot read from the source file or disk.&#8221;</p>
<p>To manipulate these files you need to address their absolute path with the prefix of &#8220;\\?\&#8221;</p>
<p>To do this you need to access these files from the command line. <br />
Start -&gt; Run -&gt; CMD<br />
del &#8220;<a href="file://\\?\c:\filename">\\?\c:\dir\filename</a> &#8221;</p>
<p>Make sure to include the quotes in above command.</p>
<p>For more information see &#8211; <a href="http://msdn.microsoft.com/en-us/library/aa365247.aspx">http://msdn.microsoft.com/en-us/library/aa365247.aspx</a></p>
]]></content:encoded>
			<wfw:commentRss>http://benmcgrail.com/2009/06/windows-file-names-with-space-at-end/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Script &#8211; Purge spam folder</title>
		<link>http://benmcgrail.com/2009/06/script-purge-spam-folder/</link>
		<comments>http://benmcgrail.com/2009/06/script-purge-spam-folder/#comments</comments>
		<pubDate>Thu, 18 Jun 2009 23:25:15 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Scripts]]></category>
		<category><![CDATA[bash]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[Maildir]]></category>
		<category><![CDATA[purge spam]]></category>

		<guid isPermaLink="false">http://benmcgrail.com/?p=29</guid>
		<description><![CDATA[#!/bin/bash
#This example is for a linux server using the following directory stucture to store email
#/home/unix-username/mail/domain/email-username/Maildir/.INBOX.spam/(cur &#124; new)
#the following command will find all spam messages system wide over 14 days old and remove them
/usr/bin/find /home/*/mail/*/*/Maildir/.INBOX.spam/*/ -type f -ctime +14 &#124; xargs /bin/rm -f
#-ctime n*24 hours
#-cmin n minutes
#-ctime +7 = &#62; 1 week
]]></description>
			<content:encoded><![CDATA[<p>#!/bin/bash<br />
#This example is for a linux server using the following directory stucture to store email<br />
#/home/unix-username/mail/domain/email-username/Maildir/.INBOX.spam/(cur | new)</p>
<p>#the following command will find all spam messages system wide over 14 days old and remove them<br />
/usr/bin/find /home/*/mail/*/*/Maildir/.INBOX.spam/*/ -type f -ctime +14 | xargs /bin/rm -f</p>
<p>#-ctime n*24 hours<br />
#-cmin n minutes<br />
#-ctime +7 = &gt; 1 week</p>
]]></content:encoded>
			<wfw:commentRss>http://benmcgrail.com/2009/06/script-purge-spam-folder/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Script &#8211; Avoid argument too long error</title>
		<link>http://benmcgrail.com/2009/06/script-avoid-argument-too-long-error/</link>
		<comments>http://benmcgrail.com/2009/06/script-avoid-argument-too-long-error/#comments</comments>
		<pubDate>Thu, 18 Jun 2009 23:02:25 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Scripts]]></category>
		<category><![CDATA[bash]]></category>
		<category><![CDATA[linux]]></category>

		<guid isPermaLink="false">http://benmcgrail.com/?p=25</guid>
		<description><![CDATA[When removing 10,000&#8217;s of files with rm -f * you get an argument too long error.
#### Remove too man files. 
#### First find -name &#8216;*&#8217; &#62; filelist
#!/bin/bash
for i in $( cat filelist );
do
echo $i
rm -f $i
done
#####
##### Easier way to remove too many files right from command line
#####
ls&#124;xargs rm -f
]]></description>
			<content:encoded><![CDATA[<p>When removing 10,000&#8217;s of files with rm -f * you get an argument too long error.</p>
<p>#### Remove too man files. <br />
#### First find -name &#8216;*&#8217; &gt; filelist</p>
<p>#!/bin/bash<br />
for i in $( cat filelist );<br />
do<br />
echo $i<br />
rm -f $i<br />
done<br />
#####<br />
##### Easier way to remove too many files right from command line<br />
#####</p>
<p>ls|xargs rm -f</p>
]]></content:encoded>
			<wfw:commentRss>http://benmcgrail.com/2009/06/script-avoid-argument-too-long-error/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Script &#8211; find and replace</title>
		<link>http://benmcgrail.com/2009/06/script-find-and-replace/</link>
		<comments>http://benmcgrail.com/2009/06/script-find-and-replace/#comments</comments>
		<pubDate>Thu, 18 Jun 2009 22:58:21 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Scripts]]></category>
		<category><![CDATA[bash]]></category>
		<category><![CDATA[linux]]></category>

		<guid isPermaLink="false">http://benmcgrail.com/?p=22</guid>
		<description><![CDATA[#########
#
#  change the same value in all files showen under ls in a directory
# good for mass IP changes
#
##########
#!/bin/bash
for i in $( ls );
do
sed -i &#8217;s/find/replace/g&#8217; $i
done
]]></description>
			<content:encoded><![CDATA[<p>#########<br />
#<br />
#  change the same value in all files showen under ls in a directory<br />
# good for mass IP changes<br />
#<br />
##########<br />
#!/bin/bash<br />
for i in $( ls );<br />
do<br />
sed -i &#8217;s/find/replace/g&#8217; $i<br />
done</p>
]]></content:encoded>
			<wfw:commentRss>http://benmcgrail.com/2009/06/script-find-and-replace/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Script &#8211; bash while loop</title>
		<link>http://benmcgrail.com/2009/06/script-bash-while-loop/</link>
		<comments>http://benmcgrail.com/2009/06/script-bash-while-loop/#comments</comments>
		<pubDate>Thu, 18 Jun 2009 22:15:55 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Scripts]]></category>

		<guid isPermaLink="false">http://benmcgrail.com/?p=17</guid>
		<description><![CDATA[#!/bin/bash
while read line;
do echo &#8220;&#60;option&#62;$line&#60;/option&#62;&#8221; &#62;&#62; cities.out;
done &#60; cities.in
# above processes a text file where a line item might contain spaces
# a for loop that cat&#8217;s the file will process each space as a separate item
#!/bin/bash
x=1
while [ $x -le 100 ]
do
  echo &#8220;Hello World &#8211; $x times&#8221;
  x=$(( $x + 1 ))
done
]]></description>
			<content:encoded><![CDATA[<p>#!/bin/bash<br />
while read line;<br />
do echo &#8220;&lt;option&gt;$line&lt;/option&gt;&#8221; &gt;&gt; cities.out;<br />
done &lt; cities.in</p>
<p># above processes a text file where a line item might contain spaces<br />
# a for loop that cat&#8217;s the file will process each space as a separate item<br />
#!/bin/bash<br />
x=1<br />
while [ $x -le 100 ]<br />
do<br />
  echo &#8220;Hello World &#8211; $x times&#8221;<br />
  x=$(( $x + 1 ))<br />
done</p>
]]></content:encoded>
			<wfw:commentRss>http://benmcgrail.com/2009/06/script-bash-while-loop/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Script &#8211; named.conf.secondary</title>
		<link>http://benmcgrail.com/2009/06/script-named-conf-secondary/</link>
		<comments>http://benmcgrail.com/2009/06/script-named-conf-secondary/#comments</comments>
		<pubDate>Thu, 18 Jun 2009 22:12:22 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Scripts]]></category>
		<category><![CDATA[bash]]></category>
		<category><![CDATA[bind]]></category>
		<category><![CDATA[linux]]></category>

		<guid isPermaLink="false">http://benmcgrail.com/?p=14</guid>
		<description><![CDATA[My Notes
#######
#
## Command Line Input &#8211; Create single secondary entry
#
#####
#!/bin/bash
# Edit IP variable to equal the IP address of the master name server
IP=10.0.0.1
echo -n &#8220;Enter Domain Name: &#8221;
read name
echo &#8220;zone \&#8221;$name\&#8221; { type slave; masters { $IP; }; file \&#8221;/var/named/$name.sec\&#8221;; };&#8221; &#62;&#62; /etc/named.conf.secondary
#######
#  Make Secondary named.conf file
# FROM MASTER named.conf
#######
#!/bin/bash
IP=10.0.0.1
cat /etc/named.conf &#124;grep zone &#124;grep -v &#8220;type [...]]]></description>
			<content:encoded><![CDATA[<p>My Notes</p>
<p>#######<br />
#<br />
## Command Line Input &#8211; Create single secondary entry<br />
#<br />
#####</p>
<p>#!/bin/bash<br />
# Edit IP variable to equal the IP address of the master name server<br />
IP=10.0.0.1<br />
echo -n &#8220;Enter Domain Name: &#8221;<br />
read name<br />
echo &#8220;zone \&#8221;$name\&#8221; { type slave; masters { $IP; }; file \&#8221;/var/named/$name.sec\&#8221;; };&#8221; &gt;&gt; /etc/named.conf.secondary<br />
#######<br />
#  Make Secondary named.conf file<br />
# FROM MASTER named.conf<br />
#######</p>
<p>#!/bin/bash<br />
IP=10.0.0.1<br />
cat /etc/named.conf |grep zone |grep -v &#8220;type slave&#8221;|grep -v named.ca|cut -d \&#8221; -f2 &gt; secondarylist.txt</p>
<p>dt=$(date)<br />
echo &#8220;// Vitex Secondary Zones $dt&#8221; &gt; named.conf.secondary</p>
<p>for i in $( cat secondarylist.txt ); do<br />
   echo &#8220;zone \&#8221;$i\&#8221; { type slave; masters { $IP; }; file \&#8221;secondary/$i.sec\&#8221;; };&#8221; &gt;&gt; named.conf.secondary<br />
   echo item: $i<br />
done</p>
<p> </p>
<p>############<br />
#<br />
# PHP version<br />
#<br />
#######</p>
<p>&lt;?php</p>
<p>define(&#8217;IP&#8217;,'10.0.0.1&#8242;);<br />
function Main($file=&#8217;named.conf.secondary&#8217;)</p>
<p>{<br />
if (!strlen($file) ||<br />
    !is_readable($file) ||<br />
    !is_file($file)) die(&#8217;Could not open file.&#8217;);<br />
$cnt = file($file);</p>
<p>$fmt = array(&#8217;zone &#8220;%s&#8221; {&#8217;);<br />
$fmt[] = &#8216;     type slave;&#8217;;<br />
$fmt[] = &#8216;     file &#8220;secondary/%s.sec&#8221;;&#8217;;<br />
$fmt[] = &#8216;     masters { %s; };&#8217;;<br />
$fmt[] = &#8216;};&#8217;;<br />
$fmt = join(&#8221;\n&#8221;,$fmt);</p>
<p>foreach($cnt as $line)<br />
printf($fmt.&#8221;\n\n&#8221;,rtrim(substr($line, 4)),rtrim(substr($line,4)),IP);<br />
}</p>
<p>if ($_SERVER['argc'] &lt; 2) printf(&#8221;Usage: %s &lt;file&gt;\n&#8221;,$_SERVER['argv'][0]);<br />
else Main($_SERVER['argv'][1]);</p>
<p>?&gt;</p>
]]></content:encoded>
			<wfw:commentRss>http://benmcgrail.com/2009/06/script-named-conf-secondary/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

