<?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>blog.rudylee.com&#187; Unix and Linux</title>
	<atom:link href="http://blog.rudylee.com/category/unix-and-linux/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.rudylee.com</link>
	<description>keep it humble</description>
	<lastBuildDate>Tue, 24 Jan 2012 23:13:26 +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>Gource</title>
		<link>http://blog.rudylee.com/2011/08/28/gource/</link>
		<comments>http://blog.rudylee.com/2011/08/28/gource/#comments</comments>
		<pubDate>Sun, 28 Aug 2011 07:39:32 +0000</pubDate>
		<dc:creator>Rudy</dc:creator>
				<category><![CDATA[Unix and Linux]]></category>
		<category><![CDATA[bazaar]]></category>
		<category><![CDATA[command line tool]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[linux kernel project]]></category>
		<category><![CDATA[software version control]]></category>
		<category><![CDATA[using software]]></category>
		<category><![CDATA[visualization tool]]></category>

		<guid isPermaLink="false">http://blog.rudylee.com/?p=640</guid>
		<description><![CDATA[Gource is a software version control visualization tool. It was built using C/C++ ( not sure ). Several version controls that supported by Gource are Git, SVN, Mercurial and Bazaar. Basically Gource is a command line tool that you can use to visualize your project&#8217;s progress that using software version control. Here is the example ...<p><a href="http://blog.rudylee.com/2011/08/28/gource/">Gource</a> is a post from: <a href="http://blog.rudylee.com">blog.rudylee.com</a></p>
]]></description>
			<content:encoded><![CDATA[<blockquote><p>Gource is a software version control visualization tool. It was built using C/C++ ( not sure ). Several version controls that supported by Gource are Git, SVN, Mercurial and Bazaar.</p></blockquote>
<p>Basically Gource is a command line tool that you can use to visualize your project&#8217;s progress that using software version control. Here is the example of my project :</p>
<p><iframe src="http://www.youtube.com/embed/BLFCr0zwYyI" frameborder="0" width="560" height="345"></iframe></p>
<p>Cool isn&#8217;t it ? In my video, there is only one person because I am working for this project alone. However, if you are looking in YouTube, you can find a lot of big projects that using Gource to visualize their progress. One of the project that you should see is the Linux Kernel project.</p>
<p>Here is the link to the <a href="http://code.google.com/p/gource/">Gource Website</a></p>
<p><a href="http://blog.rudylee.com/2011/08/28/gource/">Gource</a> is a post from: <a href="http://blog.rudylee.com">blog.rudylee.com</a></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.rudylee.com/2011/08/28/gource/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Apache GeoIP</title>
		<link>http://blog.rudylee.com/2011/04/13/apache-geoip/</link>
		<comments>http://blog.rudylee.com/2011/04/13/apache-geoip/#comments</comments>
		<pubDate>Wed, 13 Apr 2011 04:33:20 +0000</pubDate>
		<dc:creator>Rudy</dc:creator>
				<category><![CDATA[Unix and Linux]]></category>
		<category><![CDATA[apache module]]></category>
		<category><![CDATA[australia]]></category>
		<category><![CDATA[country code]]></category>
		<category><![CDATA[geoip]]></category>
		<category><![CDATA[htaccess file]]></category>
		<category><![CDATA[ip]]></category>
		<category><![CDATA[restart apache]]></category>
		<category><![CDATA[rewriterule]]></category>
		<category><![CDATA[www canada]]></category>

		<guid isPermaLink="false">http://blog.rudylee.com/?p=587</guid>
		<description><![CDATA[Apache GeoIP is an apache module for detecting your visitor&#8217;s IP and block/redirect them to another website. Installing and configuring GeoIP is very easy in Ubuntu. Here are the steps : 1.Install the Apache GeoIP module and restart apache webserver sudo apt-get install libapache2-geoip sudo /etc/init.d/apache2 restart 2.Create the .htaccess file and put in your ...<p><a href="http://blog.rudylee.com/2011/04/13/apache-geoip/">Apache GeoIP</a> is a post from: <a href="http://blog.rudylee.com">blog.rudylee.com</a></p>
]]></description>
			<content:encoded><![CDATA[<p>Apache GeoIP is an apache module for detecting your visitor&#8217;s IP and block/redirect them to another website. Installing and configuring GeoIP is very easy in Ubuntu. Here are the steps :</p>
<p>1.Install the Apache GeoIP module and restart apache webserver</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">sudo</span> <span style="color: #c20cb9; font-weight: bold;">apt-get</span> <span style="color: #c20cb9; font-weight: bold;">install</span> libapache2-geoip
<span style="color: #c20cb9; font-weight: bold;">sudo</span> <span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>init.d<span style="color: #000000; font-weight: bold;">/</span>apache2 restart</pre></div></div>

<p>2.Create the .htaccess file and put in your webroot folder / website folder</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">GeoIPEnable On
&nbsp;
<span style="color: #666666; font-style: italic;"># Redirect one country</span>
RewriteEngine on
RewriteCond <span style="color: #000000; font-weight: bold;">%</span><span style="color: #7a0874; font-weight: bold;">&#123;</span>ENV:GEOIP_COUNTRY_CODE<span style="color: #7a0874; font-weight: bold;">&#125;</span> ^AU$
RewriteRule ^<span style="color: #7a0874; font-weight: bold;">&#40;</span>.<span style="color: #000000; font-weight: bold;">*</span><span style="color: #7a0874; font-weight: bold;">&#41;</span>$ http:<span style="color: #000000; font-weight: bold;">//</span>www.canada.com<span style="color: #007800;">$1</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span>L<span style="color: #7a0874; font-weight: bold;">&#93;</span></pre></div></div>

<p>In the example above, GeoIP will check whether the visitor is from Australia or not. If the visitor is from Australia then apache will redirect the visitor to http://www.canada.com. Quite simple and straight forward. You can see another example in here<a href="http://www.maxmind.com/app/mod_geoip"> http://www.maxmind.com/app/mod_geoip</a> ( ignore the GeoIPDBFile because it will cause error ).</p>
<p><a href="http://blog.rudylee.com/2011/04/13/apache-geoip/">Apache GeoIP</a> is a post from: <a href="http://blog.rudylee.com">blog.rudylee.com</a></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.rudylee.com/2011/04/13/apache-geoip/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Redcar : Textmate alike editor</title>
		<link>http://blog.rudylee.com/2010/09/30/redcar-textmate-alike-editor/</link>
		<comments>http://blog.rudylee.com/2010/09/30/redcar-textmate-alike-editor/#comments</comments>
		<pubDate>Thu, 30 Sep 2010 04:54:28 +0000</pubDate>
		<dc:creator>Rudy</dc:creator>
				<category><![CDATA[Unix and Linux]]></category>
		<category><![CDATA[editor]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[textmate]]></category>

		<guid isPermaLink="false">http://blog.rudylee.com/?p=542</guid>
		<description><![CDATA[It&#8217;s been a long time since the last time I am using e-texteditor as my primary text editor ( e-texteditor is a textmate alike editor for Windows ). And because I decided to use Linux, I have to find another editor and now I ended up using Eclipse. In Linux, obviously, there are several text ...<p><a href="http://blog.rudylee.com/2010/09/30/redcar-textmate-alike-editor/">Redcar : Textmate alike editor</a> is a post from: <a href="http://blog.rudylee.com">blog.rudylee.com</a></p>
]]></description>
			<content:encoded><![CDATA[<p>It&#8217;s been a long time since the last time I am using e-texteditor as my primary text editor ( e-texteditor is a textmate alike editor for Windows ). And because I decided to use Linux, I have to find another editor and now I ended up using Eclipse. In Linux, obviously, there are several text editor but the features doesn&#8217;t fit my needs.   </p>
<p>But now there is a new text editor that written in Ruby and runs on JRuby and it&#8217;s features are inspired by Textmate : <a href="http://redcareditor.com/">Redcar</a>. Actually, I already tried to use redcar last year and at that time the features are not as complete as now. </p>
<p>You can follow the development through it&#8217;s <a href="http://github.com/redcar/redcar">github repository</a>. The author Dan, is very active and looks like he commit often <img src='http://blog.rudylee.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' />  </p>
<p>As far as I tested, the bundles support is good enough in compare with e-texteditor ( I am using version 0.5.1 ) and bundles is the top reason why I like using Textmate-alike editor. Looking forward to use it as my primary text editor in Linux.</p>
<p><a href="http://blog.rudylee.com/2010/09/30/redcar-textmate-alike-editor/">Redcar : Textmate alike editor</a> is a post from: <a href="http://blog.rudylee.com">blog.rudylee.com</a></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.rudylee.com/2010/09/30/redcar-textmate-alike-editor/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Add bridge and assign unique IP for each container in OpenVZ</title>
		<link>http://blog.rudylee.com/2010/08/30/add-bridge-assign-unique-ip-for-each-container-in-openvz/</link>
		<comments>http://blog.rudylee.com/2010/08/30/add-bridge-assign-unique-ip-for-each-container-in-openvz/#comments</comments>
		<pubDate>Mon, 30 Aug 2010 03:33:27 +0000</pubDate>
		<dc:creator>Rudy</dc:creator>
				<category><![CDATA[Unix and Linux]]></category>
		<category><![CDATA[bridge]]></category>
		<category><![CDATA[openvz]]></category>
		<category><![CDATA[venet]]></category>
		<category><![CDATA[veth]]></category>

		<guid isPermaLink="false">http://blog.rudylee.com/?p=538</guid>
		<description><![CDATA[I am writing this tutorial to refresh my mind ( I am not configuring the machine right now ), so forgive if me the explanations are not clear and structured. After you successfully installed the OpenVZ you need to configure the IP for the containers. If you are using the built in &#8220;Venet&#8221; you will ...<p><a href="http://blog.rudylee.com/2010/08/30/add-bridge-assign-unique-ip-for-each-container-in-openvz/">Add bridge and assign unique IP for each container in OpenVZ</a> is a post from: <a href="http://blog.rudylee.com">blog.rudylee.com</a></p>
]]></description>
			<content:encoded><![CDATA[<p>I am writing this tutorial to refresh my mind ( I am not configuring the machine right now ), so forgive if me the explanations are not clear and structured.</p>
<p>After you successfully installed the OpenVZ you need to configure the IP for the containers. If you are using the built in &#8220;Venet&#8221; you will end up making the host as the gateway. In the other words if you traceroute to your container IP, it will through your host then to your container. Here are the sample of the scenario :</p>
<ol>
<li>Host IP : 202.58.181.2</li>
<li>Container 1 : 202.58.181.50</li>
<li>Container 2 : 202.58.181.51</li>
</ol>
<p>Basically if you use the venet, if you traceroute to the Container 1 the result should be : Your ISP -> 202.58.181.2 -> 202.58.181.50 so the IP of the Host is showed up. Same if try to traceroute to the second container. My solution to overcome this problem are :</p>
<ol>
<li>Make a bridge using brctl command</li>
<li>Use the Veth instead of Venet</li>
<li>Put all the Veth into the bridge</li>
<li>Assign the Host IP to the bridge</li>
</ol>
<p>If you not ASSIGN the host IP to the bridge, you can&#8217;t access the host machine. The guidelines that I followed is from link <a href="http://wiki.openvz.org/Using_veth_and_brctl_for_protecting_HN_and_saving_IP_addresses">http://wiki.openvz.org/Using_veth_and_brctl_for_protecting_HN_and_saving_IP_addresses</a></p>
<p>Here is my /etc/rc.local configuration looks like :</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
</pre></td><td class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;">#!/bin/sh</span>
<span style="color: #666666; font-style: italic;">#</span>
<span style="color: #666666; font-style: italic;"># This script will be executed *after* all the other init scripts.</span>
<span style="color: #666666; font-style: italic;"># You can put your own initialization stuff in here if you don't</span>
<span style="color: #666666; font-style: italic;"># want to do the full Sys V style init stuff.</span>
&nbsp;
<span style="color: #c20cb9; font-weight: bold;">touch</span> <span style="color: #000000; font-weight: bold;">/</span>var<span style="color: #000000; font-weight: bold;">/</span>lock<span style="color: #000000; font-weight: bold;">/</span>subsys<span style="color: #000000; font-weight: bold;">/</span><span style="color: #7a0874; font-weight: bold;">local</span>
brctl addbr vzbr0
brctl addif vzbr0 eth0
brctl addif vzbr0 veth1.0
brctl addif vzbr0 veth2.0
brctl addif vzbr0 veth3.0
brctl addif vzbr0 veth4.0
<span style="color: #c20cb9; font-weight: bold;">ifconfig</span> vzbr0 <span style="color: #000000;">0</span>
ip addr add 202.58.181.2<span style="color: #000000; font-weight: bold;">/</span><span style="color: #000000;">25</span> dev vzbr0
<span style="color: #7a0874; font-weight: bold;">cd</span> <span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>local<span style="color: #000000; font-weight: bold;">/</span>webvz<span style="color: #000000; font-weight: bold;">/</span> <span style="color: #000000; font-weight: bold;">&amp;&amp;</span> <span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>bin<span style="color: #000000; font-weight: bold;">/</span>ruby script<span style="color: #000000; font-weight: bold;">/</span>server <span style="color: #000000; font-weight: bold;">&amp;&gt;/</span>dev<span style="color: #000000; font-weight: bold;">/</span>null <span style="color: #000000; font-weight: bold;">&amp;</span></pre></td></tr></table></div>

<p>I&#8217;ll update this post if I need to configure another VPS Server.</p>
<p><a href="http://blog.rudylee.com/2010/08/30/add-bridge-assign-unique-ip-for-each-container-in-openvz/">Add bridge and assign unique IP for each container in OpenVZ</a> is a post from: <a href="http://blog.rudylee.com">blog.rudylee.com</a></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.rudylee.com/2010/08/30/add-bridge-assign-unique-ip-for-each-container-in-openvz/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Installing OpenVZ and WebVZ in Centos 5.5</title>
		<link>http://blog.rudylee.com/2010/07/20/installing-openvz-and-webvz-in-centos-5-5/</link>
		<comments>http://blog.rudylee.com/2010/07/20/installing-openvz-and-webvz-in-centos-5-5/#comments</comments>
		<pubDate>Tue, 20 Jul 2010 04:14:35 +0000</pubDate>
		<dc:creator>Rudy</dc:creator>
				<category><![CDATA[Unix and Linux]]></category>
		<category><![CDATA[centos]]></category>
		<category><![CDATA[containers]]></category>
		<category><![CDATA[grub]]></category>
		<category><![CDATA[instances]]></category>
		<category><![CDATA[kernels]]></category>
		<category><![CDATA[linux kernel]]></category>
		<category><![CDATA[management gui]]></category>
		<category><![CDATA[openvz]]></category>
		<category><![CDATA[operating system]]></category>
		<category><![CDATA[physical server]]></category>
		<category><![CDATA[repo]]></category>
		<category><![CDATA[repos]]></category>
		<category><![CDATA[repository]]></category>
		<category><![CDATA[Ruby on Rails]]></category>
		<category><![CDATA[virtual environments]]></category>
		<category><![CDATA[virtual private servers]]></category>
		<category><![CDATA[web application]]></category>
		<category><![CDATA[wiki]]></category>
		<category><![CDATA[xen]]></category>
		<category><![CDATA[yum]]></category>

		<guid isPermaLink="false">http://blog.rudylee.com/?p=511</guid>
		<description><![CDATA[OpenVZ is an operating system-level virtualization technology based on the Linux kernel and operating system. OpenVZ allows a physical server to run multiple isolated operating system instances, known as containers, Virtual Private Servers (VPSs), or Virtual Environments (VEs). Now we&#8217;ll trying to install OpenVZ in Centos , because it&#8217;s an operating system-level so you need ...<p><a href="http://blog.rudylee.com/2010/07/20/installing-openvz-and-webvz-in-centos-5-5/">Installing OpenVZ and WebVZ in Centos 5.5</a> is a post from: <a href="http://blog.rudylee.com">blog.rudylee.com</a></p>
]]></description>
			<content:encoded><![CDATA[<blockquote><p>
OpenVZ is an operating system-level virtualization technology based on the Linux kernel and operating system. OpenVZ allows a physical server to run multiple isolated operating system instances, known as containers, Virtual Private Servers (VPSs), or Virtual Environments (VEs).
</p></blockquote>
<p>Now we&#8217;ll trying to install OpenVZ in Centos , because it&#8217;s an operating system-level so you need to install it on top of Operating System ( if you are using hardware virtualization like Xen or VMware then you don&#8217;t have to install an Operating System ).</p>
<p>The first step is that you must install the Centos ( I am using Centos 5.5 ). I won&#8217;t explain about how to install it so you must find the tutorial yourself <img src='http://blog.rudylee.com/wp-includes/images/smilies/icon_razz.gif' alt=':P' class='wp-smiley' /> </p>
<p>Let&#8217;s say you already installed the Centos, next step is updating your yum package manager. Here are the steps :</p>
<ul>
<li>Download the OpenVZ repo from http://download.openvz.org/openvz.repo</li>
<li>Put it in /etc/yum.repos.d directory</li>
<li>Run the yum update command</li>
</ul>
<p>Wait until the process is complete, it will downloading all the necessary update package. ( you can find the complete tutorial in <a href="http://wiki.openvz.org/Yum">OpenVZ Wiki</a> ).</p>
<p>Now we will install the OpenVZ, type this to install the OpenVZ :</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">yum <span style="color: #c20cb9; font-weight: bold;">install</span> ovzkernel vzctl</pre></div></div>

<p>If the installation running smooth you will have OpenVZ installed, reboot your machine :</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">reboot</pre></div></div>

<p>Press any key when the Grub screen is popping out. If it&#8217;s installed then you must have 3 kernels. Choose the top kernel ( it&#8217;s the OpenVZ kernel, in my machine it&#8217;s name is CentOS ( 2.6.18-194.3.1.el5.028stab069.6 ).</p>
<p>Log in to your machine as usual, now you are running on OpenVZ kernel. The next step is we will install WebVZ ( the OpenVZ management GUI ). The WebVZ, like it&#8217;s name, is a web application that runs on Ruby on Rails. So you must have Ruby on Rails in your machine to use the WebVZ.</p>
<p>To help us installing the Ruby on Rails we will use <a href="http://rubyworks.rubyforge.org/">Ruby Works </a>. Ruby Works is one of the CentOS repository that provides with the newest installer of Ruby, Gem and Rails.</p>
<p>Here are the steps :<br />
1.Download the repo file</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">wget</span> http:<span style="color: #000000; font-weight: bold;">//</span>rubyworks.rubyforge.org<span style="color: #000000; font-weight: bold;">/</span>RubyWorks.repo</pre></div></div>

<p>2.Put it the file in the /etc/yum.repos.d<br />
3.yum update</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">yum update</pre></div></div>

<p>4.Installing the ruby packages</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">yum <span style="color: #c20cb9; font-weight: bold;">install</span> ruby ruby-devel ruby-irb ruby-rdoc ruby-ri</pre></div></div>

<p>5.Check the installed Ruby using this command ( it should print out the ruby version eg: ruby 1.8.6 )</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">ruby <span style="color: #660033;">-v</span></pre></div></div>

<p>6.Then download the latest gem at <a href="http://rubyforge.org/frs/?group_id=126">Rubyforge</a><br />
7.After download the latest gem, extract it, go the folder and run the installer</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">ruby setup.rb</pre></div></div>

<p>8.Check if the gem is installed successfully ( it should return the version too )</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">gem <span style="color: #660033;">-v</span></pre></div></div>

<p>9.Run the gem update to make sure the gem is up to date.</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">gem update</pre></div></div>

<p>10.Install the rails</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">gem <span style="color: #c20cb9; font-weight: bold;">install</span> rails <span style="color: #660033;">-v</span>=2.3.2</pre></div></div>

<p>11.The WebVZ need sqlite to run, so you must install the sqlite and the gcc compiler</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">yum <span style="color: #c20cb9; font-weight: bold;">install</span> sqlite-devel
yum <span style="color: #c20cb9; font-weight: bold;">install</span> <span style="color: #c20cb9; font-weight: bold;">gcc</span> <span style="color: #c20cb9; font-weight: bold;">make</span></pre></div></div>

<p>12.And the last is installing the sqlite for ruby</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">gem <span style="color: #c20cb9; font-weight: bold;">install</span> sqlite3-ruby <span style="color: #660033;">-v</span>=1.2.5</pre></div></div>

<p>13.Download the <a href="http://webvz.sourceforge.net/download.html">WebVZ installer</a> from it&#8217;s website. Extract it and run the application.</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #7a0874; font-weight: bold;">cd</span> webvz
ruby script<span style="color: #000000; font-weight: bold;">/</span>server</pre></div></div>

<p>That&#8217;s all, then you can access it via web browser http://your-ip:3000. the username is admin and the password is admin123.</p>
<p>Update : ( run the WebVZ as daemon )<br />
to run WebVZ as daemon just go to it&#8217;s directory run this command instead of plain &#8220;ruby script/server&#8221;</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">ruby script<span style="color: #000000; font-weight: bold;">/</span>server <span style="color: #000000; font-weight: bold;">&amp;&gt;/</span>dev<span style="color: #000000; font-weight: bold;">/</span>null <span style="color: #000000; font-weight: bold;">&amp;</span></pre></div></div>

<p>and to make it&#8217;s run everytime you boot the machine ( put it in rc.local )</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;">#!/bin/sh -e</span>
<span style="color: #666666; font-style: italic;">#</span>
<span style="color: #666666; font-style: italic;"># rc.local</span>
<span style="color: #666666; font-style: italic;">#</span>
<span style="color: #666666; font-style: italic;"># This script is executed at the end of each multiuser runlevel.</span>
<span style="color: #666666; font-style: italic;"># Make sure that the script will &quot;exit 0&quot; on success or any other</span>
<span style="color: #666666; font-style: italic;"># value on error.</span>
<span style="color: #666666; font-style: italic;">#</span>
<span style="color: #666666; font-style: italic;"># In order to enable or disable this script just change the execution</span>
<span style="color: #666666; font-style: italic;"># bits.</span>
<span style="color: #666666; font-style: italic;">#</span>
<span style="color: #666666; font-style: italic;"># By default this script does nothing.</span>
&nbsp;
<span style="color: #7a0874; font-weight: bold;">cd</span> <span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>local<span style="color: #000000; font-weight: bold;">/</span>webvz<span style="color: #000000; font-weight: bold;">/</span> <span style="color: #000000; font-weight: bold;">&amp;&amp;</span> <span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>bin<span style="color: #000000; font-weight: bold;">/</span>ruby script<span style="color: #000000; font-weight: bold;">/</span>server <span style="color: #000000; font-weight: bold;">&amp;&gt;/</span>dev<span style="color: #000000; font-weight: bold;">/</span>null <span style="color: #000000; font-weight: bold;">&amp;</span>
&nbsp;
<span style="color: #7a0874; font-weight: bold;">exit</span> <span style="color: #000000;">0</span></pre></div></div>

<p><a href="http://blog.rudylee.com/2010/07/20/installing-openvz-and-webvz-in-centos-5-5/">Installing OpenVZ and WebVZ in Centos 5.5</a> is a post from: <a href="http://blog.rudylee.com">blog.rudylee.com</a></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.rudylee.com/2010/07/20/installing-openvz-and-webvz-in-centos-5-5/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>Updating ports in FreeBSD 8.0</title>
		<link>http://blog.rudylee.com/2010/06/28/updating-ports-in-freebsd-8-0/</link>
		<comments>http://blog.rudylee.com/2010/06/28/updating-ports-in-freebsd-8-0/#comments</comments>
		<pubDate>Mon, 28 Jun 2010 05:12:33 +0000</pubDate>
		<dc:creator>Rudy</dc:creator>
				<category><![CDATA[Unix and Linux]]></category>
		<category><![CDATA[application folder]]></category>
		<category><![CDATA[freebsd]]></category>
		<category><![CDATA[mirror]]></category>
		<category><![CDATA[ports]]></category>
		<category><![CDATA[repository]]></category>
		<category><![CDATA[several ways]]></category>
		<category><![CDATA[share examples]]></category>
		<category><![CDATA[Ubuntu]]></category>

		<guid isPermaLink="false">http://blog.rudylee.com/?p=493</guid>
		<description><![CDATA[Ports is the applications repository in FreeBSD. Unlike Ubuntu that provides you with command &#8220;apt-get&#8221;, in FreeBSD you must manually go to the application folder in &#8220;/usr/ports&#8221; ( the folder where Ports remain ) and search for the application that you want to install. But what&#8217;s the differences between you compile it yourself and using ...<p><a href="http://blog.rudylee.com/2010/06/28/updating-ports-in-freebsd-8-0/">Updating ports in FreeBSD 8.0</a> is a post from: <a href="http://blog.rudylee.com">blog.rudylee.com</a></p>
]]></description>
			<content:encoded><![CDATA[<p>Ports is the applications repository in FreeBSD. Unlike Ubuntu that provides you with command &#8220;apt-get&#8221;, in FreeBSD you must manually go to the application folder in &#8220;/usr/ports&#8221; ( the folder where Ports remain ) and search for the application that you want to install. But what&#8217;s the differences between you compile it yourself and using ports. The answer is &#8220;dependencies&#8221;.</p>
<p>Enough with the introduction, let&#8217;s go the main topic. So we are going to update the Ports using cvsup. Yeah&#8230; yeah&#8230; I know that there are several ways to update the ports, but I prefer to use cvsup ( because it&#8217;s the way I taught ). The steps are :<br />
1.Install the cvsup</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">pkg_add <span style="color: #660033;">-vr</span> cvsup-without-gui</pre></div></div>

<p>2.Copy the ports-supfile from example</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">cp</span> <span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>share<span style="color: #000000; font-weight: bold;">/</span>examples<span style="color: #000000; font-weight: bold;">/</span>cvsup<span style="color: #000000; font-weight: bold;">/</span>ports-supfile .</pre></div></div>

<p>3.Rehash</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">rehash</pre></div></div>

<p>4.Edit the ports-supfile, find the line that say CHANGETHIS.FreeBSD.org. Change it with the mirror that is near you ( I am using BizNet )</p>
<p>5.Run the ports-supfile using cvsup</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">cvsup <span style="color: #660033;">-g</span> <span style="color: #660033;">-L</span> <span style="color: #000000;">2</span> ports-supfile</pre></div></div>

<p>Wait until the process is complete and your ports will be updated.</p>
<p><a href="http://blog.rudylee.com/2010/06/28/updating-ports-in-freebsd-8-0/">Updating ports in FreeBSD 8.0</a> is a post from: <a href="http://blog.rudylee.com">blog.rudylee.com</a></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.rudylee.com/2010/06/28/updating-ports-in-freebsd-8-0/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Copying files between 2 unix servers</title>
		<link>http://blog.rudylee.com/2010/06/08/copying-files-between-2-unix-servers/</link>
		<comments>http://blog.rudylee.com/2010/06/08/copying-files-between-2-unix-servers/#comments</comments>
		<pubDate>Tue, 08 Jun 2010 04:34:02 +0000</pubDate>
		<dc:creator>Rudy</dc:creator>
				<category><![CDATA[Unix and Linux]]></category>
		<category><![CDATA[ftp]]></category>
		<category><![CDATA[ksh]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[Ubuntu]]></category>
		<category><![CDATA[unix]]></category>

		<guid isPermaLink="false">http://blog.rudylee.com/?p=489</guid>
		<description><![CDATA[There are many solutions to copy files between 2 unix servers, such as : Copying the files from unix server to your local machine, and then upload the files to the destination server. Using NFS to share the files from your source server to your destination server. Using FTP to copy the files. First solution ...<p><a href="http://blog.rudylee.com/2010/06/08/copying-files-between-2-unix-servers/">Copying files between 2 unix servers</a> is a post from: <a href="http://blog.rudylee.com">blog.rudylee.com</a></p>
]]></description>
			<content:encoded><![CDATA[<p>There are many solutions to copy files between 2 unix servers, such as :</p>
<ul>
<li>Copying the files from unix server to your local machine, and then upload the files to the destination server.</li>
<li>Using NFS to share the files from your source server to your destination server.</li>
<li>Using FTP to copy the files.</li>
</ul>
<p>First solution is recommended if your files are not much and small in sizes. But if your files are big, then you must provide big storage in your local machine.  Using NFS can be an alternate solution, it&#8217;s easy to set up, easy to mount the directory and easy to copy the files. But sometimes there are some issues with the NFS, so you must be careful in using NFS.</p>
<p>The last solution is using FTP. Maybe you are wondering &#8220;How can I copy between 2 unix servers using FTP ? Do I have to copy it to local machine first ? &#8220;. Actually you don&#8217;t have to, because there is a technology called &#8216;XFTP&#8217;. They said that you can open 2 Unix Server in different window and copy between that two machines. But I haven&#8217;t tested that yet.</p>
<p>Another way is using &#8220;self made script&#8221; in which I don&#8217;t create it myself, I copied it from <a href="http://www.unix.com/shell-programming-scripting/9174-recursive-ftp-here-last.html">here</a>. The script allows you to connect to a ftp server, get all the the content of that ftp server and it&#8217;s all in terminal ( no GUI, no drag and drop, just bash command ). The script also provides you with several options ( you can get the content of specific folder in the ftp server ).</p>
<p>Here is the complete script in case the website is down :</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;">#! /usr/bin/ksh</span>
&nbsp;
&nbsp;
<span style="color: #666666; font-style: italic;">#</span>
<span style="color: #666666; font-style: italic;">#  HardFeed  --  Harvest A Remote Directory via</span>
<span style="color: #666666; font-style: italic;">#                Ftp Enhanced Exhaustive Duplication</span>
<span style="color: #666666; font-style: italic;">#</span>
<span style="color: #666666; font-style: italic;">#  Perderabo  11-23-02</span>
&nbsp;
<span style="color: #007800;">VERSION</span>=<span style="color: #ff0000;">&quot;1.1&quot;</span>    <span style="color: #666666; font-style: italic;"># 03-16-04</span>
&nbsp;
<span style="color: #007800;">USAGE</span>=<span style="color: #ff0000;">&quot;<span style="color: #000099; font-weight: bold;">\
</span>HardFeed [ -v | -s | -d | -r | -f | -m | -p password-file 
           -l list-command | -x ftp-command ...  ] system user [directory]
&nbsp;
use <span style="color: #000099; font-weight: bold;">\&quot;</span>HardFeed -h<span style="color: #000099; font-weight: bold;">\&quot;</span> use for more documentation
&nbsp;
-v (verbose)  Print stuff during run
-s (symlink)  Attempt to duplicate any remote symlinks
-d (directory)Attempt to duplicate any remote directories
-r (recurse)  Attempt to descend into any directories and process them
-f (freshen)  If remote file is newer than local file, overwrite the local 
-m (mode)     Attempt a chmod on files and directories that we create
-p (password) Specify a file that contains the password in plaintext
-x (extra)    Specify a command to be sent to the ftp client 
-l (listcmd)  Override the choice of <span style="color: #000099; font-weight: bold;">\&quot;</span>ls .<span style="color: #000099; font-weight: bold;">\&quot;</span> to get a remote directory&quot;</span>
&nbsp;
<span style="color: #007800;">DOCUMENTATION</span>=<span style="color: #ff0000;">&quot;HardFeed  Version <span style="color: #007800;">$VERSION</span>
&nbsp;
<span style="color: #007800;">$USAGE</span>
&nbsp;
HardFeed copies all of the contents of a remote directory to the current 
directory using ftp.  It establishes an ftp connection to the remote 
site and it uses the ftp command <span style="color: #000099; font-weight: bold;">\&quot;</span>ls<span style="color: #000099; font-weight: bold;">\&quot;</span> to get a listing of the remote
directory.  The two required parameters are the remote sytstem and the user
name.  The optional third parameter is the remote directory to copy.  The 
default is just the home directory of the ftp account.
&nbsp;
HardFeed will prompt you for the password.  This is very secure but it isn't
any good if you want to run HardFeed automatically. You can set the password in
the environment variable HARDFEED_P as an alternate.  HardFeed will set an
internal variable to the password and then clobber the variable HARDFEED_P,
since on some systems, the environment of another process can be displayed.
With most shells, you can also set an environment variable for one command
only, like this: <span style="color: #000099; font-weight: bold;">\&quot;</span>HARDFEED_P=xyzzy HardFeed -dR ftpxy joeblow sourcedir<span style="color: #000099; font-weight: bold;">\&quot;</span>. 
A second alternative is to specify a <span style="color: #000099; font-weight: bold;">\&quot;</span>password file<span style="color: #000099; font-weight: bold;">\&quot;</span> with the -p option.  
Such a file contains, in plaintext, the password.  HardFeed will read the file
to get the password.  You must decide which option makes more sense in your
environment.
&nbsp;
Only files are examined.  If we don't have a copy of the remote file, we 
will get it.  HardFeed will never overwrite an existing file system object
with one exception.  If you specify -f and we have both a remote file and a
local file, the timestamps are compared.  If the remote file is newer, a
retrieval attempt will be made.  The local file must be writable for this
to succeed.  For the timestamp compare to work, you and the remote system
must be in the same timezone.  (You can vary your environment to make this
true.)
&nbsp;
Normally symbolic links are ignored. But with -s, we will attempt to create
a symlink with the same link data.  Even with -s, we will never overwrite
any existing object with a new symbolic link.  You will need to review any
symlinks created and probably correct them.  
&nbsp;
Normally, directories are ignored.  If you specify -d, HardFeed will attempt
to create the directory locally.  But again, it will never overwrite an
existing object to create a directory.  If you specify -r, HardFeed will 
attempt to recurse into a directory and process all of the files there.  If
you use both -d and -r, it will copy an entire directory hierarchy.  But you
can leave off -d and only pre-create a few directories if you want.
&nbsp;
HardFeed will attempt a chmod of any file or directory that it creates if you 
specify -m.  It will try to match the mode of the remote object.
&nbsp;
HardFeed operates by establishing a co-process to the ftp command.  Normally,
the output from the co-process is sent to an un-named file in /tmp and
discarded.  If you want to capture this output, connect a file to fd 3 and
HardFeed will use it for this purpose.  From ksh the syntax is 3&gt;file.  You 
can also do 3&gt;&amp;1 to see it real time during the run if you really want.
&nbsp;
You can make HardFeed send the ftp co-process some extra commands after the
connection is established with -x.  
&nbsp;
HardFeed gets a directory listing by sending a <span style="color: #000099; font-weight: bold;">\&quot;</span>ls .<span style="color: #000099; font-weight: bold;">\&quot;</span> command to the server.
Some servers will list dot files with this while others won't.  You can use the
-l option to change the command if your server needs a different one to do want
you want. -l <span style="color: #000099; font-weight: bold;">\&quot;</span>ls -al<span style="color: #000099; font-weight: bold;">\&quot;</span> is one example that I got to work with unix.
&nbsp;
For a microsoft ftp server, I had some luck with:
 -l <span style="color: #000099; font-weight: bold;">\&quot;</span>ls -la<span style="color: #000099; font-weight: bold;">\&quot;</span> -x <span style="color: #000099; font-weight: bold;">\&quot;</span>quote site dirstyle<span style="color: #000099; font-weight: bold;">\&quot;</span>
Note that everything is transferred in binary mode.  -x ascii will switch
everything to ascii mode.  HardFeed supports embedded spaces in filenames.  User
names may be long and contain slashes. All of this may make it somewhat usable 
with microsoft ftp servers.&quot;</span>
&nbsp;
&nbsp;
<span style="color: #007800;">IFS</span>=<span style="color: #ff0000;">&quot;&quot;</span> 
&nbsp;
<span style="color: #666666; font-style: italic;">#</span>
<span style="color: #666666; font-style: italic;">#  If the password is coming in via the environment, save it in</span>
<span style="color: #666666; font-style: italic;">#  a local variable and then clobber the environment variable</span>
&nbsp;
<span style="color: #7a0874; font-weight: bold;">unset</span> PASSWORD
<span style="color: #000000; font-weight: bold;">if</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span><span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #660033;">-n</span> <span style="color: #007800;">$HARDFEED_P</span> <span style="color: #7a0874; font-weight: bold;">&#93;</span><span style="color: #7a0874; font-weight: bold;">&#93;</span> ; <span style="color: #000000; font-weight: bold;">then</span>
	<span style="color: #007800;">PASSWORD</span>=<span style="color: #ff0000;">&quot;<span style="color: #007800;">$HARDFEED</span>-P&quot;</span>
	<span style="color: #007800;">HARDFEED_P</span>=<span style="color: #ff0000;">'********'</span>
<span style="color: #000000; font-weight: bold;">fi</span>
&nbsp;
&nbsp;
<span style="color: #666666; font-style: italic;">#</span>
<span style="color: #666666; font-style: italic;">#  Parse Command Line</span>
<span style="color: #666666; font-style: italic;">#</span>
<span style="color: #000000; font-weight: bold;">set</span> <span style="color: #660033;">-A</span> OPT_CMDS_LIST
<span style="color: #007800;">OPT_DIRCMD</span>=<span style="color: #ff0000;">&quot;ls .&quot;</span>
<span style="color: #007800;">OPT_VERBOSE</span>=<span style="color: #000000;">0</span>
<span style="color: #007800;">OPT_SYMLINKS</span>=<span style="color: #000000;">0</span>
<span style="color: #007800;">OPT_DIRECTORIES</span>=<span style="color: #000000;">0</span>
<span style="color: #007800;">OPT_RECURS</span>=<span style="color: #000000;">0</span>
<span style="color: #007800;">OPT_FRESHEN</span>=<span style="color: #000000;">0</span>
<span style="color: #007800;">OPT_MODE</span>=<span style="color: #000000;">0</span>
<span style="color: #007800;">OPT_PASSWORDFILE</span>=<span style="color: #ff0000;">&quot;&quot;</span>
<span style="color: #007800;">OPT_CMDS</span>=<span style="color: #000000;">0</span>
<span style="color: #007800;">error</span>=<span style="color: #000000;">0</span>
<span style="color: #000000; font-weight: bold;">while</span> <span style="color: #7a0874; font-weight: bold;">getopts</span> :vsdrfmhp:x:l:  o ; <span style="color: #000000; font-weight: bold;">do</span>
	<span style="color: #000000; font-weight: bold;">case</span> <span style="color: #007800;">$o</span> <span style="color: #000000; font-weight: bold;">in</span>
	v<span style="color: #7a0874; font-weight: bold;">&#41;</span>	<span style="color: #007800;">OPT_VERBOSE</span>=<span style="color: #000000;">1</span>
		<span style="color: #000000; font-weight: bold;">;;</span>
        s<span style="color: #7a0874; font-weight: bold;">&#41;</span>      <span style="color: #007800;">OPT_SYMLINKS</span>=<span style="color: #000000;">1</span>
		<span style="color: #000000; font-weight: bold;">;;</span>
        d<span style="color: #7a0874; font-weight: bold;">&#41;</span>      <span style="color: #007800;">OPT_DIRECTORIES</span>=<span style="color: #000000;">1</span>
                <span style="color: #000000; font-weight: bold;">;;</span>
	r<span style="color: #7a0874; font-weight: bold;">&#41;</span>      <span style="color: #007800;">OPT_RECURS</span>=<span style="color: #000000;">1</span>
		<span style="color: #000000; font-weight: bold;">;;</span>
	f<span style="color: #7a0874; font-weight: bold;">&#41;</span>	<span style="color: #007800;">OPT_FRESHEN</span>=<span style="color: #000000;">1</span>
		<span style="color: #000000; font-weight: bold;">;;</span>
	m<span style="color: #7a0874; font-weight: bold;">&#41;</span>	<span style="color: #007800;">OPT_MODE</span>=<span style="color: #000000;">1</span>
		<span style="color: #000000; font-weight: bold;">;;</span>
	h<span style="color: #7a0874; font-weight: bold;">&#41;</span>	<span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;<span style="color: #007800;">$DOCUMENTATION</span>&quot;</span>
		<span style="color: #7a0874; font-weight: bold;">exit</span> <span style="color: #000000;">0</span>
		<span style="color: #000000; font-weight: bold;">;;</span>
	p<span style="color: #7a0874; font-weight: bold;">&#41;</span>	<span style="color: #007800;">OPT_PASSWORDFILE</span>=<span style="color: #007800;">$OPTARG</span>
		<span style="color: #000000; font-weight: bold;">if</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span><span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #000000; font-weight: bold;">!</span> <span style="color: #660033;">-f</span> <span style="color: #007800;">$OPT_PASSWORDFILE</span> <span style="color: #7a0874; font-weight: bold;">&#93;</span><span style="color: #7a0874; font-weight: bold;">&#93;</span> ; <span style="color: #000000; font-weight: bold;">then</span>
			<span style="color: #7a0874; font-weight: bold;">echo</span> error <span style="color: #007800;">$OPT_PASSWORDFILE</span> is not a <span style="color: #c20cb9; font-weight: bold;">file</span>
			<span style="color: #007800;">error</span>=<span style="color: #000000;">1</span>
		<span style="color: #000000; font-weight: bold;">fi</span>
		<span style="color: #000000; font-weight: bold;">;;</span>
	x<span style="color: #7a0874; font-weight: bold;">&#41;</span>	OPT_CMDS_LIST<span style="color: #7a0874; font-weight: bold;">&#91;</span>OPT_CMDS<span style="color: #7a0874; font-weight: bold;">&#93;</span>=<span style="color: #ff0000;">&quot;<span style="color: #007800;">$OPTARG</span>&quot;</span>
		<span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #007800;">OPT_CMDS</span>=OPT_CMDS+<span style="color: #000000;">1</span><span style="color: #7a0874; font-weight: bold;">&#41;</span><span style="color: #7a0874; font-weight: bold;">&#41;</span>
		<span style="color: #000000; font-weight: bold;">;;</span>
	l<span style="color: #7a0874; font-weight: bold;">&#41;</span>	<span style="color: #007800;">OPT_DIRCMD</span>=<span style="color: #ff0000;">&quot;<span style="color: #007800;">$OPTARG</span>&quot;</span>
		<span style="color: #000000; font-weight: bold;">;;</span>
	?<span style="color: #7a0874; font-weight: bold;">&#41;</span>      print error argument <span style="color: #007800;">$OPTARG</span> is illegal
		<span style="color: #007800;">error</span>=<span style="color: #000000;">1</span>
		<span style="color: #000000; font-weight: bold;">;;</span>
	<span style="color: #000000; font-weight: bold;">esac</span>
<span style="color: #000000; font-weight: bold;">done</span>
<span style="color: #7a0874; font-weight: bold;">shift</span> OPTIND-<span style="color: #000000;">1</span>
<span style="color: #000000; font-weight: bold;">if</span> <span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #7a0874; font-weight: bold;">&#40;</span>error<span style="color: #7a0874; font-weight: bold;">&#41;</span><span style="color: #7a0874; font-weight: bold;">&#41;</span> ; <span style="color: #000000; font-weight: bold;">then</span>
	<span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;<span style="color: #007800;">$USAGE</span>&quot;</span>
	<span style="color: #7a0874; font-weight: bold;">exit</span> <span style="color: #000000;">1</span>
<span style="color: #000000; font-weight: bold;">fi</span>
<span style="color: #000000; font-weight: bold;">if</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span><span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #007800;">$#</span> <span style="color: #660033;">-ne</span> <span style="color: #000000;">2</span> <span style="color: #000000; font-weight: bold;">&amp;&amp;</span> <span style="color: #007800;">$#</span> <span style="color: #660033;">-ne</span> <span style="color: #000000;">3</span> <span style="color: #7a0874; font-weight: bold;">&#93;</span><span style="color: #7a0874; font-weight: bold;">&#93;</span> ; <span style="color: #000000; font-weight: bold;">then</span>
	<span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;<span style="color: #007800;">$USAGE</span>&quot;</span>
	<span style="color: #7a0874; font-weight: bold;">exit</span> <span style="color: #000000;">1</span>
<span style="color: #000000; font-weight: bold;">fi</span>
<span style="color: #007800;">SYSTEM</span>=<span style="color: #007800;">$1</span>
<span style="color: #007800;">USER</span>=<span style="color: #007800;">$2</span>
<span style="color: #007800;">DIRECTORY</span>=<span style="color: #007800;">$3</span>
<span style="color: #7a0874; font-weight: bold;">&#91;</span><span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #660033;">-z</span> <span style="color: #007800;">$DIRECTORY</span> <span style="color: #7a0874; font-weight: bold;">&#93;</span><span style="color: #7a0874; font-weight: bold;">&#93;</span> <span style="color: #000000; font-weight: bold;">&amp;&amp;</span> <span style="color: #007800;">DIRECTORY</span>=.
&nbsp;
<span style="color: #666666; font-style: italic;">#</span>
<span style="color: #666666; font-style: italic;">#  Read password file if one is supplied</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">if</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span><span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #660033;">-n</span> <span style="color: #007800;">$OPT_PASSWORDFILE</span> <span style="color: #7a0874; font-weight: bold;">&#93;</span><span style="color: #7a0874; font-weight: bold;">&#93;</span> ; <span style="color: #000000; font-weight: bold;">then</span>
	<span style="color: #c20cb9; font-weight: bold;">read</span> PASSWORD <span style="color: #000000; font-weight: bold;">&lt;</span> <span style="color: #007800;">$OPT_PASSWORDFILE</span>
<span style="color: #000000; font-weight: bold;">fi</span>
&nbsp;
&nbsp;
<span style="color: #666666; font-style: italic;">#</span>
<span style="color: #666666; font-style: italic;">#  Request password if it didn't come in via env or file</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">if</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span><span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #660033;">-z</span> <span style="color: #007800;">$PASSWORD</span> <span style="color: #7a0874; font-weight: bold;">&#93;</span><span style="color: #7a0874; font-weight: bold;">&#93;</span> ; <span style="color: #000000; font-weight: bold;">then</span>
	print <span style="color: #660033;">-n</span> password -
	<span style="color: #c20cb9; font-weight: bold;">stty</span> <span style="color: #660033;">-echo</span>
	<span style="color: #c20cb9; font-weight: bold;">read</span> PASSWORD
	<span style="color: #7a0874; font-weight: bold;">echo</span>
	<span style="color: #c20cb9; font-weight: bold;">stty</span> <span style="color: #7a0874; font-weight: bold;">echo</span>
<span style="color: #000000; font-weight: bold;">fi</span>
&nbsp;
<span style="color: #666666; font-style: italic;">#</span>
<span style="color: #666666; font-style: italic;">#  FD 3 will be the transcript of the ftp co-process.  If the user</span>
<span style="color: #666666; font-style: italic;">#  supplied a file for this, we will use that.  Otherwise it will go</span>
<span style="color: #666666; font-style: italic;">#  to a nameless file in /tmp</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">if</span> print <span style="color: #660033;">-u3</span> <span style="color: #ff0000;">&quot; Transcript of the ftp co-process for HardFeed&quot;</span> <span style="color: #000000;">2</span><span style="color: #000000; font-weight: bold;">&gt;/</span>dev<span style="color: #000000; font-weight: bold;">/</span>null ; <span style="color: #000000; font-weight: bold;">then</span>
	<span style="color: #007800;">LOGFILE</span>=<span style="color: #ff0000;">&quot;&quot;</span>
<span style="color: #000000; font-weight: bold;">else</span>
	<span style="color: #007800;">LOGFILE</span>=<span style="color: #000000; font-weight: bold;">/</span>tmp<span style="color: #000000; font-weight: bold;">/</span>HardFeed.log.<span style="color: #007800;">$$</span>
	<span style="color: #7a0874; font-weight: bold;">exec</span> <span style="color: #000000;">3</span><span style="color: #000000; font-weight: bold;">&gt;</span><span style="color: #007800;">$LOGFILE</span>
	<span style="color: #c20cb9; font-weight: bold;">rm</span> <span style="color: #007800;">$LOGFILE</span>
<span style="color: #000000; font-weight: bold;">fi</span>
&nbsp;
<span style="color: #666666; font-style: italic;">#</span>
<span style="color: #666666; font-style: italic;">#  Max time to wait for arrivial of file.  This is a long time.  During</span>
<span style="color: #666666; font-style: italic;">#  an interactive run, the user can use SIGINT if it seems to be taking</span>
<span style="color: #666666; font-style: italic;">#  too long.  This max is intended to assure that a cron job will not</span>
<span style="color: #666666; font-style: italic;">#  hang forever.</span>
&nbsp;
<span style="color: #007800;">OPT_MAXWAIT</span>=<span style="color: #000000;">15</span>
<span style="color: #007800;">TIMEOUT</span>=<span style="color: #000000; font-weight: bold;">/</span>tmp<span style="color: #000000; font-weight: bold;">/</span>HardFeed.timeout.<span style="color: #007800;">$$</span>
&nbsp;
<span style="color: #666666; font-style: italic;">#</span>
<span style="color: #666666; font-style: italic;">#  Various other initializations</span>
&nbsp;
<span style="color: #007800;">LEV</span>=<span style="color: #000000;">0</span>
<span style="color: #c20cb9; font-weight: bold;">date</span> <span style="color: #ff0000;">&quot;+%Y %m&quot;</span> <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #007800;">IFS</span>=<span style="color: #ff0000;">&quot; &quot;</span> <span style="color: #c20cb9; font-weight: bold;">read</span> THISYEAR THISMONTH
<span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #007800;">LASTYEAR</span>=THISYEAR-<span style="color: #000000;">1</span><span style="color: #7a0874; font-weight: bold;">&#41;</span><span style="color: #7a0874; font-weight: bold;">&#41;</span>
<span style="color: #007800;">STARTPATH</span>=$<span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #7a0874; font-weight: bold;">pwd</span><span style="color: #7a0874; font-weight: bold;">&#41;</span>
<span style="color: #000000; font-weight: bold;">set</span> <span style="color: #660033;">-A</span> DIR_FILE_NAME
<span style="color: #000000; font-weight: bold;">set</span> <span style="color: #660033;">-A</span> DIR_LINE_NUM
&nbsp;
<span style="color: #666666; font-style: italic;">#</span>
<span style="color: #666666; font-style: italic;">#  Function to convert month to numeric</span>
&nbsp;
conv_month<span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #7a0874; font-weight: bold;">&#41;</span> <span style="color: #7a0874; font-weight: bold;">&#123;</span>
	<span style="color: #7a0874; font-weight: bold;">typeset</span> <span style="color: #660033;">-l</span> month
	<span style="color: #007800;">month</span>=<span style="color: #007800;">$1</span>
	<span style="color: #000000; font-weight: bold;">case</span> <span style="color: #007800;">$month</span> <span style="color: #000000; font-weight: bold;">in</span>
	jan<span style="color: #7a0874; font-weight: bold;">&#41;</span>	<span style="color: #007800;">nmonth</span>=<span style="color: #000000;">1</span>  <span style="color: #000000; font-weight: bold;">;;</span>
	feb<span style="color: #7a0874; font-weight: bold;">&#41;</span>	<span style="color: #007800;">nmonth</span>=<span style="color: #000000;">2</span>  <span style="color: #000000; font-weight: bold;">;;</span>
	mar<span style="color: #7a0874; font-weight: bold;">&#41;</span>	<span style="color: #007800;">nmonth</span>=<span style="color: #000000;">3</span>  <span style="color: #000000; font-weight: bold;">;;</span>
	apr<span style="color: #7a0874; font-weight: bold;">&#41;</span>	<span style="color: #007800;">nmonth</span>=<span style="color: #000000;">4</span>  <span style="color: #000000; font-weight: bold;">;;</span>
	may<span style="color: #7a0874; font-weight: bold;">&#41;</span>	<span style="color: #007800;">nmonth</span>=<span style="color: #000000;">5</span>  <span style="color: #000000; font-weight: bold;">;;</span>
	jun<span style="color: #7a0874; font-weight: bold;">&#41;</span>	<span style="color: #007800;">nmonth</span>=<span style="color: #000000;">6</span>  <span style="color: #000000; font-weight: bold;">;;</span>
	jul<span style="color: #7a0874; font-weight: bold;">&#41;</span>	<span style="color: #007800;">nmonth</span>=<span style="color: #000000;">7</span>  <span style="color: #000000; font-weight: bold;">;;</span>
	aug<span style="color: #7a0874; font-weight: bold;">&#41;</span>	<span style="color: #007800;">nmonth</span>=<span style="color: #000000;">8</span>  <span style="color: #000000; font-weight: bold;">;;</span>
	sep<span style="color: #7a0874; font-weight: bold;">&#41;</span>	<span style="color: #007800;">nmonth</span>=<span style="color: #000000;">9</span>  <span style="color: #000000; font-weight: bold;">;;</span>
	oct<span style="color: #7a0874; font-weight: bold;">&#41;</span>	<span style="color: #007800;">nmonth</span>=<span style="color: #000000;">10</span> <span style="color: #000000; font-weight: bold;">;;</span>
	nov<span style="color: #7a0874; font-weight: bold;">&#41;</span>	<span style="color: #007800;">nmonth</span>=<span style="color: #000000;">11</span> <span style="color: #000000; font-weight: bold;">;;</span>
	dec<span style="color: #7a0874; font-weight: bold;">&#41;</span>	<span style="color: #007800;">nmonth</span>=<span style="color: #000000;">12</span> <span style="color: #000000; font-weight: bold;">;;</span>
	<span style="color: #000000; font-weight: bold;">*</span><span style="color: #7a0874; font-weight: bold;">&#41;</span>	<span style="color: #007800;">nmonth</span>=<span style="color: #000000;">0</span>  <span style="color: #000000; font-weight: bold;">;;</span>
	<span style="color: #000000; font-weight: bold;">esac</span>
	<span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #007800;">$nmonth</span>
	<span style="color: #7a0874; font-weight: bold;">return</span> $<span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #000000; font-weight: bold;">!</span>nmonth<span style="color: #7a0874; font-weight: bold;">&#41;</span><span style="color: #7a0874; font-weight: bold;">&#41;</span>
<span style="color: #7a0874; font-weight: bold;">&#125;</span>
&nbsp;
&nbsp;
<span style="color: #666666; font-style: italic;">#</span>
<span style="color: #666666; font-style: italic;"># Function to determine if a file system object exists</span>
<span style="color: #666666; font-style: italic;">#</span>
<span style="color: #666666; font-style: italic;"># neither -a nor -e is really portable  8(</span>
&nbsp;
exists<span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #7a0874; font-weight: bold;">&#41;</span> <span style="color: #7a0874; font-weight: bold;">&#123;</span>
	<span style="color: #7a0874; font-weight: bold;">&#91;</span><span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #660033;">-f</span> <span style="color: #007800;">$1</span> <span style="color: #000000; font-weight: bold;">||</span> <span style="color: #660033;">-d</span> <span style="color: #007800;">$1</span> <span style="color: #000000; font-weight: bold;">||</span> <span style="color: #660033;">-L</span> <span style="color: #007800;">$1</span> <span style="color: #000000; font-weight: bold;">||</span> <span style="color: #660033;">-p</span> <span style="color: #007800;">$1</span> <span style="color: #000000; font-weight: bold;">||</span> <span style="color: #660033;">-S</span> <span style="color: #007800;">$1</span> <span style="color: #000000; font-weight: bold;">||</span> <span style="color: #660033;">-b</span> <span style="color: #007800;">$1</span> <span style="color: #000000; font-weight: bold;">||</span> <span style="color: #660033;">-c</span> <span style="color: #007800;">$1</span> <span style="color: #7a0874; font-weight: bold;">&#93;</span><span style="color: #7a0874; font-weight: bold;">&#93;</span>
	<span style="color: #7a0874; font-weight: bold;">return</span> <span style="color: #007800;">$?</span>
	<span style="color: #7a0874; font-weight: bold;">&#125;</span>
&nbsp;
&nbsp;
<span style="color: #666666; font-style: italic;">#</span>
<span style="color: #666666; font-style: italic;"># Function to wait for a file to arrive</span>
&nbsp;
waitfor<span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #7a0874; font-weight: bold;">&#41;</span> <span style="color: #7a0874; font-weight: bold;">&#123;</span>
	<span style="color: #007800;">wanted</span>=<span style="color: #007800;">$1</span>
	<span style="color: #000000; font-weight: bold;">if</span> <span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #7a0874; font-weight: bold;">&#40;</span>OPT_MAXWAIT<span style="color: #7a0874; font-weight: bold;">&#41;</span><span style="color: #7a0874; font-weight: bold;">&#41;</span> ; <span style="color: #000000; font-weight: bold;">then</span>
		<span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #007800;">GIVEUP</span>=SECONDS+OPT_MAXWAIT<span style="color: #7a0874; font-weight: bold;">&#41;</span><span style="color: #7a0874; font-weight: bold;">&#41;</span>
	<span style="color: #000000; font-weight: bold;">else</span>
		<span style="color: #007800;">GIVEUP</span>=<span style="color: #ff0000;">&quot;-1&quot;</span>
	<span style="color: #000000; font-weight: bold;">fi</span>
&nbsp;
	<span style="color: #000000; font-weight: bold;">while</span> 	<span style="color: #7a0874; font-weight: bold;">&#91;</span><span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #000000; font-weight: bold;">!</span> <span style="color: #660033;">-f</span> <span style="color: #007800;">$wanted</span> <span style="color: #000000; font-weight: bold;">&amp;&amp;</span> <span style="color: #007800;">$SECONDS</span> <span style="color: #660033;">-lt</span> <span style="color: #007800;">$GIVEUP</span> <span style="color: #7a0874; font-weight: bold;">&#93;</span><span style="color: #7a0874; font-weight: bold;">&#93;</span> ; <span style="color: #000000; font-weight: bold;">do</span>
		<span style="color: #c20cb9; font-weight: bold;">sleep</span> <span style="color: #000000;">1</span>
	<span style="color: #000000; font-weight: bold;">done</span>
	<span style="color: #000000; font-weight: bold;">if</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span><span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #000000; font-weight: bold;">!</span> <span style="color: #660033;">-f</span> <span style="color: #007800;">$wanted</span> <span style="color: #7a0874; font-weight: bold;">&#93;</span><span style="color: #7a0874; font-weight: bold;">&#93;</span> ; <span style="color: #000000; font-weight: bold;">then</span>
		<span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;FATAL ERROR:&quot;</span> timed out waiting <span style="color: #000000; font-weight: bold;">for</span>:  <span style="color: #000000;">2</span><span style="color: #000000; font-weight: bold;">&gt;&amp;</span><span style="color: #000000;">1</span>
		<span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;            &quot;</span> <span style="color: #ff0000;">&quot;<span style="color: #007800;">$wanted</span>&quot;</span>               <span style="color: #000000;">2</span><span style="color: #000000; font-weight: bold;">&gt;&amp;</span><span style="color: #000000;">1</span>
		<span style="color: #7a0874; font-weight: bold;">echo</span> 
		print <span style="color: #660033;">-p</span> bye  <span style="color: #000000;">2</span><span style="color: #000000; font-weight: bold;">&gt;/</span>dev<span style="color: #000000; font-weight: bold;">/</span>null
		<span style="color: #7a0874; font-weight: bold;">exit</span> <span style="color: #000000;">2</span>
	<span style="color: #000000; font-weight: bold;">fi</span>
	<span style="color: #7a0874; font-weight: bold;">return</span> <span style="color: #000000;">0</span>
<span style="color: #7a0874; font-weight: bold;">&#125;</span>
<span style="color: #666666; font-style: italic;">#</span>
<span style="color: #666666; font-style: italic;">#  Function to decode an &quot;ls -l&quot; line.</span>
&nbsp;
lsdcode<span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #7a0874; font-weight: bold;">&#41;</span> <span style="color: #7a0874; font-weight: bold;">&#123;</span>
&nbsp;
	<span style="color: #7a0874; font-weight: bold;">typeset</span> <span style="color: #660033;">-Z2</span> nmonth day
	<span style="color: #7a0874; font-weight: bold;">typeset</span> <span style="color: #660033;">-i8</span> octal
&nbsp;
	<span style="color: #666666; font-style: italic;">#</span>
	<span style="color: #666666; font-style: italic;">#  get the line, get the first character, split line into words</span>
&nbsp;
	<span style="color: #007800;">line</span>=<span style="color: #ff0000;">&quot;$1&quot;</span>
	<span style="color: #007800;">char1</span>=<span style="color: #800000;">${line%%${line#?}</span><span style="color: #7a0874; font-weight: bold;">&#125;</span>
	<span style="color: #007800;">IFS</span>=<span style="color: #ff0000;">&quot; &quot;</span>
	<span style="color: #000000; font-weight: bold;">set</span> <span style="color: #660033;">-A</span>  things <span style="color: #660033;">--</span> <span style="color: #007800;">$line</span>
	<span style="color: #007800;">IFS</span>=<span style="color: #ff0000;">&quot;&quot;</span>
&nbsp;
	<span style="color: #666666; font-style: italic;">#</span>
	<span style="color: #666666; font-style: italic;">#  We may have a &quot;total&quot; line which needs to be ignored</span>
&nbsp;
	<span style="color: #000000; font-weight: bold;">if</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span><span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #800000;">${things[0]}</span> = total <span style="color: #7a0874; font-weight: bold;">&#93;</span><span style="color: #7a0874; font-weight: bold;">&#93;</span> ; <span style="color: #000000; font-weight: bold;">then</span>
		<span style="color: #000000; font-weight: bold;">set</span> <span style="color: #660033;">-A</span>  lsdc <span style="color: #660033;">--</span>  skip 000 000000000000 x x
		<span style="color: #7a0874; font-weight: bold;">return</span> <span style="color: #000000;">0</span>
	<span style="color: #000000; font-weight: bold;">fi</span>
&nbsp;
	<span style="color: #666666; font-style: italic;">#</span>
	<span style="color: #666666; font-style: italic;">#</span>
	<span style="color: #007800;">parser</span>=<span style="color: #000000;">1</span>
	<span style="color: #007800;">month</span>=<span style="color: #800000;">${things[5]}</span>
	<span style="color: #007800;">xmonth</span>=$<span style="color: #7a0874; font-weight: bold;">&#40;</span>conv_month <span style="color: #007800;">$month</span><span style="color: #7a0874; font-weight: bold;">&#41;</span>
	<span style="color: #000000; font-weight: bold;">if</span>  conv_month <span style="color: #007800;">$month</span> <span style="color: #000000; font-weight: bold;">&gt;</span> <span style="color: #000000; font-weight: bold;">/</span>dev<span style="color: #000000; font-weight: bold;">/</span>null ; <span style="color: #000000; font-weight: bold;">then</span>
		<span style="color: #007800;">parser</span>=<span style="color: #000000;">1</span>
	<span style="color: #000000; font-weight: bold;">else</span>
		<span style="color: #007800;">parser</span>=<span style="color: #000000;">0</span>
	<span style="color: #000000; font-weight: bold;">fi</span>
&nbsp;
	<span style="color: #000000; font-weight: bold;">if</span> <span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #7a0874; font-weight: bold;">&#40;</span>parser<span style="color: #7a0874; font-weight: bold;">&#41;</span><span style="color: #7a0874; font-weight: bold;">&#41;</span>; <span style="color: #000000; font-weight: bold;">then</span>
		<span style="color: #666666; font-style: italic;">#</span>
		<span style="color: #666666; font-style: italic;"># Strict Left to Right Parse Routine </span>
		<span style="color: #666666; font-style: italic;">#</span>
		<span style="color: #666666; font-style: italic;"># Break out the fields that we want.  This technique requires</span>
		<span style="color: #666666; font-style: italic;"># that the user, group, and size fields never run together and</span>
		<span style="color: #666666; font-style: italic;"># so they must have at least one space between them.  But it </span>
		<span style="color: #666666; font-style: italic;"># allows some limited support of filenames with embedded spaces.</span>
&nbsp;
		<span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;<span style="color: #007800;">$line</span>&quot;</span> <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #007800;">IFS</span>=<span style="color: #ff0000;">&quot; &quot;</span> <span style="color: #c20cb9; font-weight: bold;">read</span> permstring junk junk junk junk \
						month day swing rawname
		<span style="color: #000000; font-weight: bold;">if</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span><span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #007800;">$char1</span> = l <span style="color: #7a0874; font-weight: bold;">&#93;</span><span style="color: #7a0874; font-weight: bold;">&#93;</span> ; <span style="color: #000000; font-weight: bold;">then</span>
			<span style="color: #007800;">link</span>=<span style="color: #800000;">${rawname#*-\&gt; }</span>
			<span style="color: #007800;">name</span>=<span style="color: #800000;">${rawname% -\&gt;*}</span>
		<span style="color: #000000; font-weight: bold;">else</span>
			<span style="color: #007800;">name</span>=<span style="color: #ff0000;">&quot;<span style="color: #007800;">$rawname</span>&quot;</span>
			<span style="color: #007800;">link</span>=<span style="color: #ff0000;">&quot;&quot;</span>
		<span style="color: #000000; font-weight: bold;">fi</span>
	<span style="color: #000000; font-weight: bold;">else</span>
		<span style="color: #666666; font-style: italic;">#</span>
		<span style="color: #666666; font-style: italic;"># Outside to Inside Parse Routine </span>
		<span style="color: #666666; font-style: italic;">#</span>
		<span style="color: #666666; font-style: italic;"># Break out the fields that we want.  This technique requires </span>
		<span style="color: #666666; font-style: italic;"># that no white space exist in the filename.  But the user, </span>
		<span style="color: #666666; font-style: italic;"># group, and size  fields may sometimes run together without </span>
		<span style="color: #666666; font-style: italic;"># causing a problem.</span>
&nbsp;
		<span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;WARNING:&quot;</span> badly formatted line <span style="color: #000000; font-weight: bold;">in</span> directory listing <span style="color: #000000; font-weight: bold;">for</span>:    <span style="color: #000000; font-weight: bold;">&gt;&amp;</span><span style="color: #000000;">2</span>
		<span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;        &quot;</span> <span style="color: #ff0000;">&quot;<span style="color: #007800;">${line}</span>&quot;</span>                                         <span style="color: #000000; font-weight: bold;">&gt;&amp;</span><span style="color: #000000;">2</span>
		<span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;        &quot;</span> attempting outside-to-inside scan                 <span style="color: #000000; font-weight: bold;">&gt;&amp;</span><span style="color: #000000;">2</span>
		<span style="color: #7a0874; font-weight: bold;">echo</span>                                                              <span style="color: #000000; font-weight: bold;">&gt;&amp;</span><span style="color: #000000;">2</span>
&nbsp;
		<span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #007800;">pname</span>=<span style="color: #800000;">${#things[*]}</span>-<span style="color: #000000;">1</span><span style="color: #7a0874; font-weight: bold;">&#41;</span><span style="color: #7a0874; font-weight: bold;">&#41;</span>
		<span style="color: #000000; font-weight: bold;">if</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span><span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #007800;">$char1</span> = l <span style="color: #7a0874; font-weight: bold;">&#93;</span><span style="color: #7a0874; font-weight: bold;">&#93;</span> ; <span style="color: #000000; font-weight: bold;">then</span>
			<span style="color: #007800;">link</span>=<span style="color: #800000;">${things[pname]}</span>
			<span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #007800;">pname</span>=pname-<span style="color: #000000;">2</span><span style="color: #7a0874; font-weight: bold;">&#41;</span><span style="color: #7a0874; font-weight: bold;">&#41;</span>
		<span style="color: #000000; font-weight: bold;">else</span>
			<span style="color: #007800;">link</span>=
		<span style="color: #000000; font-weight: bold;">fi</span>
		<span style="color: #007800;">permstring</span>=<span style="color: #800000;">${things[0]}</span>
		<span style="color: #007800;">name</span>=<span style="color: #800000;">${things[pname]}</span>
		<span style="color: #007800;">month</span>=<span style="color: #800000;">${things[pname-3]}</span>
		<span style="color: #007800;">day</span>=<span style="color: #800000;">${things[pname-2]}</span>
		<span style="color: #007800;">swing</span>=<span style="color: #800000;">${things[pname-1]}</span>
		<span style="color: #000000; font-weight: bold;">if</span>  conv_month <span style="color: #007800;">$month</span> <span style="color: #000000; font-weight: bold;">&gt;</span> <span style="color: #000000; font-weight: bold;">/</span>dev<span style="color: #000000; font-weight: bold;">/</span>null ; <span style="color: #000000; font-weight: bold;">then</span>
			:
		<span style="color: #000000; font-weight: bold;">else</span>
			<span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;ERROR: &quot;</span> outside-to-inside scan has also failed <span style="color: #000000; font-weight: bold;">&gt;&amp;</span><span style="color: #000000;">2</span>
			<span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;       &quot;</span> giving up on:                          <span style="color: #000000; font-weight: bold;">&gt;&amp;</span><span style="color: #000000;">2</span>
			<span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;       &quot;</span> <span style="color: #ff0000;">&quot;<span style="color: #007800;">$line</span>&quot;</span>                                <span style="color: #000000; font-weight: bold;">&gt;&amp;</span><span style="color: #000000;">2</span>
			<span style="color: #7a0874; font-weight: bold;">echo</span>                                                  <span style="color: #000000; font-weight: bold;">&gt;&amp;</span><span style="color: #000000;">2</span>
			<span style="color: #000000; font-weight: bold;">set</span> <span style="color: #660033;">-A</span>  lsdc <span style="color: #660033;">--</span>  skip 000 000000000000 x x
			<span style="color: #7a0874; font-weight: bold;">return</span> <span style="color: #000000;">0</span>
		<span style="color: #000000; font-weight: bold;">fi</span>
	<span style="color: #000000; font-weight: bold;">fi</span>
&nbsp;
&nbsp;
	<span style="color: #666666; font-style: italic;">#</span>
	<span style="color: #666666; font-style: italic;">#  Ignore . and ..</span>
&nbsp;
	<span style="color: #000000; font-weight: bold;">if</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span><span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #007800;">$name</span> = . <span style="color: #000000; font-weight: bold;">||</span> <span style="color: #007800;">$name</span> = .. <span style="color: #7a0874; font-weight: bold;">&#93;</span><span style="color: #7a0874; font-weight: bold;">&#93;</span> ; <span style="color: #000000; font-weight: bold;">then</span>
			<span style="color: #000000; font-weight: bold;">set</span> <span style="color: #660033;">-A</span>  lsdc <span style="color: #660033;">--</span>  skip 000 000000000000 x x
			<span style="color: #7a0874; font-weight: bold;">return</span> <span style="color: #000000;">0</span>
	<span style="color: #000000; font-weight: bold;">fi</span>
&nbsp;
	<span style="color: #666666; font-style: italic;">#</span>
	<span style="color: #666666; font-style: italic;">#  decode permissions  (the permission string is first word</span>
&nbsp;
	<span style="color: #000000; font-weight: bold;">set</span> <span style="color: #660033;">-A</span> perms <span style="color: #660033;">--</span> $<span style="color: #7a0874; font-weight: bold;">&#40;</span>print <span style="color: #660033;">--</span> <span style="color: #800000;">${permstring#?}</span> <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">sed</span> <span style="color: #ff0000;">'s/./&amp; /g'</span><span style="color: #7a0874; font-weight: bold;">&#41;</span>
	<span style="color: #007800;">extras</span>=<span style="color: #000000;">0</span>
	<span style="color: #7a0874; font-weight: bold;">&#91;</span><span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #800000;">${perms[2]}</span> = S <span style="color: #7a0874; font-weight: bold;">&#93;</span><span style="color: #7a0874; font-weight: bold;">&#93;</span> <span style="color: #000000; font-weight: bold;">&amp;&amp;</span> <span style="color: #7a0874; font-weight: bold;">&#123;</span> <span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #007800;">extras</span>=extras+<span style="color: #000000;">4000</span><span style="color: #7a0874; font-weight: bold;">&#41;</span><span style="color: #7a0874; font-weight: bold;">&#41;</span>; perms<span style="color: #7a0874; font-weight: bold;">&#91;</span><span style="color: #000000;">2</span><span style="color: #7a0874; font-weight: bold;">&#93;</span>=- ; <span style="color: #7a0874; font-weight: bold;">&#125;</span>
	<span style="color: #7a0874; font-weight: bold;">&#91;</span><span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #800000;">${perms[2]}</span> = s <span style="color: #7a0874; font-weight: bold;">&#93;</span><span style="color: #7a0874; font-weight: bold;">&#93;</span> <span style="color: #000000; font-weight: bold;">&amp;&amp;</span> <span style="color: #7a0874; font-weight: bold;">&#123;</span> <span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #007800;">extras</span>=extras+<span style="color: #000000;">4000</span><span style="color: #7a0874; font-weight: bold;">&#41;</span><span style="color: #7a0874; font-weight: bold;">&#41;</span>; perms<span style="color: #7a0874; font-weight: bold;">&#91;</span><span style="color: #000000;">2</span><span style="color: #7a0874; font-weight: bold;">&#93;</span>=x ; <span style="color: #7a0874; font-weight: bold;">&#125;</span>
	<span style="color: #7a0874; font-weight: bold;">&#91;</span><span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #800000;">${perms[5]}</span> = S <span style="color: #7a0874; font-weight: bold;">&#93;</span><span style="color: #7a0874; font-weight: bold;">&#93;</span> <span style="color: #000000; font-weight: bold;">&amp;&amp;</span> <span style="color: #7a0874; font-weight: bold;">&#123;</span> <span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #007800;">extras</span>=extras+<span style="color: #000000;">2000</span><span style="color: #7a0874; font-weight: bold;">&#41;</span><span style="color: #7a0874; font-weight: bold;">&#41;</span>; perms<span style="color: #7a0874; font-weight: bold;">&#91;</span><span style="color: #000000;">5</span><span style="color: #7a0874; font-weight: bold;">&#93;</span>=- ; <span style="color: #7a0874; font-weight: bold;">&#125;</span>
	<span style="color: #7a0874; font-weight: bold;">&#91;</span><span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #800000;">${perms[5]}</span> = s <span style="color: #7a0874; font-weight: bold;">&#93;</span><span style="color: #7a0874; font-weight: bold;">&#93;</span> <span style="color: #000000; font-weight: bold;">&amp;&amp;</span> <span style="color: #7a0874; font-weight: bold;">&#123;</span> <span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #007800;">extras</span>=extras+<span style="color: #000000;">2000</span><span style="color: #7a0874; font-weight: bold;">&#41;</span><span style="color: #7a0874; font-weight: bold;">&#41;</span>; perms<span style="color: #7a0874; font-weight: bold;">&#91;</span><span style="color: #000000;">5</span><span style="color: #7a0874; font-weight: bold;">&#93;</span>=x ; <span style="color: #7a0874; font-weight: bold;">&#125;</span>
	<span style="color: #7a0874; font-weight: bold;">&#91;</span><span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #800000;">${perms[8]}</span> = T <span style="color: #7a0874; font-weight: bold;">&#93;</span><span style="color: #7a0874; font-weight: bold;">&#93;</span> <span style="color: #000000; font-weight: bold;">&amp;&amp;</span> <span style="color: #7a0874; font-weight: bold;">&#123;</span> <span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #007800;">extras</span>=extras+<span style="color: #000000;">1000</span><span style="color: #7a0874; font-weight: bold;">&#41;</span><span style="color: #7a0874; font-weight: bold;">&#41;</span>; perms<span style="color: #7a0874; font-weight: bold;">&#91;</span><span style="color: #000000;">8</span><span style="color: #7a0874; font-weight: bold;">&#93;</span>=- ; <span style="color: #7a0874; font-weight: bold;">&#125;</span>
	<span style="color: #7a0874; font-weight: bold;">&#91;</span><span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #800000;">${perms[8]}</span> = t <span style="color: #7a0874; font-weight: bold;">&#93;</span><span style="color: #7a0874; font-weight: bold;">&#93;</span> <span style="color: #000000; font-weight: bold;">&amp;&amp;</span> <span style="color: #7a0874; font-weight: bold;">&#123;</span> <span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #007800;">extras</span>=extras+<span style="color: #000000;">1000</span><span style="color: #7a0874; font-weight: bold;">&#41;</span><span style="color: #7a0874; font-weight: bold;">&#41;</span>; perms<span style="color: #7a0874; font-weight: bold;">&#91;</span><span style="color: #000000;">8</span><span style="color: #7a0874; font-weight: bold;">&#93;</span>=x ; <span style="color: #7a0874; font-weight: bold;">&#125;</span>
&nbsp;
	<span style="color: #007800;">binary</span>=<span style="color: #000000;">2</span><span style="color: #666666; font-style: italic;">#$(print -- ${perms[@]} | sed 's/ //g;s/-/0/g;s/[^0]/1/g')</span>
	<span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #007800;">octal</span>=binary<span style="color: #7a0874; font-weight: bold;">&#41;</span><span style="color: #7a0874; font-weight: bold;">&#41;</span>
	<span style="color: #007800;">result</span>=$<span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #007800;">$octal</span><span style="color: #7a0874; font-weight: bold;">&#41;</span>
	<span style="color: #007800;">result</span>=<span style="color: #800000;">${result#??}</span>
	<span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #007800;">result</span>=result+extras<span style="color: #7a0874; font-weight: bold;">&#41;</span><span style="color: #7a0874; font-weight: bold;">&#41;</span>
&nbsp;
	<span style="color: #666666; font-style: italic;">#</span>
	<span style="color: #666666; font-style: italic;"># Decode date and time and convert it to yyyymmddhhmm</span>
&nbsp;
	<span style="color: #007800;">nmonth</span>=$<span style="color: #7a0874; font-weight: bold;">&#40;</span>conv_month <span style="color: #007800;">$month</span><span style="color: #7a0874; font-weight: bold;">&#41;</span>
	<span style="color: #000000; font-weight: bold;">if</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span><span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #007800;">$swing</span> = <span style="color: #000000; font-weight: bold;">*</span>:<span style="color: #000000; font-weight: bold;">*</span> <span style="color: #7a0874; font-weight: bold;">&#93;</span><span style="color: #7a0874; font-weight: bold;">&#93;</span> ; <span style="color: #000000; font-weight: bold;">then</span>
		<span style="color: #000000; font-weight: bold;">if</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span><span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #007800;">$nmonth</span> <span style="color: #000000; font-weight: bold;">&gt;</span> <span style="color: #007800;">$THISMONTH</span> <span style="color: #7a0874; font-weight: bold;">&#93;</span><span style="color: #7a0874; font-weight: bold;">&#93;</span> ; <span style="color: #000000; font-weight: bold;">then</span>
			<span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #007800;">year</span>=LASTYEAR<span style="color: #7a0874; font-weight: bold;">&#41;</span><span style="color: #7a0874; font-weight: bold;">&#41;</span>
		<span style="color: #000000; font-weight: bold;">else</span>
			<span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #007800;">year</span>=THISYEAR<span style="color: #7a0874; font-weight: bold;">&#41;</span><span style="color: #7a0874; font-weight: bold;">&#41;</span>
		<span style="color: #007800;">time1</span>=<span style="color: #800000;">${swing%???}</span>
		<span style="color: #007800;">time2</span>=<span style="color: #800000;">${swing#???}</span>
		<span style="color: #007800;">time</span>=<span style="color: #ff0000;">&quot;<span style="color: #007800;">${time1}</span><span style="color: #007800;">${time2}</span>&quot;</span>
		<span style="color: #000000; font-weight: bold;">fi</span>
        <span style="color: #000000; font-weight: bold;">else</span>
                <span style="color: #007800;">year</span>=<span style="color: #007800;">$swing</span>
		<span style="color: #007800;">time</span>=<span style="color: #ff0000;">&quot;0000&quot;</span>
        <span style="color: #000000; font-weight: bold;">fi</span>
&nbsp;
	<span style="color: #666666; font-style: italic;">#</span>
	<span style="color: #666666; font-style: italic;">#  Output the final record</span>
&nbsp;
	<span style="color: #000000; font-weight: bold;">set</span> <span style="color: #660033;">-A</span> lsdc <span style="color: #660033;">--</span> <span style="color: #800000;">${char1}</span> <span style="color: #800000;">${result}</span> <span style="color: #800000;">${year}</span><span style="color: #800000;">${nmonth}</span><span style="color: #800000;">${day}</span><span style="color: #800000;">${time}</span> <span style="color: #800000;">${name}</span> <span style="color: #800000;">${link}</span>
	<span style="color: #7a0874; font-weight: bold;">return</span>
<span style="color: #7a0874; font-weight: bold;">&#125;</span>
&nbsp;
&nbsp;
<span style="color: #666666; font-style: italic;">#</span>
<span style="color: #666666; font-style: italic;">#  Function to process a remote file</span>
<span style="color: #666666; font-style: italic;">#  We will not overwrite and existing file unless we in &quot;freshen&quot; mode.</span>
<span style="color: #666666; font-style: italic;">#  And unless we are in &quot;freshen&quot; mode, it is an error for a file to</span>
<span style="color: #666666; font-style: italic;">#  pre-exist.</span>
&nbsp;
process_remote_file<span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #7a0874; font-weight: bold;">&#41;</span> <span style="color: #7a0874; font-weight: bold;">&#123;</span>
	<span style="color: #007800;">VMESS</span>=<span style="color: #ff0000;">&quot;<span style="color: #007800;">${VMESS}</span> is a remote file that&quot;</span>
	<span style="color: #007800;">do_get</span>=<span style="color: #000000;">0</span>
	<span style="color: #000000; font-weight: bold;">if</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span><span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #660033;">-f</span> <span style="color: #007800;">$name</span> <span style="color: #7a0874; font-weight: bold;">&#93;</span><span style="color: #7a0874; font-weight: bold;">&#93;</span> ; <span style="color: #000000; font-weight: bold;">then</span>
		<span style="color: #007800;">VMESS</span>=<span style="color: #ff0000;">&quot;<span style="color: #007800;">${VMESS}</span> already exists&quot;</span>
		<span style="color: #000000; font-weight: bold;">if</span> <span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #7a0874; font-weight: bold;">&#40;</span>OPT_FRESHEN<span style="color: #7a0874; font-weight: bold;">&#41;</span><span style="color: #7a0874; font-weight: bold;">&#41;</span> ; <span style="color: #000000; font-weight: bold;">then</span>
			<span style="color: #007800;">line2</span>=$<span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #c20cb9; font-weight: bold;">ls</span> <span style="color: #660033;">-ld</span> <span style="color: #ff0000;">&quot;<span style="color: #007800;">$name</span>&quot;</span><span style="color: #7a0874; font-weight: bold;">&#41;</span>
			lsdcode <span style="color: #ff0000;">&quot;<span style="color: #007800;">$line2</span>&quot;</span> 
			<span style="color: #007800;">char12</span>=<span style="color: #800000;">${lsdc[0]}</span>
			<span style="color: #007800;">mode2</span>=<span style="color: #800000;">${lsdc[1]}</span>
			<span style="color: #007800;">datestamp2</span>=<span style="color: #800000;">${lsdc[2]}</span>
			<span style="color: #007800;">name2</span>=<span style="color: #800000;">${lsdc[3]}</span>
			<span style="color: #007800;">link2</span>=<span style="color: #800000;">${lsdc[4]}</span>
			<span style="color: #000000; font-weight: bold;">if</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span><span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #007800;">$datestamp</span> <span style="color: #000000; font-weight: bold;">&gt;</span> <span style="color: #007800;">$datestamp2</span> <span style="color: #7a0874; font-weight: bold;">&#93;</span><span style="color: #7a0874; font-weight: bold;">&#93;</span> ; <span style="color: #000000; font-weight: bold;">then</span>
				<span style="color: #007800;">VMESS</span>=<span style="color: #ff0000;">&quot;<span style="color: #007800;">${VMESS}</span> but is out-of-date and&quot;</span>
				<span style="color: #007800;">do_get</span>=<span style="color: #000000;">1</span>
			<span style="color: #000000; font-weight: bold;">else</span>
				<span style="color: #007800;">VMESS</span>=<span style="color: #ff0000;">&quot;<span style="color: #007800;">${VMESS}</span> and is current&quot;</span>
			<span style="color: #000000; font-weight: bold;">fi</span>
		<span style="color: #000000; font-weight: bold;">else</span>
			<span style="color: #007800;">VMESS</span>=<span style="color: #ff0000;">&quot;<span style="color: #007800;">${VMESS}</span> and cannot be retrieved&quot;</span>
			<span style="color: #7a0874; font-weight: bold;">echo</span> WARNING: no get since <span style="color: #007800;">$name</span> exists <span style="color: #000000; font-weight: bold;">in</span> <span style="color: #800000;">${localpath}</span> <span style="color: #000000; font-weight: bold;">&gt;&amp;</span><span style="color: #000000;">2</span>
		<span style="color: #000000; font-weight: bold;">fi</span>
	<span style="color: #000000; font-weight: bold;">else</span>
		<span style="color: #007800;">do_get</span>=<span style="color: #000000;">1</span>
	<span style="color: #000000; font-weight: bold;">fi</span>
	<span style="color: #000000; font-weight: bold;">if</span> <span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #7a0874; font-weight: bold;">&#40;</span>do_get<span style="color: #7a0874; font-weight: bold;">&#41;</span><span style="color: #7a0874; font-weight: bold;">&#41;</span> ; <span style="color: #000000; font-weight: bold;">then</span>
		print <span style="color: #660033;">-p</span> get <span style="color: #000000; font-weight: bold;">\&quot;</span><span style="color: #ff0000;">&quot;<span style="color: #007800;">$name</span>&quot;</span><span style="color: #000000; font-weight: bold;">\&quot;</span>
		waitfor <span style="color: #007800;">$name</span>
		<span style="color: #007800;">VMESS</span>=<span style="color: #ff0000;">&quot;<span style="color: #007800;">${VMESS}</span> has been retrieved&quot;</span>
		<span style="color: #000000; font-weight: bold;">if</span> <span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #7a0874; font-weight: bold;">&#40;</span>OPT_MODE<span style="color: #7a0874; font-weight: bold;">&#41;</span><span style="color: #7a0874; font-weight: bold;">&#41;</span> ; <span style="color: #000000; font-weight: bold;">then</span>
			<span style="color: #c20cb9; font-weight: bold;">chmod</span> <span style="color: #007800;">$mode</span> <span style="color: #ff0000;">&quot;<span style="color: #007800;">$name</span>&quot;</span>
		<span style="color: #000000; font-weight: bold;">fi</span>
	<span style="color: #000000; font-weight: bold;">fi</span>
	<span style="color: #000000; font-weight: bold;">if</span> <span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #007800;">$OPT_VERBOSE</span><span style="color: #7a0874; font-weight: bold;">&#41;</span><span style="color: #7a0874; font-weight: bold;">&#41;</span> ; <span style="color: #000000; font-weight: bold;">then</span>
		<span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;<span style="color: #007800;">$VMESS</span>&quot;</span>
	<span style="color: #000000; font-weight: bold;">fi</span>
	<span style="color: #7a0874; font-weight: bold;">return</span> <span style="color: #000000;">0</span>
<span style="color: #7a0874; font-weight: bold;">&#125;</span>
&nbsp;
&nbsp;
<span style="color: #666666; font-style: italic;">#  Function to process a remote directory</span>
<span style="color: #666666; font-style: italic;">#  To this function, a remote directory is just an object that</span>
<span style="color: #666666; font-style: italic;">#  may need to be duplicated in the current directory</span>
&nbsp;
process_remote_directory<span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #7a0874; font-weight: bold;">&#41;</span> <span style="color: #7a0874; font-weight: bold;">&#123;</span>
&nbsp;
	<span style="color: #007800;">VMESS</span>=<span style="color: #ff0000;">&quot;<span style="color: #007800;">${VMESS}</span> is a remote directory that&quot;</span>
	<span style="color: #000000; font-weight: bold;">if</span> <span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #7a0874; font-weight: bold;">&#40;</span>OPT_DIRECTORIES<span style="color: #7a0874; font-weight: bold;">&#41;</span><span style="color: #7a0874; font-weight: bold;">&#41;</span> ; <span style="color: #000000; font-weight: bold;">then</span>
		<span style="color: #000000; font-weight: bold;">if</span> exists <span style="color: #007800;">$name</span>  ; <span style="color: #000000; font-weight: bold;">then</span>
			<span style="color: #000000; font-weight: bold;">if</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span><span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #000000; font-weight: bold;">!</span> <span style="color: #660033;">-d</span> <span style="color: #007800;">$name</span> <span style="color: #7a0874; font-weight: bold;">&#93;</span><span style="color: #7a0874; font-weight: bold;">&#93;</span> ; <span style="color: #000000; font-weight: bold;">then</span>
				<span style="color: #007800;">VMESS</span>=<span style="color: #ff0000;">&quot;<span style="color: #007800;">${VMESS}</span> cannot be created due to pre-existing object&quot;</span>
				<span style="color: #7a0874; font-weight: bold;">echo</span> WARNING: no <span style="color: #c20cb9; font-weight: bold;">mkdir</span> since <span style="color: #007800;">$name</span> exists <span style="color: #000000; font-weight: bold;">in</span> <span style="color: #800000;">${localpath}</span> <span style="color: #000000; font-weight: bold;">&gt;&amp;</span><span style="color: #000000;">2</span>
			<span style="color: #000000; font-weight: bold;">else</span>
				<span style="color: #007800;">VMESS</span>=<span style="color: #ff0000;">&quot;<span style="color: #007800;">${VMESS}</span> already exists&quot;</span>
			<span style="color: #000000; font-weight: bold;">fi</span>
		<span style="color: #000000; font-weight: bold;">else</span>
			<span style="color: #c20cb9; font-weight: bold;">mkdir</span> <span style="color: #ff0000;">&quot;<span style="color: #007800;">$name</span>&quot;</span>
			<span style="color: #007800;">VMESS</span>=<span style="color: #ff0000;">&quot;<span style="color: #007800;">${VMESS}</span> has been created locally&quot;</span>
			<span style="color: #000000; font-weight: bold;">if</span> <span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #7a0874; font-weight: bold;">&#40;</span>OPT_MODE<span style="color: #7a0874; font-weight: bold;">&#41;</span><span style="color: #7a0874; font-weight: bold;">&#41;</span> ; <span style="color: #000000; font-weight: bold;">then</span>
				<span style="color: #c20cb9; font-weight: bold;">chmod</span> <span style="color: #007800;">$mode</span> <span style="color: #ff0000;">&quot;<span style="color: #007800;">$name</span>&quot;</span>
			<span style="color: #000000; font-weight: bold;">fi</span>
		<span style="color: #000000; font-weight: bold;">fi</span>
	<span style="color: #000000; font-weight: bold;">else</span>
		<span style="color: #007800;">VMESS</span>=<span style="color: #ff0000;">&quot;<span style="color: #007800;">${VMESS}</span> has been ignored&quot;</span>
	<span style="color: #000000; font-weight: bold;">fi</span>
	<span style="color: #000000; font-weight: bold;">if</span> <span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #007800;">$OPT_VERBOSE</span><span style="color: #7a0874; font-weight: bold;">&#41;</span><span style="color: #7a0874; font-weight: bold;">&#41;</span> ; <span style="color: #000000; font-weight: bold;">then</span>
		<span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;<span style="color: #007800;">$VMESS</span>&quot;</span>
	<span style="color: #000000; font-weight: bold;">fi</span>
	<span style="color: #000000; font-weight: bold;">if</span> <span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #7a0874; font-weight: bold;">&#40;</span>OPT_RECURS<span style="color: #7a0874; font-weight: bold;">&#41;</span><span style="color: #7a0874; font-weight: bold;">&#41;</span> ; <span style="color: #000000; font-weight: bold;">then</span>
		<span style="color: #000000; font-weight: bold;">if</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span><span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #660033;">-d</span> <span style="color: #ff0000;">&quot;<span style="color: #007800;">$name</span>&quot;</span> <span style="color: #7a0874; font-weight: bold;">&#93;</span><span style="color: #7a0874; font-weight: bold;">&#93;</span> ; <span style="color: #000000; font-weight: bold;">then</span>
			<span style="color: #7a0874; font-weight: bold;">cd</span> <span style="color: #ff0000;">&quot;<span style="color: #007800;">$name</span>&quot;</span>
			print <span style="color: #660033;">-p</span> lcd <span style="color: #000000; font-weight: bold;">\&quot;</span><span style="color: #ff0000;">&quot;<span style="color: #007800;">$name</span>&quot;</span><span style="color: #000000; font-weight: bold;">\&quot;</span>
			<span style="color: #7a0874; font-weight: bold;">exec</span> <span style="color: #000000;">4</span><span style="color: #000000; font-weight: bold;">&lt;&amp;</span>-
			obtain_and_process_remote_ls <span style="color: #ff0000;">&quot;<span style="color: #007800;">$name</span>&quot;</span>
			print <span style="color: #660033;">-p</span> <span style="color: #7a0874; font-weight: bold;">cd</span> ..
			print <span style="color: #660033;">-p</span> lcd ..
			<span style="color: #7a0874; font-weight: bold;">cd</span> ..
			<span style="color: #7a0874; font-weight: bold;">exec</span> <span style="color: #000000;">4</span><span style="color: #000000; font-weight: bold;">&lt;</span> <span style="color: #800000;">${DIR_FILE_NAME[LEV]}</span>
			<span style="color: #007800;">lineno</span>=<span style="color: #000000;">0</span>
			<span style="color: #000000; font-weight: bold;">while</span> <span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #7a0874; font-weight: bold;">&#40;</span> lineno <span style="color: #000000; font-weight: bold;">!</span>= <span style="color: #800000;">${DIR_LINE_NUM[LEV]}</span><span style="color: #7a0874; font-weight: bold;">&#41;</span><span style="color: #7a0874; font-weight: bold;">&#41;</span> ; <span style="color: #000000; font-weight: bold;">do</span>
				<span style="color: #c20cb9; font-weight: bold;">read</span> <span style="color: #660033;">-u4</span> junk
				<span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #007800;">lineno</span>=lineno+<span style="color: #000000;">1</span><span style="color: #7a0874; font-weight: bold;">&#41;</span><span style="color: #7a0874; font-weight: bold;">&#41;</span>
			<span style="color: #000000; font-weight: bold;">done</span>
		<span style="color: #000000; font-weight: bold;">fi</span>
	<span style="color: #000000; font-weight: bold;">fi</span>
	<span style="color: #7a0874; font-weight: bold;">return</span> <span style="color: #000000;">0</span>
<span style="color: #7a0874; font-weight: bold;">&#125;</span>
&nbsp;
&nbsp;
<span style="color: #666666; font-style: italic;">#</span>
<span style="color: #666666; font-style: italic;">#  Function to process a remote symlink</span>
<span style="color: #666666; font-style: italic;">#  Note that we deal with th symlink only --  not</span>
<span style="color: #666666; font-style: italic;">#  the object (if any) that the link points to.</span>
&nbsp;
process_remote_symlink<span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #7a0874; font-weight: bold;">&#41;</span> <span style="color: #7a0874; font-weight: bold;">&#123;</span>
	<span style="color: #007800;">VMESS</span>=<span style="color: #ff0000;">&quot;<span style="color: #007800;">${VMESS}</span> is a remote symlink that&quot;</span>
	<span style="color: #000000; font-weight: bold;">if</span> <span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #7a0874; font-weight: bold;">&#40;</span>OPT_SYMLINKS<span style="color: #7a0874; font-weight: bold;">&#41;</span><span style="color: #7a0874; font-weight: bold;">&#41;</span> ; <span style="color: #000000; font-weight: bold;">then</span>
		<span style="color: #000000; font-weight: bold;">if</span> exists <span style="color: #ff0000;">&quot;<span style="color: #007800;">$name</span>&quot;</span> ; <span style="color: #000000; font-weight: bold;">then</span>
			<span style="color: #000000; font-weight: bold;">if</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span><span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #000000; font-weight: bold;">!</span> <span style="color: #660033;">-L</span> <span style="color: #007800;">$name</span> <span style="color: #7a0874; font-weight: bold;">&#93;</span><span style="color: #7a0874; font-weight: bold;">&#93;</span> ; <span style="color: #000000; font-weight: bold;">then</span>
				<span style="color: #007800;">VMESS</span>=<span style="color: #ff0000;">&quot;<span style="color: #007800;">${VMESS}</span> cannot be created due to pre-existing object&quot;</span>
				<span style="color: #7a0874; font-weight: bold;">echo</span> WARNING: no symlink since <span style="color: #007800;">$name</span> exists <span style="color: #000000; font-weight: bold;">in</span> <span style="color: #800000;">${localpath}</span> <span style="color: #000000; font-weight: bold;">&gt;&amp;</span><span style="color: #000000;">2</span>
			<span style="color: #000000; font-weight: bold;">else</span>
				<span style="color: #007800;">VMESS</span>=<span style="color: #ff0000;">&quot;<span style="color: #007800;">${VMESS}</span> already exists&quot;</span>
			<span style="color: #000000; font-weight: bold;">fi</span>
		<span style="color: #000000; font-weight: bold;">else</span>
			<span style="color: #c20cb9; font-weight: bold;">ln</span> <span style="color: #660033;">-s</span> <span style="color: #ff0000;">&quot;<span style="color: #007800;">$link</span>&quot;</span> <span style="color: #ff0000;">&quot;<span style="color: #007800;">$name</span>&quot;</span>
			<span style="color: #007800;">VMESS</span>=<span style="color: #ff0000;">&quot;<span style="color: #007800;">${VMESS}</span> has been duplicated locally&quot;</span>
		<span style="color: #000000; font-weight: bold;">fi</span>
	<span style="color: #000000; font-weight: bold;">else</span>
		<span style="color: #007800;">VMESS</span>=<span style="color: #ff0000;">&quot;<span style="color: #007800;">${VMESS}</span> has been ignored&quot;</span>
	<span style="color: #000000; font-weight: bold;">fi</span>
	<span style="color: #000000; font-weight: bold;">if</span> <span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #007800;">$OPT_VERBOSE</span><span style="color: #7a0874; font-weight: bold;">&#41;</span><span style="color: #7a0874; font-weight: bold;">&#41;</span> ; <span style="color: #000000; font-weight: bold;">then</span>
		<span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;<span style="color: #007800;">$VMESS</span>&quot;</span>
	<span style="color: #000000; font-weight: bold;">fi</span>
<span style="color: #7a0874; font-weight: bold;">&#125;</span>
&nbsp;
&nbsp;
<span style="color: #666666; font-style: italic;">#</span>
<span style="color: #666666; font-style: italic;">#  If a remote object is not a file, directory, or</span>
<span style="color: #666666; font-style: italic;">#  symlink, we come here.  </span>
&nbsp;
process_remote_weirdo<span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #7a0874; font-weight: bold;">&#41;</span> <span style="color: #7a0874; font-weight: bold;">&#123;</span>
	<span style="color: #007800;">VMESS</span>=<span style="color: #ff0000;">&quot;<span style="color: #007800;">${VMESS}</span> is a remote unknown object that has been ignored&quot;</span>
	<span style="color: #7a0874; font-weight: bold;">return</span> <span style="color: #000000;">0</span>
	<span style="color: #7a0874; font-weight: bold;">&#125;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">#</span>
<span style="color: #666666; font-style: italic;">#  This function obtains an &quot;ls&quot; listing from the remote ftp system.  Then it </span>
<span style="color: #666666; font-style: italic;">#  scans the listing line by line to figure out what to do.  It will completely </span>
<span style="color: #666666; font-style: italic;">#  process the current directory.</span>
&nbsp;
obtain_and_process_remote_ls<span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #7a0874; font-weight: bold;">&#41;</span> <span style="color: #7a0874; font-weight: bold;">&#123;</span>
&nbsp;
	<span style="color: #7a0874; font-weight: bold;">typeset</span> rdir tmpfile okfile   <span style="color: #666666; font-style: italic;">## local scope variables ##</span>
	<span style="color: #007800;">rdir</span>=<span style="color: #007800;">$1</span>
&nbsp;
	<span style="color: #666666; font-style: italic;">#</span>
	<span style="color: #666666; font-style: italic;">#  Set up variables or modify them if we have recursed</span>
&nbsp;
	<span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #007800;">LEV</span>=LEV+<span style="color: #000000;">1</span><span style="color: #7a0874; font-weight: bold;">&#41;</span><span style="color: #7a0874; font-weight: bold;">&#41;</span>
	<span style="color: #007800;">tmpfile</span>=<span style="color: #000000; font-weight: bold;">/</span>tmp<span style="color: #000000; font-weight: bold;">/</span>HardFeed.tp.<span style="color: #007800;">$$</span>.<span style="color: #800000;">${LEV}</span>
	<span style="color: #007800;">okfile</span>=<span style="color: #000000; font-weight: bold;">/</span>tmp<span style="color: #000000; font-weight: bold;">/</span>HardFeed.ok.<span style="color: #007800;">$$</span>.<span style="color: #800000;">${LEV}</span>
	<span style="color: #000000; font-weight: bold;">if</span> <span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #7a0874; font-weight: bold;">&#40;</span>LEV == <span style="color: #000000;">1</span><span style="color: #7a0874; font-weight: bold;">&#41;</span><span style="color: #7a0874; font-weight: bold;">&#41;</span> ; <span style="color: #000000; font-weight: bold;">then</span>
		<span style="color: #007800;">localpath</span>=<span style="color: #007800;">$STARTPATH</span>
		<span style="color: #007800;">remotepath</span>=<span style="color: #007800;">$rdir</span>
	<span style="color: #000000; font-weight: bold;">else</span>
		<span style="color: #007800;">localpath</span>=<span style="color: #800000;">${localpath}</span><span style="color: #000000; font-weight: bold;">/</span><span style="color: #007800;">$rdir</span>
		<span style="color: #007800;">remotepath</span>=<span style="color: #800000;">${remotepath}</span><span style="color: #000000; font-weight: bold;">/</span><span style="color: #007800;">$rdir</span>
&nbsp;
	<span style="color: #000000; font-weight: bold;">fi</span>
&nbsp;
	<span style="color: #666666; font-style: italic;">#</span>
	<span style="color: #666666; font-style: italic;">#  Get a copy of the remote dir output in a local file</span>
	<span style="color: #666666; font-style: italic;">#  called $tmpfile </span>
&nbsp;
	print <span style="color: #660033;">-p</span> <span style="color: #7a0874; font-weight: bold;">cd</span> <span style="color: #000000; font-weight: bold;">\&quot;</span><span style="color: #ff0000;">&quot;<span style="color: #007800;">$rdir</span>&quot;</span><span style="color: #000000; font-weight: bold;">\&quot;</span>
	print <span style="color: #660033;">-p</span> <span style="color: #007800;">$OPT_DIRCMD</span> <span style="color: #007800;">$tmpfile</span>
	print <span style="color: #660033;">-p</span> <span style="color: #007800;">$OPT_DIRCMD</span> <span style="color: #007800;">$okfile</span>
	waitfor <span style="color: #007800;">$okfile</span>
	DIR_FILE_NAME<span style="color: #7a0874; font-weight: bold;">&#91;</span>LEV<span style="color: #7a0874; font-weight: bold;">&#93;</span>=<span style="color: #007800;">$tmpfile</span>
	DIR_LINE_NUM<span style="color: #7a0874; font-weight: bold;">&#91;</span>LEV<span style="color: #7a0874; font-weight: bold;">&#93;</span>=<span style="color: #000000;">0</span>
	<span style="color: #7a0874; font-weight: bold;">exec</span> <span style="color: #000000;">4</span><span style="color: #000000; font-weight: bold;">&lt;</span> <span style="color: #007800;">$tmpfile</span>
&nbsp;
	<span style="color: #666666; font-style: italic;">#</span>
	<span style="color: #666666; font-style: italic;">#  process each line</span>
	<span style="color: #666666; font-style: italic;">#</span>
&nbsp;
	<span style="color: #000000; font-weight: bold;">while</span> <span style="color: #c20cb9; font-weight: bold;">read</span> <span style="color: #660033;">-u4</span> line ; <span style="color: #000000; font-weight: bold;">do</span>
		<span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #7a0874; font-weight: bold;">&#40;</span>DIR_LINE_NUM<span style="color: #7a0874; font-weight: bold;">&#91;</span>LEV<span style="color: #7a0874; font-weight: bold;">&#93;</span>=<span style="color: #800000;">${DIR_LINE_NUM[LEV]}</span>+<span style="color: #000000;">1</span><span style="color: #7a0874; font-weight: bold;">&#41;</span><span style="color: #7a0874; font-weight: bold;">&#41;</span>
		lsdcode <span style="color: #ff0000;">&quot;<span style="color: #007800;">$line</span>&quot;</span> 
		<span style="color: #007800;">char1</span>=<span style="color: #800000;">${lsdc[0]}</span>
		<span style="color: #007800;">mode</span>=<span style="color: #800000;">${lsdc[1]}</span>
		<span style="color: #007800;">datestamp</span>=<span style="color: #800000;">${lsdc[2]}</span>
		<span style="color: #007800;">name</span>=<span style="color: #800000;">${lsdc[3]}</span>
		<span style="color: #007800;">link</span>=<span style="color: #800000;">${lsdc[4]}</span>
		<span style="color: #007800;">VMESS</span>=<span style="color: #ff0000;">&quot;<span style="color: #007800;">${remotepath}</span>/<span style="color: #007800;">${name}</span>&quot;</span>
		<span style="color: #000000; font-weight: bold;">case</span> <span style="color: #007800;">$char1</span> <span style="color: #000000; font-weight: bold;">in</span>
		skip<span style="color: #7a0874; font-weight: bold;">&#41;</span>   <span style="color: #000000; font-weight: bold;">;;</span>
		-<span style="color: #7a0874; font-weight: bold;">&#41;</span>      process_remote_file
			<span style="color: #000000; font-weight: bold;">;;</span>
		d<span style="color: #7a0874; font-weight: bold;">&#41;</span>      process_remote_directory
			<span style="color: #000000; font-weight: bold;">;;</span>
		l<span style="color: #7a0874; font-weight: bold;">&#41;</span>      process_remote_symlink
			<span style="color: #000000; font-weight: bold;">;;</span>
		<span style="color: #000000; font-weight: bold;">*</span><span style="color: #7a0874; font-weight: bold;">&#41;</span>      process_remote_weirdo
			<span style="color: #000000; font-weight: bold;">;;</span>
		<span style="color: #000000; font-weight: bold;">esac</span>
	<span style="color: #000000; font-weight: bold;">done</span> 
&nbsp;
<span style="color: #666666; font-style: italic;">#</span>
<span style="color: #666666; font-style: italic;">#  We may have recursed...so we must put everything back the way</span>
<span style="color: #666666; font-style: italic;">#  we found it</span>
&nbsp;
	<span style="color: #007800;">localpath</span>=<span style="color: #800000;">${localpath%$rdir}</span>
	<span style="color: #007800;">localpath</span>=<span style="color: #800000;">${localpath%/}</span>
	<span style="color: #007800;">remotepath</span>=<span style="color: #800000;">${remotepath%$rdir}</span>
	<span style="color: #007800;">remotepath</span>=<span style="color: #800000;">${remotepath%/}</span>
	<span style="color: #c20cb9; font-weight: bold;">rm</span> <span style="color: #007800;">$tmpfile</span>
	<span style="color: #c20cb9; font-weight: bold;">rm</span> <span style="color: #007800;">$okfile</span>
	<span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #007800;">LEV</span>=LEV-<span style="color: #000000;">1</span><span style="color: #7a0874; font-weight: bold;">&#41;</span><span style="color: #7a0874; font-weight: bold;">&#41;</span>
&nbsp;
	<span style="color: #7a0874; font-weight: bold;">return</span> <span style="color: #000000;">0</span>
<span style="color: #7a0874; font-weight: bold;">&#125;</span>
&nbsp;
&nbsp;
<span style="color: #666666; font-style: italic;">#</span>
<span style="color: #666666; font-style: italic;">#  Main Program</span>
<span style="color: #666666; font-style: italic;">#</span>
&nbsp;
&nbsp;
<span style="color: #c20cb9; font-weight: bold;">ftp</span> <span style="color: #660033;">-inv</span> <span style="color: #000000; font-weight: bold;">&gt;&amp;</span><span style="color: #000000;">3</span> <span style="color: #000000;">2</span><span style="color: #000000; font-weight: bold;">&gt;&amp;</span><span style="color: #000000;">1</span> <span style="color: #000000; font-weight: bold;">|&amp;</span>
print <span style="color: #660033;">-p</span> open <span style="color: #007800;">$SYSTEM</span>
print <span style="color: #660033;">-p</span> user <span style="color: #007800;">$USER</span> <span style="color: #007800;">$PASSWORD</span>
print <span style="color: #660033;">-p</span> binary
&nbsp;
<span style="color: #007800;">i</span>=<span style="color: #000000;">0</span>
<span style="color: #000000; font-weight: bold;">while</span> <span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #7a0874; font-weight: bold;">&#40;</span>OPT_CMDS<span style="color: #000000; font-weight: bold;">&gt;</span>i<span style="color: #7a0874; font-weight: bold;">&#41;</span><span style="color: #7a0874; font-weight: bold;">&#41;</span> ; <span style="color: #000000; font-weight: bold;">do</span>
	print <span style="color: #660033;">-p</span> <span style="color: #800000;">${OPT_CMDS_LIST[i]}</span>
	<span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #007800;">i</span>=i+<span style="color: #000000;">1</span><span style="color: #7a0874; font-weight: bold;">&#41;</span><span style="color: #7a0874; font-weight: bold;">&#41;</span>
<span style="color: #000000; font-weight: bold;">done</span>
&nbsp;
obtain_and_process_remote_ls <span style="color: #007800;">$DIRECTORY</span>
&nbsp;
print <span style="color: #660033;">-p</span> bye
<span style="color: #7a0874; font-weight: bold;">wait</span>
<span style="color: #7a0874; font-weight: bold;">exit</span> <span style="color: #000000;">0</span></pre></div></div>

<p>You just need to copy all the script, save it to a file, upload it to your server and run it. But first you must install the ksh, in ubuntu you can just type :</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">sudo</span> <span style="color: #c20cb9; font-weight: bold;">apt-get</span> <span style="color: #c20cb9; font-weight: bold;">install</span> ksh</pre></div></div>

<p>Example of using it :</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">.<span style="color: #000000; font-weight: bold;">/</span>hardfeed <span style="color: #000000; font-weight: bold;">&lt;</span><span style="color: #c20cb9; font-weight: bold;">ftp</span> server<span style="color: #000000; font-weight: bold;">&gt;</span> <span style="color: #000000; font-weight: bold;">&lt;</span>username<span style="color: #000000; font-weight: bold;">&gt;</span> <span style="color: #000000; font-weight: bold;">&lt;</span>directory<span style="color: #000000; font-weight: bold;">&gt;</span></pre></div></div>

<ul>
<li>./hardfeed : the name of the script</li>
<li>ftp server : the ip or the domain of the ftp server</li>
<li>username : the username of the ftp</li>
<li>directory : directory in the ftp server where you want to get the files from</li>
</ul>
<p>Here the another options which I copied from the website :<br />
HardFeed ftpserver joeblow somedir<br />
This will connect to &#8220;ftpserver&#8221; and the user &#8220;joeblow&#8221;. It will cd to &#8220;somedir&#8221;. It will look at all of the files (and only the files) there. Each remote file that does not exist in the current directory will be copied to the current directory.</p>
<p>HardFeed -ds ftpserver joeblow somedir<br />
This will work as the above example did. Except now we try to create local copies of any symbolic links or directories that we found in &#8220;somedir&#8221;. Again, though, we will not overwrite any pre-existing object.</p>
<p>HardFeed -rds ftpserver joeblow somedir<br />
Now we will create copies of any remote directories and desend into them. This will copy an entire directory tree. (except that it continues to ignore special files, pipes, etc.)</p>
<p>HardFeed -rs ftpserver joeblow somedir<br />
This is similiar, except we only desend into pre-existing directories. You can use this to copy part of a directory structure. Just pre-create the few directories that you want to copy.</p>
<p>HardFeed -rdsm ftpserver joeblow somedir<br />
This will copy a directory tree, but this time it will try to duplicate the mode (permissions) on each remote object that is duplicated.</p>
<p>HardFeed -rdsf ftpserver joeblow somdir<br />
The -f is &#8220;freshen&#8221;. Again it copies a directory tree. But if we have a local file and a remote file, the timestamps are compared. The remote file will overwrite the the local file if the remote file was newer.</p>
<p><a href="http://blog.rudylee.com/2010/06/08/copying-files-between-2-unix-servers/">Copying files between 2 unix servers</a> is a post from: <a href="http://blog.rudylee.com">blog.rudylee.com</a></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.rudylee.com/2010/06/08/copying-files-between-2-unix-servers/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Setting up NFS di Ubuntu</title>
		<link>http://blog.rudylee.com/2010/06/07/setting-up-nfs-di-ubuntu/</link>
		<comments>http://blog.rudylee.com/2010/06/07/setting-up-nfs-di-ubuntu/#comments</comments>
		<pubDate>Mon, 07 Jun 2010 06:41:49 +0000</pubDate>
		<dc:creator>Rudy</dc:creator>
				<category><![CDATA[Unix and Linux]]></category>
		<category><![CDATA[control]]></category>
		<category><![CDATA[nfs]]></category>
		<category><![CDATA[Ubuntu]]></category>

		<guid isPermaLink="false">http://blog.rudylee.com/?p=485</guid>
		<description><![CDATA[NFS ( Network File Sharing ) adalah salah satu fitur di linux yang memungkinkan kita untuk men-share folder dan me-mountingnya ke server lain. Jadi misalnya gwa punya server A dengan folder /var/www/uploads dan gwa pengen folder itu bisa diakses dan dari server B. Jadi solusinya adalah Server A gwa jadikan NFS Server dan Server B ...<p><a href="http://blog.rudylee.com/2010/06/07/setting-up-nfs-di-ubuntu/">Setting up NFS di Ubuntu</a> is a post from: <a href="http://blog.rudylee.com">blog.rudylee.com</a></p>
]]></description>
			<content:encoded><![CDATA[<p>NFS ( Network File Sharing ) adalah salah satu fitur di linux yang memungkinkan kita untuk men-share folder dan me-mountingnya ke server lain. Jadi misalnya gwa punya server A dengan folder /var/www/uploads dan gwa pengen folder itu bisa diakses dan dari server B.</p>
<p>Jadi solusinya adalah Server A gwa jadikan NFS Server dan Server B menjadi NFS Client. Dalam kasus ini gwa menggunakan Ubuntu ( karena gwa lagi buru-buru ). Untuk menginstall NFS Server cukup ketik :</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">sudo</span> <span style="color: #c20cb9; font-weight: bold;">apt-get</span> <span style="color: #c20cb9; font-weight: bold;">install</span> nfs-kernel-server</pre></div></div>

<p>Setelah itu tinggal setting folder yang mau dishare. Untuk settingannya terletak di folder /etc/exports, jadi sekarang kita edit dengan command :</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">sudo</span> <span style="color: #c20cb9; font-weight: bold;">vim</span> <span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>exports</pre></div></div>

<p>Kira-kira begini isinya :</p>

<div class="wp_syntax"><div class="code"><pre class="apache" style="font-family:monospace;"><span style="color: #adadad; font-style: italic;"># /etc/exports: the access control list for filesystems which may be exported</span>
<span style="color: #adadad; font-style: italic;">#               to NFS clients.  See exports(5).</span>
<span style="color: #adadad; font-style: italic;">#</span>
<span style="color: #adadad; font-style: italic;"># Example for NFSv2 and NFSv3:</span>
<span style="color: #adadad; font-style: italic;"># /srv/homes       hostname1(rw,sync,no_subtree_check) hostname2(ro,sync,no_subtree_check)</span>
<span style="color: #adadad; font-style: italic;">#</span>
<span style="color: #adadad; font-style: italic;"># Example for NFSv4:</span>
<span style="color: #adadad; font-style: italic;"># /srv/nfs4        gss/krb5i(rw,sync,fsid=0,crossmnt,no_subtree_check)</span>
<span style="color: #adadad; font-style: italic;"># /srv/nfs4/homes  gss/krb5i(rw,sync,no_subtree_check)</span>
<span style="color: #adadad; font-style: italic;">#</span>
&nbsp;
/var/www/uploads 202.58.181.0/<span style="color: #ff0000;">24</span>(rw,no_root_squash,async)</pre></div></div>

<p>Penjelasannya kira-kira begini : </p>
<ul>
<li>/var/www/uploads = folder di server yang mau dishare </li>
<li>202.58.181.0/24 = ip yang diallow untuk melakukan nfs</li>
<li>(rw,no_root_squash,async) = rulenya ( ini rulenya untuk allow semuanya )</li>
</ul>
<p>Sekarang anda tinggal restart nfsnya dengan command :</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">sudo</span> <span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>init.d<span style="color: #000000; font-weight: bold;">/</span>nfs restart</pre></div></div>

<p>Trus login ke dalam server yang pengen dimounting NFS nya dan ketik :</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">mount</span> <span style="color: #000000; font-weight: bold;">&lt;</span>ip nfs server<span style="color: #000000; font-weight: bold;">&gt;</span>:<span style="color: #000000; font-weight: bold;">/</span>var<span style="color: #000000; font-weight: bold;">/</span>www<span style="color: #000000; font-weight: bold;">/</span>uploads <span style="color: #000000; font-weight: bold;">/</span>var<span style="color: #000000; font-weight: bold;">/</span>www<span style="color: #000000; font-weight: bold;">/</span>temp</pre></div></div>

<p>Penjelasannya kira-kira begini :</p>
<ul>
<li>mount <ip nfs server> : ini diisi dengan ip nfs server / domain</li>
<li>/var/www/uploads : ini folder yang mau dishare di nfs server</li>
<li>/var/www/temp : ini tempat folder yang dimounting di client</li>
</ul>
<p><a href="http://blog.rudylee.com/2010/06/07/setting-up-nfs-di-ubuntu/">Setting up NFS di Ubuntu</a> is a post from: <a href="http://blog.rudylee.com">blog.rudylee.com</a></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.rudylee.com/2010/06/07/setting-up-nfs-di-ubuntu/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Git free revision control</title>
		<link>http://blog.rudylee.com/2010/02/28/git-free-revision-control/</link>
		<comments>http://blog.rudylee.com/2010/02/28/git-free-revision-control/#comments</comments>
		<pubDate>Sun, 28 Feb 2010 16:06:05 +0000</pubDate>
		<dc:creator>Rudy</dc:creator>
				<category><![CDATA[Unix and Linux]]></category>
		<category><![CDATA[CakePHP]]></category>
		<category><![CDATA[coding]]></category>
		<category><![CDATA[control]]></category>
		<category><![CDATA[free]]></category>
		<category><![CDATA[git]]></category>
		<category><![CDATA[github]]></category>
		<category><![CDATA[revision]]></category>

		<guid isPermaLink="false">http://blog.rudylee.com/?p=406</guid>
		<description><![CDATA[Sambil nungguin compile e-texteditor yang entah kelar kapan gwa mo cerita-cerita dikit tentang mainan baru gwa, yaitu Git. Mengutip sedikit tentang Git dari wikipedia : Git is a free distributed revision control, or software source code management project with an emphasis on being fast. Git was initially designed and developed by Linus Torvalds for Linux ...<p><a href="http://blog.rudylee.com/2010/02/28/git-free-revision-control/">Git free revision control</a> is a post from: <a href="http://blog.rudylee.com">blog.rudylee.com</a></p>
]]></description>
			<content:encoded><![CDATA[<p>Sambil nungguin compile e-texteditor yang entah kelar kapan gwa mo cerita-cerita dikit tentang mainan baru gwa, yaitu <a href="http://en.wikipedia.org/wiki/Git_%28software%29">Git</a>. Mengutip sedikit tentang Git dari wikipedia :</p>
<blockquote><p>
Git is a free distributed revision control, or software source code management project with an emphasis on being fast. Git was initially designed and developed by Linus Torvalds for Linux kernel development.
</p></blockquote>
<p>Yah jadi intinya Git adalah sebuah revision control yang biasa digunakan project-project open source untuk mendeteksi perubahan-perubahan yang dilakukan pada project mereka. Entah itu berupa perubahan codingan, hapus file, nambah file,dkk. Jadi jika kita bekerja dalam Team dan akan sangat membantu sekali menggunakan Git ini karena dapat mendeteksi apa aja perubahan-perubahan yang dilakukan programmer-programmer.</p>
<p>Sudah banyak project open source yang mengadaptasi Git ini, beberapanya adalah <a href="http://www.cakephp.org">CakePHP</a> dan <a href="http://li3.rad-dev.org">Lithium</a>. Jadi jika anda berniat untuk ikut memberikan kontribusi terhadap project open source disarankan untuk mempelajari Git ini.</p>
<p>Jadi apa yang membedakan Git dengan revision control yang lain seperti SVN, atau CVS ? jawabannya gwa juga ga tau pasti karena Git adalah revision control yang pertama kali gwa pelajari. Tapi dari yang gwa baca-baca satu perbedaan besarnya adalah dengan menggunakan Git kita dapat melakukan commit secara locally tanpa harus terkoneksi dengan internet. </p>
<p>Apakah itu commit ? itu semacam istilah yang menandakan anda telah selesai melakukan perubahan dan menyimpan perubahan-perubahan. Yah masih banyak istilah-istilah Git yang bakal anda pelajari </p>
<p>Selain itu hal yang gwa suka dari menggunakan Git adalah website <a href="http://www.github.com">Github</a>. Github adalah sebuah aplikasi website yang dibangun menggunakan Ruby on Rails dan berfungsi sebagai repository dari Git, jadi dengan mendaftarkan diri ke Github kita dapat melakukan upload ke server Github dengan menggunakan perintah &#8220;git push&#8221;. Hal tersebut tentu saja membantu kita yang ingin bekerja secara sistematis, terkontrol dan tanpa harus menyiapkan server repository, aplikasi website buat memantaunya karena Github sudah menyediakan tracking yang dapat melihat hasil commit dari masing-masing invididu dalam team.</p>
<p>Yup kira-kira itu saja lah perkenalan Git yang baru gwa gunakan kurang lebih baru 2 minggu, mungkin nanti kalau gwa udah jago pake Git gwa bakal posting tutorialnya disini ( hore akhirnya bulan februari tulis blog ). Until next time&#8230;.</p>
<p><a href="http://blog.rudylee.com/2010/02/28/git-free-revision-control/">Git free revision control</a> is a post from: <a href="http://blog.rudylee.com">blog.rudylee.com</a></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.rudylee.com/2010/02/28/git-free-revision-control/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Install PHP-FPM di FreeBSD dengan web server Nginx</title>
		<link>http://blog.rudylee.com/2010/01/27/install-php-fpm-di-freebsd-dengan-web-server-nginx/</link>
		<comments>http://blog.rudylee.com/2010/01/27/install-php-fpm-di-freebsd-dengan-web-server-nginx/#comments</comments>
		<pubDate>Wed, 27 Jan 2010 04:24:06 +0000</pubDate>
		<dc:creator>Rudy</dc:creator>
				<category><![CDATA[Unix and Linux]]></category>
		<category><![CDATA[freebsd]]></category>
		<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://blog.rudylee.com/?p=403</guid>
		<description><![CDATA[Setelah mengalami beberapa problem dengan web server Binus Access yang menggunakan Nginx, akhirnya gwa memutuskan untuk mengganti php-cgi menjadi php-fpm. Untuk mengubah php-cgi menjadi php-fpm ternyata tidak lah sulit, apalagi dengan adanya fitur ports dari FreeBSD. Pertama-tama cukup download file ports php-fpm dari websitenya php-fpm . Untuk versi nya sendiri bisa disesuaikan dengan versi php ...<p><a href="http://blog.rudylee.com/2010/01/27/install-php-fpm-di-freebsd-dengan-web-server-nginx/">Install PHP-FPM di FreeBSD dengan web server Nginx</a> is a post from: <a href="http://blog.rudylee.com">blog.rudylee.com</a></p>
]]></description>
			<content:encoded><![CDATA[<p>Setelah mengalami beberapa problem dengan web server <a href="http://www.binus-access.com">Binus Access</a> yang menggunakan Nginx, akhirnya gwa memutuskan untuk mengganti php-cgi menjadi php-fpm.</p>
<p>Untuk mengubah php-cgi menjadi php-fpm ternyata tidak lah sulit, apalagi dengan adanya fitur ports dari FreeBSD. Pertama-tama cukup download file ports php-fpm dari websitenya <a href="http://php-fpm.org/download/">php-fpm </a>.</p>
<p>Untuk versi nya sendiri bisa disesuaikan dengan versi php anda, kalau gwa sih menggunakan versi php 5.2.10. Jadi hal pertama yang gwa lakukan adalah mendownload php-fpm versi <a href="http://php-fpm.org/downloads/freebsd-port/">5.2.10</a>.</p>
<p>Setelah itu tinggal extract aja file php-5.2.10-fpm-0.5.13.tar.gz kemudian pindahin folder php5-fpm nya ke folder /usr/ports/lang. Kemudian tinggal jalankan perintah make dan make install.</p>
<p>Tunggu proses instalasi selesai kemudian ubah file /etc/rc.conf dan tambahkan</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
</pre></td><td class="code"><pre class="apache" style="font-family:monospace;">php_fpm_enable=”YES”</pre></td></tr></table></div>

<p>masuk ke dalam settingan nginx.conf di /usr/local/etc/nginx/nginx.conf dan ubah beberapa settingan di</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
</pre></td><td class="code"><pre class="apache" style="font-family:monospace;">location / {
root /usr/local/www/nginx;
index index.php index.html index.htm;
}
location ~ \.php$ {
fastcgi_pass 127.0.0.1:<span style="color: #ff0000;">9000</span>;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME /usr/local/www/nginx$fastcgi_script_name;
<span style="color: #00007f;">include</span> fastcgi_params;
}</pre></td></tr></table></div>

<p>fastcgi_param SCRIPT_FILENAME /usr/local/www/nginx$fastcgi_script_name; ini adalah tempat folder root web anda berada.</p>
<p>Lalu lanjut dengan edit file php-fpm.conf di /usr/local/etc/php-fpm.conf</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
</pre></td><td class="code"><pre class="apache" style="font-family:monospace;">&lt;!– &lt;value name=”<span style="color: #00007f;">user</span>”&gt;nobody&lt;/value&gt; –&gt;
&lt;!– &lt;value name=”<span style="color: #00007f;">group</span>”&gt;nobody&lt;/value&gt; –&gt;
&nbsp;
ubah nobody menjadi www
&nbsp;
&lt;value name=”<span style="color: #00007f;">user</span>”&gt;www&lt;/value&gt;
&nbsp;
&lt;value name=”<span style="color: #00007f;">group</span>”&gt;www&lt;/value&gt;</pre></td></tr></table></div>

<p>matikan service sebelumnya yaitu php-cgi dan jalankan php-fpm nya</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
</pre></td><td class="code"><pre class="apache" style="font-family:monospace;">/usr/local/etc/rc.d/php-fpm start</pre></td></tr></table></div>

<p>kemudian tinggal testing saja apakah berjalan lancar atau tidak settingannya. Moga-moga lebih stabil dan ga down lagi hohohoho <img src='http://blog.rudylee.com/wp-includes/images/smilies/icon_biggrin.gif' alt=':D' class='wp-smiley' /> </p>
<p><a href="http://blog.rudylee.com/2010/01/27/install-php-fpm-di-freebsd-dengan-web-server-nginx/">Install PHP-FPM di FreeBSD dengan web server Nginx</a> is a post from: <a href="http://blog.rudylee.com">blog.rudylee.com</a></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.rudylee.com/2010/01/27/install-php-fpm-di-freebsd-dengan-web-server-nginx/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>

