Blog |Follow Nick on Twitter| About
 

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've been having a small problem with mediatomb, further investigation lead me to a "Inotify thread caught exception" error which can be fixed by recursively resetting your file permissions.

What I have done to fix the issue is save the following code as /etc/cron.daily/fix_mt.sh and 'jobs a gooden' :cool:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
#!/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 & 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


Quick tip:
You (or root) will get e-mailed every time this executes, you can make the script more verbos by changing all "-c" to "-v", or make it silent by removing the "-c" altogether.

Enjoy!

 

 
Nick Bettison ©