<?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>esdrasbeleza.com &#187; Shell</title>
	<atom:link href="http://www.esdrasbeleza.com/tag/shell/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.esdrasbeleza.com</link>
	<description>Só mais um blog do WordPress</description>
	<lastBuildDate>Fri, 13 Jan 2012 14:14:19 +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>Using Automator to make your life with Transmission easier</title>
		<link>http://www.esdrasbeleza.com/2011/07/09/using-automator-to-make-your-life-with-transmission-easier/</link>
		<comments>http://www.esdrasbeleza.com/2011/07/09/using-automator-to-make-your-life-with-transmission-easier/#comments</comments>
		<pubDate>Sat, 09 Jul 2011 19:50:49 +0000</pubDate>
		<dc:creator>Esdras Beleza</dc:creator>
				<category><![CDATA[Desktop]]></category>
		<category><![CDATA[Tools]]></category>
		<category><![CDATA[Automator]]></category>
		<category><![CDATA[Download]]></category>
		<category><![CDATA[Shell]]></category>
		<category><![CDATA[torrent]]></category>
		<category><![CDATA[Transmission]]></category>

		<guid isPermaLink="false">http://www.esdrasbeleza.com/?p=294</guid>
		<description><![CDATA[I have two computers: a Macbook with Snow Leopard, that sometimes I carry with me, and a computer at home with an Atom processor and running Linux that is my media server and downloader. If I need to download something that will take too much time, I put this second computer to download: it has [...]]]></description>
			<content:encoded><![CDATA[<p>I have two computers: a Macbook with Snow Leopard, that sometimes I carry with me, and a computer at home with an Atom processor and running Linux that is my media server and downloader. If I need to download something that will take too much time, I put this second computer to download: it has a good connection and it&#8217;s always online.</p>
<p><a href="http://www.esdrasbeleza.com/wp-content/uploads/2011/07/transmission.jpg"><img class="aligncenter size-medium wp-image-295" title="Transmission web interface" src="http://www.esdrasbeleza.com/wp-content/uploads/2011/07/transmission-300x200.jpg" alt="" width="300" height="200" /></a></p>
<p>It has Transmission running with its great web interface activated. If I need to download some torrent file, I open its web interface and upload the .torrent file. Good, but&#8230; it could be easier.</p>
<p>If you download torrent files very often, the easiest way is to use the watch-dir feature from Transmission: every torrent that you put at some directory is automatically downloaded by Transmission. So, all I needed to do was copying the torrent files from my Macbook to my home server, using SFTP.</p>
<p>To configure your Transmission watch-dir, you must stop the Transmission service (I&#8217;m running the transmission-daemon version) and edit the <strong>settings.json</strong> file, inserting the following settings:</p>
<pre class="brush: jscript; title: ; notranslate">
&quot;watch-dir&quot;: &quot;/home/mediaserver/transmission/watch&quot;,
&quot;watch-dir-enabled&quot;: true
</pre>
<p>Remember: you must stop Transmission service, edit the file and start it again!</p>
<p>It works, but&#8230; <strong>It can be even easier</strong>, I thought. And I remembered of <strong>Automator</strong>, a good piece of software that comes with Snow Leopard, and that I knew but never used before.</p>
<p><img class="aligncenter size-full wp-image-299" title="Automator Icon" src="http://www.esdrasbeleza.com/wp-content/uploads/2011/07/Automator_Icon.png" alt="" width="297" height="297" /></p>
<p>The idea was: <em>every time a new .torrent file is written at my laptop&#8217;s download directory, it should be copied to my home server</em>.</p>
<p>So I opened Automator and created a new <strong>Folder Action:</strong></p>
<p><strong></strong><a href="http://www.esdrasbeleza.com/wp-content/uploads/2011/07/Screen-shot-2011-07-09-at-16.24.05.png"><img class="aligncenter size-medium wp-image-300" title="Folder action" src="http://www.esdrasbeleza.com/wp-content/uploads/2011/07/Screen-shot-2011-07-09-at-16.24.05-300x278.png" alt="" width="300" height="278" /></a></p>
<p>At the top of the new workflow, I selected my Downloads folder:</p>
<p style="text-align: center;"><img class="aligncenter size-full wp-image-301" title="Select folder" src="http://www.esdrasbeleza.com/wp-content/uploads/2011/07/select_folder.png" alt="" width="467" height="36" /></p>
<p style="text-align: left;"> The next step in our flow is to create a script to copy our files via SSH to the computer that&#8217;s running Transmission. Use <strong>Utilities -&gt; Run Shell Script</strong> to make it:</p>
<p style="text-align: center;"><a href="http://www.esdrasbeleza.com/wp-content/uploads/2011/07/run_script.png"><img class="aligncenter size-full wp-image-302" style="border: 1px solid black;" title="Run Shell Script" src="http://www.esdrasbeleza.com/wp-content/uploads/2011/07/run_script.png" alt="" width="380" height="506" /></a></p>
<p style="text-align: left;">Now add the following content as the script&#8217;s source code. To make it work automatically, <a title="SSH without password!" href="http://www.thegeekstuff.com/2008/11/3-steps-to-perform-ssh-login-without-password-using-ssh-keygen-ssh-copy-id/" target="_blank">I allow my SSH server to receive connections using keys, not passwords</a>. Don&#8217;t forget to change the scp&#8217;s destination to your computer&#8217;s host and directory:</p>
<pre class="brush: bash; title: ; notranslate">
for f in &quot;$@&quot;
do
	ext=`basename &quot;$f&quot; | awk -F &quot;.&quot; '{ print $NF }'`
	if [ &quot;$ext&quot; == &quot;torrent&quot; ]; then
		scp &quot;$f&quot; root@myhostname.asdf.com:/home/transmission/watch
	fi
done
</pre>
<p>That&#8217;s it! Save your workflow and test it. Now, every time you click at a torrent file and download it, Transmission will download it automatically.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.esdrasbeleza.com/2011/07/09/using-automator-to-make-your-life-with-transmission-easier/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Listing the packages on Debian/Ubuntu in one line</title>
		<link>http://www.esdrasbeleza.com/2011/02/04/listing-the-packages-on-debianubuntu-in-one-line/</link>
		<comments>http://www.esdrasbeleza.com/2011/02/04/listing-the-packages-on-debianubuntu-in-one-line/#comments</comments>
		<pubDate>Fri, 04 Feb 2011 19:19:10 +0000</pubDate>
		<dc:creator>Esdras Beleza</dc:creator>
				<category><![CDATA[Tools]]></category>
		<category><![CDATA[Debian]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Shell]]></category>
		<category><![CDATA[Sysadmin]]></category>
		<category><![CDATA[Ubuntu]]></category>

		<guid isPermaLink="false">http://www.esdrasbeleza.com/?p=262</guid>
		<description><![CDATA[You can use dpkg to list all the packages that are selected on your Debian or Ubuntu system: But today I needed a way to list only the installed packages in just one line, so I could copy their names and use apt-get to install the same packages on another system. So I used the [...]]]></description>
			<content:encoded><![CDATA[<p>You can use dpkg to list all the packages that are selected on your Debian or Ubuntu system:</p>
<pre class="brush: plain; title: ; notranslate"># dpkg --get-selections</pre>
<p>But today I needed a way to list only the installed packages in just one line, so I could copy their names and use apt-get to install the same packages on another system. So I used the following command:</p>
<pre class="brush: plain; title: ; notranslate"># dpkg --get-selections | grep &quot;[ \t]*install$&quot; | sed 's/[ \t]*install$//g' | awk 'BEGIN { packages = &quot;&quot; } { packages = packages &quot; &quot; $1 } END { print packages }'
acpi-support-base acpid adduser apt apt-utils [...] long list of packages [...] xsltproc xz-utils yelp zenity zlib1g zlib1g-dev</pre>
<p>You can use the output above to easily install the same packages on another system using <em>apt-get install &lt;packages&gt;</em>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.esdrasbeleza.com/2011/02/04/listing-the-packages-on-debianubuntu-in-one-line/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Baixando pacotes pré-compilados no FreeBSD</title>
		<link>http://www.esdrasbeleza.com/2010/03/17/baixando-pacotes-pre-compilados-no-freebsd/</link>
		<comments>http://www.esdrasbeleza.com/2010/03/17/baixando-pacotes-pre-compilados-no-freebsd/#comments</comments>
		<pubDate>Wed, 17 Mar 2010 16:43:03 +0000</pubDate>
		<dc:creator>Esdras Beleza</dc:creator>
				<category><![CDATA[Tools]]></category>
		<category><![CDATA[FreeBSD]]></category>
		<category><![CDATA[Gerenciamento de pacotes]]></category>
		<category><![CDATA[Shell]]></category>
		<category><![CDATA[Sysadmin]]></category>

		<guid isPermaLink="false">http://www.esdrasbeleza.com/?p=79</guid>
		<description><![CDATA[Após instalar o FreeBSD 8.0 no meu modesto computador para tarefas rotineiras, veio a necessidade de instalar alguns pacotes. O FreeBSD tem duas modalidades de instalação de pacotes: O sistema de ports, que automatiza a tarefa de baixar código-fonte e compilá-lo, além de adaptar alguns pacotes ao seu gosto: o sistema ajuda você a habilitar [...]]]></description>
			<content:encoded><![CDATA[<p>Após instalar o FreeBSD 8.0 no meu <a href="http://www.esdrasbeleza.com/2010/03/13/73/" target="_blank">modesto computador para tarefas rotineiras</a>, veio a necessidade de instalar alguns pacotes. O FreeBSD tem duas modalidades de instalação de pacotes:</p>
<ul>
<li>O sistema de ports, que automatiza a tarefa de baixar código-fonte e compilá-lo, além de adaptar alguns pacotes ao seu gosto: o sistema ajuda você a habilitar ou desabilitar opções de vários pacotes, como suporte a Unicode, X11, bibliotecas adicionais etc.</li>
<li>Pacotes binários pré-compilados, familiares pra quem vem do Linux (como eu).</li>
</ul>
<p>O FreeBSD possui uma ferramenta simpática chamada <strong>pkg_add</strong> que lembra o <strong>apt-get</strong>, <strong>pacman</strong> ou <strong>yum</strong> do Linux, baixando pacotes nos repositórios do FreeBSD. Porém, ao pedir pro pkg_add instalar alguns pacotes, como o Transmission, ele instalou versões mais antigas. Fuçando no FTP do FreeBSD, achei pacotes mais recentes dos pacotes. A próxima briga foi pra fazer o pkg_add usar apenas esses pacotes mais novos (dum diretório amigavelmente chamado <em>Latest</em>).</p>
<p>O truque é simples: quando você executa <em><strong>pkg_add -r nomedopacote</strong></em>, o pkg_add busca por <strong>$PACKAGESITE/nomedopacote.tbz</strong>. Se você fuçar pelos diretórios dos mirrors do FreeBSD vai perceber que os pacotes normalmente se chamam <em>nomedopacote-versão.tbz</em>, exceto os do diretório Latest, que instalam automaticamente a última versão disponível. Nos comandos abaixo, reparem que usei o sistema para arquitetura 64 bits (amd64), se sua instalação for para x86 32 bits, troque <em>amd64</em> por <em>i386</em>.</p>
<p>Assim, pra instalar o vim, usei o seguinte comando no bash:</p>
<pre class="brush: plain; light: true; title: ; wrap-lines: false; notranslate">[root@tinhoso /home/esdras]# export PACKAGESITE=&quot;ftp://ftp4.freebsd.org/pub/FreeBSD/ports/amd64/packages-8-stable/Latest/&quot;
[root@tinhoso /home/esdras]# pkg_add -r vim</pre>
<p>Você pode, ainda, acrescentar o comando do export no seu arquivo <em>~/.profile</em>, o que fará o comando ser executado automaticamente a cada login:</p>
<pre class="brush: plain; light: true; title: ; wrap-lines: false; notranslate">[root@tinhoso ~]# echo export PACKAGESITE=\&quot;ftp://ftp4.freebsd.org/pub/FreeBSD/ports/amd64/packages-8-stable/Latest/\&quot; &amp;gt;&amp;gt; ~/.profile</pre>
<p>Caso você use csh (shell padrão no FreeBSD!), o comando muda:</p>
<pre class="brush: plain; light: true; title: ; wrap-lines: false; notranslate">tinhoso# setenv PACKAGESITE ftp://ftp4.freebsd.org/pub/FreeBSD/ports/amd64/packages-8-stable/Latest/
tinhoso# pkg_add -r nano</pre>
<div>Para tornar a variável permanente, acrescente esse comando no arquivo <em>~/.cshrc:</em></div>
<div><em><br />
</em></div>
<div><em><em>
<pre class="brush: plain; light: true; title: ; wrap-lines: false; notranslate">tinhoso# echo setenv PACKAGESITE ftp://ftp4.freebsd.org/pub/FreeBSD/ports/amd64/packages-8-stable/Latest/ &gt;&gt; ~/.cshrc</pre>
<p></em></em></div>
<h1>Fontes</h1>
<ul>
<li><a href="http://www.freebsd.org/doc/handbook/ports.html" target="_blank">Manua﻿l do FreeBSD</a></li>
<li><a href="http://it.toolbox.com/blogs/bsd-guru/some-freebsd-pkg_add-magic-18897" target="_blank">Some FreeBSD pkg_add magic</a></li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://www.esdrasbeleza.com/2010/03/17/baixando-pacotes-pre-compilados-no-freebsd/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

<!-- Dynamic Page Served (once) in 0.552 seconds -->

