<?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>fabiolagana.net &#187; bash</title>
	<atom:link href="http://blog.fabiolagana.net/category/linux/bash/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.fabiolagana.net</link>
	<description>640 Kb should be enough memory for anybody</description>
	<lastBuildDate>Mon, 26 Oct 2009 13:17:04 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Spamhaus droplist</title>
		<link>http://blog.fabiolagana.net/spamhaus-droplist/</link>
		<comments>http://blog.fabiolagana.net/spamhaus-droplist/#comments</comments>
		<pubDate>Wed, 29 Apr 2009 07:55:39 +0000</pubDate>
		<dc:creator>Fabio Laganà</dc:creator>
				<category><![CDATA[Debian]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Shell]]></category>
		<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[bash]]></category>
		<category><![CDATA[droplist]]></category>
		<category><![CDATA[sed]]></category>
		<category><![CDATA[spam]]></category>
		<category><![CDATA[spamhaus]]></category>

		<guid isPermaLink="false">http://blog.fabiolagana.net/?p=148</guid>
		<description><![CDATA[


&#160;Powered by Max Banner Ads&#160;
#!/bin/bash
&#160;
#Script to add firewall rules to a linux system to completely block
#all traffic to and from networks in the spamhaus drop list.
&#160;
#Copyright 2009, William Stearns, wstearns@pobox.com
#Released under the GPL.  This and other tools can be found at
#http://www.stearns.org/
&#160;
#Sole (optional) command line parameter is the file location of the
#drop list, such as:
&#160;
#cd [...]]]></description>
			<content:encoded><![CDATA[
<div class="wp_codebox"><table><tr id="p1482"><td class="code" id="p148code2"><pre class="bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;">#!/bin/bash</span>
&nbsp;
<span style="color: #666666; font-style: italic;">#Script to add firewall rules to a linux system to completely block</span>
<span style="color: #666666; font-style: italic;">#all traffic to and from networks in the spamhaus drop list.</span>
&nbsp;
<span style="color: #666666; font-style: italic;">#Copyright 2009, William Stearns, wstearns@pobox.com</span>
<span style="color: #666666; font-style: italic;">#Released under the GPL.  This and other tools can be found at</span>
<span style="color: #666666; font-style: italic;">#http://www.stearns.org/</span>
&nbsp;
<span style="color: #666666; font-style: italic;">#Sole (optional) command line parameter is the file location of the</span>
<span style="color: #666666; font-style: italic;">#drop list, such as:</span>
&nbsp;
<span style="color: #666666; font-style: italic;">#cd /var/lib/</span>
<span style="color: #666666; font-style: italic;">#wget http://www.spamhaus.org/drop/drop.lasso</span>
<span style="color: #666666; font-style: italic;"># ./spamhaus-drop /var/lib/drop.lasso</span>
&nbsp;
<span style="color: #666666; font-style: italic;">#While the DROP file should be regularly updated, this should</span>
<span style="color: #666666; font-style: italic;">#probably be about once per day or less frequently; do _not_</span>
<span style="color: #666666; font-style: italic;">#download DROP more than once an hour.</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">if</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #660033;">-n</span> <span style="color: #ff0000;">&quot;$1&quot;</span> <span style="color: #7a0874; font-weight: bold;">&#93;</span>; <span style="color: #000000; font-weight: bold;">then</span>
	<span style="color: #007800;">DropList</span>=<span style="color: #ff0000;">&quot;$1&quot;</span>
<span style="color: #000000; font-weight: bold;">else</span>
	<span style="color: #007800;">DropList</span>=<span style="color: #ff0000;">&quot;./drop.lasso&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;">&#91;</span> <span style="color: #000000; font-weight: bold;">!</span> <span style="color: #660033;">-s</span> <span style="color: #ff0000;">&quot;<span style="color: #007800;">$DropList</span>&quot;</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;Unable to find drop list file <span style="color: #007800;">$DropList</span> .  Perhaps do:&quot;</span> <span style="color: #000000; font-weight: bold;">&gt;&amp;</span>2
	<span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;wget http://www.spamhaus.org/drop/drop.lasso -O <span style="color: #007800;">$DropList</span>&quot;</span>
	<span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;exiting.&quot;</span> <span style="color: #000000; font-weight: bold;">&gt;&amp;</span>2
	<span style="color: #7a0874; font-weight: bold;">exit</span> 1
<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;">&#91;</span> <span style="color: #000000; font-weight: bold;">!</span> <span style="color: #660033;">-x</span> <span style="color: #000000; font-weight: bold;">/</span>sbin<span style="color: #000000; font-weight: bold;">/</span>iptables <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;Missing iptables command line tool, exiting.&quot;</span> <span style="color: #000000; font-weight: bold;">&gt;&amp;</span>2
	<span style="color: #7a0874; font-weight: bold;">exit</span> 1
<span style="color: #000000; font-weight: bold;">fi</span>
&nbsp;
<span style="color: #c20cb9; font-weight: bold;">cat</span> <span style="color: #ff0000;">&quot;<span style="color: #007800;">$DropList</span>&quot;</span> \
 <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">sed</span> <span style="color: #660033;">-e</span> <span style="color: #ff0000;">'s/;.*//'</span> \
 <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">grep</span> <span style="color: #660033;">-v</span> <span style="color: #ff0000;">'^ *$'</span> \
 <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #000000; font-weight: bold;">while</span> <span style="color: #c20cb9; font-weight: bold;">read</span> OneNetBlock ; <span style="color: #000000; font-weight: bold;">do</span>
	<span style="color: #000000; font-weight: bold;">/</span>sbin<span style="color: #000000; font-weight: bold;">/</span>iptables <span style="color: #660033;">-I</span> INPUT <span style="color: #660033;">-s</span> <span style="color: #ff0000;">&quot;<span style="color: #007800;">$OneNetBlock</span>&quot;</span> <span style="color: #660033;">-j</span> DROP
	<span style="color: #000000; font-weight: bold;">/</span>sbin<span style="color: #000000; font-weight: bold;">/</span>iptables <span style="color: #660033;">-I</span> OUTPUT <span style="color: #660033;">-d</span> <span style="color: #ff0000;">&quot;<span style="color: #007800;">$OneNetBlock</span>&quot;</span> <span style="color: #660033;">-j</span> DROP
	<span style="color: #000000; font-weight: bold;">/</span>sbin<span style="color: #000000; font-weight: bold;">/</span>iptables <span style="color: #660033;">-I</span> FORWARD <span style="color: #660033;">-s</span> <span style="color: #ff0000;">&quot;<span style="color: #007800;">$OneNetBlock</span>&quot;</span> <span style="color: #660033;">-j</span> DROP
	<span style="color: #000000; font-weight: bold;">/</span>sbin<span style="color: #000000; font-weight: bold;">/</span>iptables <span style="color: #660033;">-I</span> FORWARD <span style="color: #660033;">-d</span> <span style="color: #ff0000;">&quot;<span style="color: #007800;">$OneNetBlock</span>&quot;</span> <span style="color: #660033;">-j</span> DROP
<span style="color: #000000; font-weight: bold;">done</span></pre></td></tr></table></div>

]]></content:encoded>
			<wfw:commentRss>http://blog.fabiolagana.net/spamhaus-droplist/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Eseguire il backup delle directory di un server</title>
		<link>http://blog.fabiolagana.net/eseguire-backup-directory-server/</link>
		<comments>http://blog.fabiolagana.net/eseguire-backup-directory-server/#comments</comments>
		<pubDate>Tue, 28 Apr 2009 08:01:22 +0000</pubDate>
		<dc:creator>Fabio Laganà</dc:creator>
				<category><![CDATA[Debian]]></category>
		<category><![CDATA[Shell]]></category>
		<category><![CDATA[backup]]></category>
		<category><![CDATA[bash]]></category>
		<category><![CDATA[hosts]]></category>
		<category><![CDATA[ip]]></category>

		<guid isPermaLink="false">http://blog.fabiolagana.net/?p=129</guid>
		<description><![CDATA[nome script: /usr/local/sbin/backup_dir.sh

descrizione: Con questo script viene fatto il backup delle directory importanti server

Inserendo una riga simile nel cron scheduliamo il backup tutte le notti]]></description>
			<content:encoded><![CDATA[<p>nome script: /usr/local/sbin/backup_dir.sh</p>
<p>descrizione: Con questo script viene fatto il backup delle directory importanti  server</p>
<p>Inserendo una riga simile nel cron scheduliamo il backup tutte le notti</p>
<pre id="area">cat /etc/cron.d/backup
MAILTO="postmaster@yourdomain.com"
00 21 * * * root test -x /usr/local/sbin/backup_dir.sh &#038;&#038; /usr/local/sbin/backup_dir.sh</pre>

<div class="wp_codebox"><table><tr id="p1293"><td class="code" id="p129code3"><pre class="bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;">#!/bin/bash</span>
<span style="color: #666666; font-style: italic;">#</span>
<span style="color: #666666; font-style: italic;"># backup_dir.sh</span>
<span style="color: #666666; font-style: italic;"># Con questo script viene fatto il backup delle directory importanti  server</span>
<span style="color: #666666; font-style: italic;">#</span>
<span style="color: #007800;">hosts_internal</span>=<span style="color: #7a0874; font-weight: bold;">&#40;</span> your_host <span style="color: #7a0874; font-weight: bold;">&#41;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">for</span> host <span style="color: #000000; font-weight: bold;">in</span> <span style="color: #800000;">${hosts_internal[@]}</span>
<span style="color: #000000; font-weight: bold;">do</span>
  <span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;Download of /etc/ /usr/local/sbin/ /root/ /home/ directory from &quot;</span><span style="color: #007800;">$host</span><span style="color: #ff0000;">&quot; &quot;</span>
  <span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #660033;">-n</span> <span style="color: #ff0000;">&quot;Starting ------&gt;&quot;</span>
  <span style="color: #c20cb9; font-weight: bold;">date</span>
  <span style="color: #666666; font-style: italic;"># bakup file for hosts</span>
  <span style="color: #c20cb9; font-weight: bold;">tar</span> <span style="color: #660033;">-zcvf</span> <span style="color: #000000; font-weight: bold;">/</span>var<span style="color: #000000; font-weight: bold;">/</span>backups<span style="color: #000000; font-weight: bold;">/</span>backup_files_<span style="color: #ff0000;">&quot;<span style="color: #007800;">$host</span>&quot;</span>_<span style="color: #000000; font-weight: bold;">`</span><span style="color: #c20cb9; font-weight: bold;">date</span> +<span style="color: #ff0000;">&quot;%d%m%Y&quot;</span><span style="color: #000000; font-weight: bold;">`</span>.tar.gz <span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</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>sbin<span style="color: #000000; font-weight: bold;">/</span> <span style="color: #000000; font-weight: bold;">/</span>root<span style="color: #000000; font-weight: bold;">/</span> <span style="color: #000000; font-weight: bold;">/</span>home<span style="color: #000000; font-weight: bold;">/</span> ;
  <span style="color: #c20cb9; font-weight: bold;">mv</span> <span style="color: #000000; font-weight: bold;">/</span>var<span style="color: #000000; font-weight: bold;">/</span>backups<span style="color: #000000; font-weight: bold;">/</span>backup_files_<span style="color: #ff0000;">&quot;<span style="color: #007800;">$host</span>&quot;</span>_<span style="color: #000000; font-weight: bold;">`</span><span style="color: #c20cb9; font-weight: bold;">date</span> +<span style="color: #ff0000;">&quot;%d%m%Y&quot;</span><span style="color: #000000; font-weight: bold;">`</span>.tar.gz <span style="color: #000000; font-weight: bold;">/</span>backups<span style="color: #000000; font-weight: bold;">/</span><span style="color: #ff0000;">&quot;<span style="color: #007800;">$host</span>&quot;</span><span style="color: #000000; font-weight: bold;">/</span>;
  <span style="color: #c20cb9; font-weight: bold;">rm</span> <span style="color: #660033;">-f</span> <span style="color: #000000; font-weight: bold;">/</span>var<span style="color: #000000; font-weight: bold;">/</span>backups<span style="color: #000000; font-weight: bold;">/</span>backup_files_<span style="color: #ff0000;">&quot;<span style="color: #007800;">$host</span>&quot;</span>_<span style="color: #000000; font-weight: bold;">`</span><span style="color: #c20cb9; font-weight: bold;">date</span> +<span style="color: #ff0000;">&quot;%d%m%Y&quot;</span><span style="color: #000000; font-weight: bold;">`</span>.tar.gz
  <span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #660033;">-n</span> <span style="color: #ff0000;">&quot;Stopping ------&gt;&quot;</span>
  <span style="color: #c20cb9; font-weight: bold;">date</span>
  <span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;&quot;</span>
<span style="color: #000000; font-weight: bold;">done</span></pre></td></tr></table></div>

]]></content:encoded>
			<wfw:commentRss>http://blog.fabiolagana.net/eseguire-backup-directory-server/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Count domain in mail.log (Qmail)</title>
		<link>http://blog.fabiolagana.net/count-domain-maillog-qmail/</link>
		<comments>http://blog.fabiolagana.net/count-domain-maillog-qmail/#comments</comments>
		<pubDate>Fri, 20 Feb 2009 05:34:56 +0000</pubDate>
		<dc:creator>Fabio Laganà</dc:creator>
				<category><![CDATA[Debian]]></category>
		<category><![CDATA[Mailserver]]></category>
		<category><![CDATA[Qmail]]></category>
		<category><![CDATA[Shell]]></category>
		<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[awk]]></category>
		<category><![CDATA[bash]]></category>
		<category><![CDATA[mail.log]]></category>

		<guid isPermaLink="false">http://blog.fabiolagana.net/?p=116</guid>
		<description><![CDATA[
# cat /usr/local/sbin/count_mail_per_domain.sh
#!/bin/bash
logfile=$2
domain=$3
&#160;
case &#34;$1&#34; in
        -t&#41;
	cat $logfile &#124;grep &#34;to remote&#34; &#124; awk '{print $14}'
					&#124; awk -F@ '{ field = $2 }; {print &#34;domain: &#34; field }'
					&#124; sort &#124;uniq -c &#124;sort -nr
					&#124; awk -v totale=0 '{totale=totale+$1; print ;} END {print &#34;Totale giorno domini: &#34;totale;}'
      [...]]]></description>
			<content:encoded><![CDATA[
<div class="wp_codebox"><table><tr id="p1165"><td class="code" id="p116code5"><pre class="bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;"># cat /usr/local/sbin/count_mail_per_domain.sh</span>
<span style="color: #666666; font-style: italic;">#!/bin/bash</span>
<span style="color: #007800;">logfile</span>=$2
<span style="color: #007800;">domain</span>=$3
&nbsp;
<span style="color: #000000; font-weight: bold;">case</span> <span style="color: #ff0000;">&quot;$1&quot;</span> <span style="color: #000000; font-weight: bold;">in</span>
        -t<span style="color: #7a0874; font-weight: bold;">&#41;</span>
	<span style="color: #c20cb9; font-weight: bold;">cat</span> <span style="color: #007800;">$logfile</span> <span style="color: #000000; font-weight: bold;">|</span><span style="color: #c20cb9; font-weight: bold;">grep</span> <span style="color: #ff0000;">&quot;to remote&quot;</span> <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">awk</span> <span style="color: #ff0000;">'{print $14}'</span>
					<span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">awk</span> -F<span style="color: #000000; font-weight: bold;">@</span> <span style="color: #ff0000;">'{ field = $2 }; {print &quot;domain: &quot; field }'</span>
					<span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">sort</span> <span style="color: #000000; font-weight: bold;">|</span><span style="color: #c20cb9; font-weight: bold;">uniq</span> <span style="color: #660033;">-c</span> <span style="color: #000000; font-weight: bold;">|</span><span style="color: #c20cb9; font-weight: bold;">sort</span> <span style="color: #660033;">-nr</span>
					<span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">awk</span> <span style="color: #660033;">-v</span> <span style="color: #007800;">totale</span>=<span style="color: #000000;">0</span> <span style="color: #ff0000;">'{totale=totale+$1; print ;} END {print &quot;Totale giorno domini: &quot;totale;}'</span>
            <span style="color: #000000; font-weight: bold;">;;</span>
&nbsp;
        -su<span style="color: #7a0874; font-weight: bold;">&#41;</span>
	<span style="color: #c20cb9; font-weight: bold;">cat</span> <span style="color: #007800;">$logfile</span> <span style="color: #000000; font-weight: bold;">|</span><span style="color: #c20cb9; font-weight: bold;">grep</span> <span style="color: #ff0000;">&quot;to remote&quot;</span>  <span style="color: #000000; font-weight: bold;">|</span><span style="color: #c20cb9; font-weight: bold;">grep</span> <span style="color: #660033;">-i</span> <span style="color: #ff0000;">&quot;<span style="color: #007800;">$domain</span>&quot;</span>
					<span style="color: #000000; font-weight: bold;">|</span><span style="color: #c20cb9; font-weight: bold;">awk</span> <span style="color: #ff0000;">' { field = $14 }; {print &quot;to remote: &quot; field }'</span>
					<span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">sort</span><span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">uniq</span> -c<span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">sort</span> <span style="color: #660033;">-nr</span>
					<span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">awk</span> <span style="color: #660033;">-v</span> <span style="color: #007800;">totale</span>=<span style="color: #000000;">0</span> <span style="color: #ff0000;">'{totale=totale+$1; print ;} END {print &quot;Totale giorno domini per utente: &quot;totale;}'</span>
            <span style="color: #000000; font-weight: bold;">;;</span>
	-s<span style="color: #7a0874; font-weight: bold;">&#41;</span>
        <span style="color: #c20cb9; font-weight: bold;">cat</span> <span style="color: #007800;">$logfile</span> <span style="color: #000000; font-weight: bold;">|</span><span style="color: #c20cb9; font-weight: bold;">grep</span> <span style="color: #ff0000;">&quot;to remote&quot;</span>  <span style="color: #000000; font-weight: bold;">|</span><span style="color: #c20cb9; font-weight: bold;">grep</span> <span style="color: #660033;">-i</span> <span style="color: #ff0000;">&quot;<span style="color: #007800;">$domain</span>&quot;</span> <span style="color: #000000; font-weight: bold;">|</span><span style="color: #c20cb9; font-weight: bold;">awk</span> <span style="color: #ff0000;">'{print $14}'</span>
                                        <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">awk</span> -F<span style="color: #000000; font-weight: bold;">@</span> <span style="color: #ff0000;">'{ field = $2 }; {print &quot;to remote domain: &quot; field }'</span>
                                        <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">sort</span><span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">uniq</span> -c<span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">sort</span> <span style="color: #660033;">-nr</span>
                                        <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">awk</span> <span style="color: #660033;">-v</span> <span style="color: #007800;">totale</span>=<span style="color: #000000;">0</span> <span style="color: #ff0000;">'{totale=totale+$1; print ;} END {print &quot;Totale giorno domini: &quot;totale;}'</span>
&nbsp;
         <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: #7a0874; font-weight: bold;">echo</span> $<span style="color: #ff0000;">&quot;Usage: $0 { -t /var/log/mail.log.0 }  for print total mail for domain &quot;</span>
            <span style="color: #7a0874; font-weight: bold;">echo</span> $<span style="color: #ff0000;">&quot;Usage: $0 { -su /var/log/mail.log.0 domain.com } for print total mail for single domain per user&quot;</span>
            <span style="color: #7a0874; font-weight: bold;">echo</span> $<span style="color: #ff0000;">&quot;Usage: $0 { -s /var/log/mail.log.0 domain.com } for print total mail for single domain&quot;</span>
            <span style="color: #7a0874; font-weight: bold;">exit</span> 1
&nbsp;
<span style="color: #000000; font-weight: bold;">esac</span></pre></td></tr></table></div>

<p>for more tips visit <a title="qmail relay to smarthost" href="http://www.nixtips.net/qmail-relay-to-smarthost/" target="_blank" onclick="pageTracker._trackPageview('/outgoing/www.nixtips.net/qmail-relay-to-smarthost/?referer=');">qmail relay to smarthost</a></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.fabiolagana.net/count-domain-maillog-qmail/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Creating an SSL-certificate for my webserver</title>
		<link>http://blog.fabiolagana.net/creating-ssl-certificate-webserver/</link>
		<comments>http://blog.fabiolagana.net/creating-ssl-certificate-webserver/#comments</comments>
		<pubDate>Wed, 12 Nov 2008 10:13:39 +0000</pubDate>
		<dc:creator>Fabio Laganà</dc:creator>
				<category><![CDATA[Debian]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[SSL]]></category>
		<category><![CDATA[bash]]></category>
		<category><![CDATA[certificates]]></category>
		<category><![CDATA[Howto]]></category>
		<category><![CDATA[webserver]]></category>

		<guid isPermaLink="false">http://blog.fabiolagana.net/?p=107</guid>
		<description><![CDATA[
#!/bin/sh
SERVER=ssl.mioserverweb.dominio
PRIVATE_KEY=$SERVER.private.key
CERTIFICATE_FILE=$SERVER.crt
VALID_DAYS=365
&#160;
echo Delete old private key
rm $PRIVATE_KEY
echo Create new private/public-keys without passphrase for server
openssl genrsa -out $PRIVATE_KEY 2048
&#160;
echo Create selfsigned certificate
rm $CERTIFICATE_FILE
# From man req:
#  -x509
#    this option outputs a self signed certificate instead
#    of a certificate request. This is typically used to
#    generate a test [...]]]></description>
			<content:encoded><![CDATA[
<div class="wp_codebox"><table><tr id="p1077"><td class="code" id="p107code7"><pre class="bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;">#!/bin/sh</span>
<span style="color: #007800;">SERVER</span>=ssl.mioserverweb.dominio
<span style="color: #007800;">PRIVATE_KEY</span>=<span style="color: #007800;">$SERVER</span>.private.key
<span style="color: #007800;">CERTIFICATE_FILE</span>=<span style="color: #007800;">$SERVER</span>.crt
<span style="color: #007800;">VALID_DAYS</span>=365
&nbsp;
<span style="color: #7a0874; font-weight: bold;">echo</span> Delete old private key
<span style="color: #c20cb9; font-weight: bold;">rm</span> <span style="color: #007800;">$PRIVATE_KEY</span>
<span style="color: #7a0874; font-weight: bold;">echo</span> Create new private<span style="color: #000000; font-weight: bold;">/</span>public-keys without passphrase <span style="color: #000000; font-weight: bold;">for</span> server
openssl genrsa <span style="color: #660033;">-out</span> <span style="color: #007800;">$PRIVATE_KEY</span> 2048
&nbsp;
<span style="color: #7a0874; font-weight: bold;">echo</span> Create selfsigned certificate
<span style="color: #c20cb9; font-weight: bold;">rm</span> <span style="color: #007800;">$CERTIFICATE_FILE</span>
<span style="color: #666666; font-style: italic;"># From man req:</span>
<span style="color: #666666; font-style: italic;">#  -x509</span>
<span style="color: #666666; font-style: italic;">#    this option outputs a self signed certificate instead</span>
<span style="color: #666666; font-style: italic;">#    of a certificate request. This is typically used to</span>
<span style="color: #666666; font-style: italic;">#    generate a test certificate or a self signed root CA.</span>
<span style="color: #666666; font-style: italic;">#    The extensions added to the certificate (if any) are</span>
<span style="color: #666666; font-style: italic;">#    specified in the configuration file.</span>
&nbsp;
openssl req <span style="color: #660033;">-new</span> 
        <span style="color: #660033;">-days</span> <span style="color: #007800;">$VALID_DAYS</span> 
        <span style="color: #660033;">-key</span> <span style="color: #007800;">$PRIVATE_KEY</span> 
        <span style="color: #660033;">-x509</span> 
        <span style="color: #660033;">-out</span> <span style="color: #007800;">$CERTIFICATE_FILE</span>
&nbsp;
<span style="color: #7a0874; font-weight: bold;">echo</span> private-keyfile is <span style="color: #007800;">$PRIVATE_KEY</span>
<span style="color: #7a0874; font-weight: bold;">echo</span> server-certificate-file is <span style="color: #007800;">$CERTIFICATE_FILE</span>
&nbsp;
<span style="color: #c20cb9; font-weight: bold;">ls</span> <span style="color: #660033;">-l</span> <span style="color: #007800;">$PRIVATE_KEY</span> <span style="color: #007800;">$CERTIFICATE_FILE</span></pre></td></tr></table></div>

]]></content:encoded>
			<wfw:commentRss>http://blog.fabiolagana.net/creating-ssl-certificate-webserver/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Update Expired SSL Certs</title>
		<link>http://blog.fabiolagana.net/update-expired-ssl-certs/</link>
		<comments>http://blog.fabiolagana.net/update-expired-ssl-certs/#comments</comments>
		<pubDate>Wed, 29 Oct 2008 11:17:06 +0000</pubDate>
		<dc:creator>Fabio Laganà</dc:creator>
				<category><![CDATA[SSL]]></category>
		<category><![CDATA[bash]]></category>
		<category><![CDATA[certificats]]></category>
		<category><![CDATA[Debian]]></category>
		<category><![CDATA[Linux]]></category>

		<guid isPermaLink="false">http://blog.fabiolagana.net/?p=98</guid>
		<description><![CDATA[
- Farsi una copia del vecchio certificato
cd /etc/ssl/certs
cp -ap pop3ss.pem pop3s.pem.scaduto
&#160;
- Ricreazione nuovo certificato
cd /etc/ssl
openssl req -new -x509 -nodes -days 3650 -newkey rsa:1024 -keyout private/pop3s.key -out pop3s.cert
touch certs/pop3s-new.pem
chmod 600 certs/pop3s-new.pem
cat private/pop3s.key pop3s.cert &#62; certs/pop3s-new.pem
dd if=/dev/urandom count=2 &#124; openssl dhparam -rand - 512
pico certs/pop3s-new.pem
chown vpopmail certs/pop3s-new.pem
cd certs
mv pop3s-new.pem pop3s.pem
&#160;
-- rollback in caso qualcosa andasse storto --
mv [...]]]></description>
			<content:encoded><![CDATA[
<div class="wp_codebox"><table><tr id="p989"><td class="code" id="p98code9"><pre class="bash" style="font-family:monospace;">- Farsi una copia del vecchio certificato
<span style="color: #7a0874; font-weight: bold;">cd</span> <span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>ssl<span style="color: #000000; font-weight: bold;">/</span>certs
<span style="color: #c20cb9; font-weight: bold;">cp</span> <span style="color: #660033;">-ap</span> pop3ss.pem pop3s.pem.scaduto
&nbsp;
- Ricreazione nuovo certificato
<span style="color: #7a0874; font-weight: bold;">cd</span> <span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>ssl
openssl req <span style="color: #660033;">-new</span> <span style="color: #660033;">-x509</span> <span style="color: #660033;">-nodes</span> <span style="color: #660033;">-days</span> 3650 <span style="color: #660033;">-newkey</span> rsa:1024 <span style="color: #660033;">-keyout</span> private<span style="color: #000000; font-weight: bold;">/</span>pop3s.key <span style="color: #660033;">-out</span> pop3s.cert
<span style="color: #c20cb9; font-weight: bold;">touch</span> certs<span style="color: #000000; font-weight: bold;">/</span>pop3s-new.pem
<span style="color: #c20cb9; font-weight: bold;">chmod</span> 600 certs<span style="color: #000000; font-weight: bold;">/</span>pop3s-new.pem
<span style="color: #c20cb9; font-weight: bold;">cat</span> private<span style="color: #000000; font-weight: bold;">/</span>pop3s.key pop3s.cert <span style="color: #000000; font-weight: bold;">&gt;</span> certs<span style="color: #000000; font-weight: bold;">/</span>pop3s-new.pem
<span style="color: #c20cb9; font-weight: bold;">dd</span> <span style="color: #000000; font-weight: bold;">if</span>=<span style="color: #000000; font-weight: bold;">/</span>dev<span style="color: #000000; font-weight: bold;">/</span>urandom <span style="color: #007800;">count</span>=2 <span style="color: #000000; font-weight: bold;">|</span> openssl dhparam <span style="color: #660033;">-rand</span> - 512
pico certs<span style="color: #000000; font-weight: bold;">/</span>pop3s-new.pem
<span style="color: #c20cb9; font-weight: bold;">chown</span> vpopmail certs<span style="color: #000000; font-weight: bold;">/</span>pop3s-new.pem
<span style="color: #7a0874; font-weight: bold;">cd</span> certs
<span style="color: #c20cb9; font-weight: bold;">mv</span> pop3s-new.pem pop3s.pem
&nbsp;
<span style="color: #660033;">--</span> rollback <span style="color: #000000; font-weight: bold;">in</span> caso qualcosa andasse storto <span style="color: #660033;">--</span>
<span style="color: #c20cb9; font-weight: bold;">mv</span> pop3s.pem.scaduto pop3s.pem</pre></td></tr></table></div>

]]></content:encoded>
			<wfw:commentRss>http://blog.fabiolagana.net/update-expired-ssl-certs/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Bash script for checking mysql problem by reading daemon.log</title>
		<link>http://blog.fabiolagana.net/bash-script-checking-mysql-problem-by-reading-daemonlog/</link>
		<comments>http://blog.fabiolagana.net/bash-script-checking-mysql-problem-by-reading-daemonlog/#comments</comments>
		<pubDate>Wed, 06 Aug 2008 21:27:34 +0000</pubDate>
		<dc:creator>Fabio Laganà</dc:creator>
				<category><![CDATA[Debian]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Shell]]></category>
		<category><![CDATA[bash]]></category>
		<category><![CDATA[mysql]]></category>
		<category><![CDATA[daemon.log]]></category>
		<category><![CDATA[scripts]]></category>

		<guid isPermaLink="false">http://blog.fabiolagana.net/?p=48</guid>
		<description><![CDATA[
#!/bin/bash
&#160;
### Checking del daemon.log per eventuali problemi sul DB MySQL
# rel. 0.3 - 01 Agosto 2008
&#160;
# time_to_check_min=`date +&#34;%b %d %k:%M&#34; -d &#34;-1 min&#34;`
# time_to_check_hour=`date +&#34;%b %d %k:%M&#34; -d &#34;-1 hour&#34;`
file_to_check=/var/log/daemon.log
tmp_file=/tmp/info.tmp.01.$$
tmp_file1=/tmp/info.tmp.02.$$
host=`cat /etc/hostname`
semaphore=/tmp/.flag_checking_daemon_log
&#160;
daemon=mysql
&#160;
if &#91;&#91; -e $semaphore &#93;&#93;;
  then
    echo &#34;checking for mysqld....Nothing to do ....another cron is still working&#34;
  else
   [...]]]></description>
			<content:encoded><![CDATA[
<div class="wp_codebox"><table><tr id="p4811"><td class="code" id="p48code11"><pre class="bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;">#!/bin/bash</span>
&nbsp;
<span style="color: #666666; font-style: italic;">### Checking del daemon.log per eventuali problemi sul DB MySQL</span>
<span style="color: #666666; font-style: italic;"># rel. 0.3 - 01 Agosto 2008</span>
&nbsp;
<span style="color: #666666; font-style: italic;"># time_to_check_min=`date +&quot;%b %d %k:%M&quot; -d &quot;-1 min&quot;`</span>
<span style="color: #666666; font-style: italic;"># time_to_check_hour=`date +&quot;%b %d %k:%M&quot; -d &quot;-1 hour&quot;`</span>
<span style="color: #007800;">file_to_check</span>=<span style="color: #000000; font-weight: bold;">/</span>var<span style="color: #000000; font-weight: bold;">/</span>log<span style="color: #000000; font-weight: bold;">/</span>daemon.log
<span style="color: #007800;">tmp_file</span>=<span style="color: #000000; font-weight: bold;">/</span>tmp<span style="color: #000000; font-weight: bold;">/</span>info.tmp.01.<span style="color: #007800;">$$</span>
<span style="color: #007800;">tmp_file1</span>=<span style="color: #000000; font-weight: bold;">/</span>tmp<span style="color: #000000; font-weight: bold;">/</span>info.tmp.02.<span style="color: #007800;">$$</span>
<span style="color: #007800;">host</span>=<span style="color: #000000; font-weight: bold;">`</span><span style="color: #c20cb9; font-weight: bold;">cat</span> <span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span><span style="color: #c20cb9; font-weight: bold;">hostname</span><span style="color: #000000; font-weight: bold;">`</span>
<span style="color: #007800;">semaphore</span>=<span style="color: #000000; font-weight: bold;">/</span>tmp<span style="color: #000000; font-weight: bold;">/</span>.flag_checking_daemon_log
&nbsp;
<span style="color: #007800;">daemon</span>=mysql
&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;">-e</span> <span style="color: #007800;">$semaphore</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;checking for mysqld....Nothing to do ....another cron is still working&quot;</span>
  <span style="color: #000000; font-weight: bold;">else</span>
    <span style="color: #c20cb9; font-weight: bold;">touch</span> <span style="color: #007800;">$semaphore</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: #c20cb9; font-weight: bold;">date</span> +<span style="color: #ff0000;">&quot;%d&quot;</span><span style="color: #000000; font-weight: bold;">`</span> <span style="color: #000000; font-weight: bold;">&amp;</span>lt; <span style="color: #ff0000;">'10'</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;">time_to_check_min</span>=<span style="color: #000000; font-weight: bold;">`</span><span style="color: #c20cb9; font-weight: bold;">date</span> +<span style="color: #ff0000;">&quot;%b %d %k:%M&quot;</span> <span style="color: #660033;">-d</span> <span style="color: #ff0000;">&quot;-1 min&quot;</span><span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">sed</span> <span style="color: #660033;">-r</span> <span style="color: #ff0000;">'s/[[:space:]](0)([1-9])[[:space:]]/  2 /'</span><span style="color: #000000; font-weight: bold;">`</span>
    <span style="color: #007800;">time_to_check_hour</span>=<span style="color: #000000; font-weight: bold;">`</span><span style="color: #c20cb9; font-weight: bold;">date</span> +<span style="color: #ff0000;">&quot;%b %d %k:%M&quot;</span> <span style="color: #660033;">-d</span> <span style="color: #ff0000;">&quot;-1 hour&quot;</span><span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">sed</span> <span style="color: #660033;">-r</span> <span style="color: #ff0000;">'s/[[:space:]](0)([1-9])[[:space:]]/  2 /'</span><span style="color: #000000; font-weight: bold;">`</span>
<span style="color: #000000; font-weight: bold;">else</span>
    <span style="color: #007800;">time_to_check_min</span>=<span style="color: #000000; font-weight: bold;">`</span><span style="color: #c20cb9; font-weight: bold;">date</span> +<span style="color: #ff0000;">&quot;%b %d %k:%M&quot;</span> <span style="color: #660033;">-d</span> <span style="color: #ff0000;">&quot;-1 min&quot;</span><span style="color: #000000; font-weight: bold;">`</span>
    <span style="color: #007800;">time_to_check_hour</span>=<span style="color: #000000; font-weight: bold;">`</span><span style="color: #c20cb9; font-weight: bold;">date</span> +<span style="color: #ff0000;">&quot;%b %d %k:%M&quot;</span> <span style="color: #660033;">-d</span> <span style="color: #ff0000;">&quot;-1 hour&quot;</span><span style="color: #000000; font-weight: bold;">`</span>
<span style="color: #000000; font-weight: bold;">fi</span>
<span style="color: #666666; font-style: italic;">#echo &quot;checking for &quot;&quot;$file_to_check  $time_to_check_min&quot;</span>
<span style="color: #c20cb9; font-weight: bold;">grep</span> <span style="color: #ff0000;">&quot;<span style="color: #007800;">$time_to_check_min</span>&quot;</span> <span style="color: #ff0000;">&quot;<span style="color: #007800;">$file_to_check</span>&quot;</span> <span style="color: #000000; font-weight: bold;">&amp;</span>gt; <span style="color: #007800;">$tmp_file</span>
<span style="color: #c20cb9; font-weight: bold;">grep</span> <span style="color: #ff0000;">&quot;<span style="color: #007800;">$daemon</span>&quot;</span> <span style="color: #ff0000;">&quot;<span style="color: #007800;">$tmp_file</span>&quot;</span> <span style="color: #000000; font-weight: bold;">&amp;</span>gt; <span style="color: #007800;">$tmp_file1</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;">-e</span> <span style="color: #007800;">$tmp_file1</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: #660033;">-s</span> <span style="color: #007800;">$tmp_file1</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>
            mail <span style="color: #660033;">-s</span> <span style="color: #ff0000;">&quot;Something happening on [ <span style="color: #007800;">$daemon</span> ] for &quot;</span><span style="color: #ff0000;">&quot;<span style="color: #007800;">$host</span>&quot;</span> tech-c<span style="color: #000000; font-weight: bold;">@</span>bakeca.it <span style="color: #000000; font-weight: bold;">&amp;</span>lt; <span style="color: #007800;">$tmp_file1</span>
        <span style="color: #000000; font-weight: bold;">fi</span>
        <span style="color: #666666; font-style: italic;">#remove the tmp_file</span>
        <span style="color: #c20cb9; font-weight: bold;">rm</span> <span style="color: #660033;">-f</span> <span style="color: #007800;">$tmp_file</span>
        <span style="color: #c20cb9; font-weight: bold;">rm</span> <span style="color: #660033;">-f</span> <span style="color: #007800;">$tmp_file1</span>
    <span style="color: #000000; font-weight: bold;">fi</span>
   <span style="color: #666666; font-style: italic;">#removing the semaphore</span>
   <span style="color: #c20cb9; font-weight: bold;">rm</span> <span style="color: #660033;">-f</span> <span style="color: #007800;">$semaphore</span>
<span style="color: #000000; font-weight: bold;">fi</span></pre></td></tr></table></div>

]]></content:encoded>
			<wfw:commentRss>http://blog.fabiolagana.net/bash-script-checking-mysql-problem-by-reading-daemonlog/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Another trick for cloning</title>
		<link>http://blog.fabiolagana.net/another-trick-cloning/</link>
		<comments>http://blog.fabiolagana.net/another-trick-cloning/#comments</comments>
		<pubDate>Thu, 10 Jul 2008 15:13:02 +0000</pubDate>
		<dc:creator>Fabio Laganà</dc:creator>
				<category><![CDATA[Debian]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Shell]]></category>
		<category><![CDATA[bash]]></category>
		<category><![CDATA[cloning]]></category>

		<guid isPermaLink="false">http://blog.fabiolagana.net/2008/07/10/another-trick-for-cloning-2/</guid>
		<description><![CDATA[   For a beowulf of full fledged Debian systems (local disk, no shared /usr
or anything like that) you'd need to use

prototype-node:
 dselect  (install and configure everything you want)
 dpkg --get-selections &#62; selection.file

second node:

  dpkg --set-selections &#60; selection.file
  apt-get install dselect-upgrade
  [log any questions and answers]
  [create an expect [...]]]></description>
			<content:encoded><![CDATA[<pre>   For a beowulf of full fledged Debian systems (local disk, no shared /usr
or anything like that) you'd need to use

prototype-node:
 dselect  (install and configure everything you want)
 dpkg --get-selections &gt; selection.file

second node:

  dpkg --set-selections &lt; selection.file
  apt-get install dselect-upgrade
  [log any questions and answers]
  [create an expect script with your responses to any questions]

rest-of-nodes:

   dpkg --set-selections &lt; selection.file
  expect -c "apt-get install dselect-upgrade" -f expect-script
</pre>
]]></content:encoded>
			<wfw:commentRss>http://blog.fabiolagana.net/another-trick-cloning/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>tips&amp;tricks</title>
		<link>http://blog.fabiolagana.net/tipstricks/</link>
		<comments>http://blog.fabiolagana.net/tipstricks/#comments</comments>
		<pubDate>Tue, 25 Mar 2008 09:32:49 +0000</pubDate>
		<dc:creator>Fabio Laganà</dc:creator>
				<category><![CDATA[awk]]></category>
		<category><![CDATA[bash]]></category>
		<category><![CDATA[tips&tricks]]></category>

		<guid isPermaLink="false">http://blog.fabiolagana.net/?p=6</guid>
		<description><![CDATA[# last filed

zcat access.log.gz &#124;grep 27/Jan/2008 &#124;awk '{ field = $NF }; {print field}'

# count per Hits

zcat access.log.gz  &#124;grep 27/Jan/2008 &#124;awk '{ field = $NF }; {print &#34;Host: &#34; field } ' &#124; sort &#124;uniq -c

# count per Hits + Totale al fondo

cat nomefile &#124;grep &#34;27/Jan/2008:&#34; &#124;awk ' { field = $NF }; {print &#34;Host: [...]]]></description>
			<content:encoded><![CDATA[<p># last filed</p>

<div class="wp_codebox"><table><tr id="p615"><td class="code" id="p6code15"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">zcat</span> access.log.gz <span style="color: #000000; font-weight: bold;">|</span><span style="color: #c20cb9; font-weight: bold;">grep</span> 27<span style="color: #000000; font-weight: bold;">/</span>Jan<span style="color: #000000; font-weight: bold;">/</span>2008 <span style="color: #000000; font-weight: bold;">|</span><span style="color: #c20cb9; font-weight: bold;">awk</span> <span style="color: #ff0000;">'{ field = $NF }; {print field}'</span></pre></td></tr></table></div>

<p># count per Hits</p>

<div class="wp_codebox"><table><tr id="p616"><td class="code" id="p6code16"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">zcat</span> access.log.gz  <span style="color: #000000; font-weight: bold;">|</span><span style="color: #c20cb9; font-weight: bold;">grep</span> 27<span style="color: #000000; font-weight: bold;">/</span>Jan<span style="color: #000000; font-weight: bold;">/</span>2008 <span style="color: #000000; font-weight: bold;">|</span><span style="color: #c20cb9; font-weight: bold;">awk</span> <span style="color: #ff0000;">'{ field = $NF }; {print &quot;Host: &quot; field } '</span> <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">sort</span> <span style="color: #000000; font-weight: bold;">|</span><span style="color: #c20cb9; font-weight: bold;">uniq</span> <span style="color: #660033;">-c</span></pre></td></tr></table></div>

<p># count per Hits + Totale al fondo</p>

<div class="wp_codebox"><table><tr id="p617"><td class="code" id="p6code17"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">cat</span> nomefile <span style="color: #000000; font-weight: bold;">|</span><span style="color: #c20cb9; font-weight: bold;">grep</span> <span style="color: #ff0000;">&quot;27/Jan/2008:&quot;</span> <span style="color: #000000; font-weight: bold;">|</span><span style="color: #c20cb9; font-weight: bold;">awk</span> <span style="color: #ff0000;">' { field = $NF }; {print &quot;Host: &quot; field }'</span> <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">sort</span><span style="color: #000000; font-weight: bold;">|</span><span style="color: #c20cb9; font-weight: bold;">uniq</span> -c<span style="color: #000000; font-weight: bold;">|</span><span style="color: #c20cb9; font-weight: bold;">sort</span> -nr<span style="color: #000000; font-weight: bold;">|</span><span style="color: #c20cb9; font-weight: bold;">awk</span> <span style="color: #660033;">-v</span> <span style="color: #007800;">totale</span>=<span style="color: #000000;">0</span> <span style="color: #ff0000;">'{totale=totale+$1; print ;} END {print &quot;Totale giornaliero: &quot;totale;}'</span></pre></td></tr></table></div>

]]></content:encoded>
			<wfw:commentRss>http://blog.fabiolagana.net/tipstricks/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
<!-- WP Super Cache is installed but broken. The path to wp-cache-phase1.php in wp-content/advanced-cache.php must be fixed! -->