<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://ebasso.net/wiki/index.php?action=history&amp;feed=atom&amp;title=IHS%3A_Cleanup_script_for_mod_cache</id>
	<title>IHS: Cleanup script for mod cache - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://ebasso.net/wiki/index.php?action=history&amp;feed=atom&amp;title=IHS%3A_Cleanup_script_for_mod_cache"/>
	<link rel="alternate" type="text/html" href="https://ebasso.net/wiki/index.php?title=IHS:_Cleanup_script_for_mod_cache&amp;action=history"/>
	<updated>2026-06-02T10:15:42Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.40.0</generator>
	<entry>
		<id>https://ebasso.net/wiki/index.php?title=IHS:_Cleanup_script_for_mod_cache&amp;diff=2435&amp;oldid=prev</id>
		<title>Ebasso at 13:27, 14 January 2014</title>
		<link rel="alternate" type="text/html" href="https://ebasso.net/wiki/index.php?title=IHS:_Cleanup_script_for_mod_cache&amp;diff=2435&amp;oldid=prev"/>
		<updated>2014-01-14T13:27:02Z</updated>

		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;table style=&quot;background-color: #fff; color: #202122;&quot; data-mw=&quot;interface&quot;&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;en&quot;&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;Revision as of 13:27, 14 January 2014&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l11&quot;&gt;Line 11:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 11:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;  LOGFILE=/var/log/httpd/cleancache.log&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;  LOGFILE=/var/log/httpd/cleancache.log&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;  CACHE_FILES=var/cache/mod_disk_cache&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;  CACHE_FILES=var/cache/mod_disk_cache&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;−&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt; &lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt; &lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;  # Cache Size in GB&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;  # Cache Size in GB&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;  SIZE=2;&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;  SIZE=2;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>Ebasso</name></author>
	</entry>
	<entry>
		<id>https://ebasso.net/wiki/index.php?title=IHS:_Cleanup_script_for_mod_cache&amp;diff=2434&amp;oldid=prev</id>
		<title>Ebasso: Criou nova página com &#039;If you are using mod_cache/mod_disk_cache to use disk cache on Apache/IBM HTTP Server, you must run htcacheclean to cleanup cache to not be out of space.  htcacheclen tak...&#039;</title>
		<link rel="alternate" type="text/html" href="https://ebasso.net/wiki/index.php?title=IHS:_Cleanup_script_for_mod_cache&amp;diff=2434&amp;oldid=prev"/>
		<updated>2014-01-14T13:26:45Z</updated>

		<summary type="html">&lt;p&gt;Criou nova página com &amp;#039;If you are using mod_cache/mod_disk_cache to use disk cache on Apache/IBM HTTP Server, you must run htcacheclean to cleanup cache to not be out of space.  htcacheclen tak...&amp;#039;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;If you are using mod_cache/mod_disk_cache to use disk cache on Apache/IBM HTTP Server, you must run htcacheclean to cleanup cache to not be out of space.&lt;br /&gt;
&lt;br /&gt;
htcacheclen takes too much time to run. So i create a script that run htcacheclean against sub-directories, this way the command run faster.&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Procedure&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;1)&amp;#039;&amp;#039;&amp;#039; Create a file cleancache.sh, and put the following content:&lt;br /&gt;
&lt;br /&gt;
 #!/bin/bash&lt;br /&gt;
 APACHE_BIN_DIR=/opt/IBM/HTTPServer/bin&lt;br /&gt;
 LOGFILE=/var/log/httpd/cleancache.log&lt;br /&gt;
 CACHE_FILES=var/cache/mod_disk_cache&lt;br /&gt;
&lt;br /&gt;
 # Cache Size in GB&lt;br /&gt;
 SIZE=2;&lt;br /&gt;
 &lt;br /&gt;
 echo &amp;quot;############################################&amp;quot; &amp;gt; $LOGFILE&lt;br /&gt;
 NOW=$(date +&amp;quot;%Y-%m-%d-%H-%M-%S&amp;quot;)&lt;br /&gt;
 echo &amp;quot;[$NOW] Start Cleanup Cache&amp;quot; &amp;gt;&amp;gt; $LOGFILE&lt;br /&gt;
 echo &amp;quot;&amp;quot; &amp;gt;&amp;gt; $LOGFILE&lt;br /&gt;
 echo &amp;quot;############################################&amp;quot; &amp;gt;&amp;gt; $LOGFILE&lt;br /&gt;
 df -g &amp;gt;&amp;gt; $LOGFILE&lt;br /&gt;
 echo &amp;quot;############################################&amp;quot; &amp;gt;&amp;gt; $LOGFILE&lt;br /&gt;
 df &amp;gt;&amp;gt; $LOGFILE&lt;br /&gt;
 echo &amp;quot;############################################&amp;quot; &amp;gt;&amp;gt; $LOGFILE&lt;br /&gt;
 &lt;br /&gt;
 # We must divide SIZE by the number of directories (4096),&lt;br /&gt;
 # to get the per-directory limit, in megabytes&lt;br /&gt;
 LIMIT=$(( $SIZE * 1024 * 1024 / 4096 ))K;&lt;br /&gt;
 &lt;br /&gt;
 for i in $CACHE_FILES/*;&lt;br /&gt;
 do&lt;br /&gt;
   NOW=$(date +&amp;quot;%Y-%m-%d-%H-%M-%S&amp;quot;)&lt;br /&gt;
   echo &amp;quot;[$NOW] Diretorio $i&amp;quot; &amp;gt;&amp;gt; $LOGFILE&lt;br /&gt;
   #du -sm $i &amp;gt;&amp;gt; $LOGFILE&lt;br /&gt;
   $APACHE_BIN_DIR/htcacheclean -v -t -p$i -l$LIMIT &amp;gt;&amp;gt; $LOGFILE 2&amp;gt;&amp;amp;1&lt;br /&gt;
   #du -sm $i &amp;gt;&amp;gt; $LOGFILE&lt;br /&gt;
   echo &amp;quot;&amp;quot; &amp;gt;&amp;gt; $LOGFILE&lt;br /&gt;
 done;&lt;br /&gt;
 &lt;br /&gt;
 echo &amp;quot;&amp;quot; &amp;gt;&amp;gt; $LOGFILE&lt;br /&gt;
 echo &amp;quot;############################################&amp;quot; &amp;gt;&amp;gt; $LOGFILE&lt;br /&gt;
 df -g &amp;gt;&amp;gt; $LOGFILE&lt;br /&gt;
 echo &amp;quot;############################################&amp;quot; &amp;gt;&amp;gt; $LOGFILE&lt;br /&gt;
 df &amp;gt;&amp;gt; $LOGFILE&lt;br /&gt;
 echo &amp;quot;############################################&amp;quot; &amp;gt;&amp;gt; $LOGFILE&lt;br /&gt;
 NOW=$(date +&amp;quot;%Y-%m-%d-%H-%M-%S&amp;quot;)&lt;br /&gt;
 echo &amp;quot;[$NOW] End of Cleanup Cache&amp;quot; &amp;gt;&amp;gt; $LOGFILE&lt;br /&gt;
&lt;br /&gt;
Save and close&lt;br /&gt;
&lt;br /&gt;
2) Change permission &lt;br /&gt;
&lt;br /&gt;
 chmod a+x cleancache.sh&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
3) Putting on Cron:&lt;br /&gt;
&lt;br /&gt;
Edit crontab using crontab -e &lt;br /&gt;
&lt;br /&gt;
Add the following lines&lt;br /&gt;
&lt;br /&gt;
 ###### Script de Limpeza do Cache do IBM HTTP Server######&lt;br /&gt;
 0 4 * * 6 /opt/IBM/HTTPServer/bin/cleancache.sh&lt;br /&gt;
&lt;br /&gt;
== Ver também ==&lt;br /&gt;
&lt;br /&gt;
*[[Definindo a URL padrão no IBM HTTP Server Apache]]&lt;br /&gt;
*[[Apache:Redirecionando para pagina de Erro]]&lt;br /&gt;
*[[Apache:Redirecionando de HTTP para HTTPS]]&lt;br /&gt;
*[[Linux e Unix: Ferramentas de Monitoracao e Performance]]&lt;br /&gt;
*[[AWSTATS: Configurando o AWSTATS]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
*[[IBM HTTP Server|  Mais Artigos sobre Apache HTTP Server]]&lt;br /&gt;
&lt;br /&gt;
[[Category:IBM HTTP Server]]&lt;br /&gt;
[[Category:Apache HTTP Server]]&lt;/div&gt;</summary>
		<author><name>Ebasso</name></author>
	</entry>
</feed>