<?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>[LINICKX].com &#187; cron</title>
	<atom:link href="http://www.linickx.com/tag/cron/feed" rel="self" type="application/rss+xml" />
	<link>http://www.linickx.com</link>
	<description>Moments of Genius followed by Trash.</description>
	<lastBuildDate>Tue, 07 Feb 2012 15:06:32 +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>Bash script to fix file permissions recursively</title>
		<link>http://www.linickx.com/396/bash-script-to-fix-file-permissions-recursively</link>
		<comments>http://www.linickx.com/396/bash-script-to-fix-file-permissions-recursively#comments</comments>
		<pubDate>Thu, 26 Jun 2008 19:00:47 +0000</pubDate>
		<dc:creator>Nick</dc:creator>
				<category><![CDATA[Blog]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[bash]]></category>
		<category><![CDATA[cron]]></category>
		<category><![CDATA[mediatomb]]></category>

		<guid isPermaLink="false">http://www.linickx.com/?p=396</guid>
		<description><![CDATA[I love the redhat implementation of cron, simply drop a shell script into /etc/cron.daily/ and your script will be executed every day (by default at 4am). Recently I&#8217;ve been having a small problem with mediatomb, further investigation lead me to &#8230; <a href="http://www.linickx.com/396/bash-script-to-fix-file-permissions-recursively">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>I love the redhat implementation of cron, simply drop a shell script into <code>/etc/cron.daily/</code> and your script will be executed every day (<em>by default at 4am</em>).</p>
<p>Recently I&#8217;ve been having a small <a href="https://sourceforge.net/forum/forum.php?thread_id=1961180&#038;forum_id=440751">problem</a> with <a href="http://mediatomb.cc/">mediatomb</a>, further investigation lead me to <a href="https://sourceforge.net/forum/message.php?msg_id=4828164">a &#8220;Inotify thread caught exception&#8221; error</a> which can be fixed by recursively resetting your file permissions.</p>
<p>What I have done to fix the issue is save the following code as <code>/etc/cron.daily/fix_mt.sh</code> and &#8216;jobs a gooden&#8217; <img src='http://www.linickx.com/wp/wp-includes/images/smilies/icon_cool.gif' alt=':cool:' class='wp-smiley' /> </p>
<pre>
#!/bin/bash
# Load up your mediatomb directories...
MediaTombDirectories[0]="/home/me/Videos"
MediaTombDirectories[1]="/home/me/Music"
# add more if needbe
# MediaTombDirectories[2]="/home/me/files"

# Setup find correctly.
export IFS=$'\n'

# Loop through our array.
for x in ${MediaTombDirectories[@]}
	do
		# Find all directories &#038; subdirectories
		for i in $(find $x -type d)
			do
				# Fix Permissions
				chmod -c 775 $i
				chown -c me:user $i
			done

		# Find all Files
		for i in $(find $x -type f)
			do
				# Fix Permissions
				chmod -c 664 $i
				chown -c me:user $i
			done
	done
</pre>
<p><strong><br />
Quick tip:</strong> You (<em>or root</em>) will get e-mailed every time this executes, you can make the script more verbos by changing all &#8220;<code>-c</code>&#8221; to &#8220;<code>-v</code>&#8220;, or make it silent by removing the &#8220;<code>-c</code>&#8221; altogether.</p>
<p>Enjoy!</p>
<img src="http://www.linickx.com/wp/wp-content/themes/linickx_v2/images/nick_sig_bggrey.png" alt="Nick" /> <hr/>Copyright &copy; 2012 <strong><a href="http://www.linickx.com">[LINICKX].com</a></strong>. This Feed is for personal non-commercial use only. Please check my <a href="http://www.linickx.com/?page_id=63">Site Terms and Conditions</a> for full details on copyrights. If you have any concerns with the content of this feed you may <a href="http://www.linickx.com/contact">contact me here</a>.<br/><span style="float: right;font-size: 7pt"><a href="http://blog.taragana.com/index.php/archive/wordpress-plugins-provided-by-taraganacom/">WP Copyright Plugin</a></span>]]></content:encoded>
			<wfw:commentRss>http://www.linickx.com/396/bash-script-to-fix-file-permissions-recursively/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>

