#!/bin/bash

# topology
topo="fritz.box"
domain=iq42.de

# mount
mp=/media/crypt
cm=media

if ! mountpoint "$mp"; then
# local topology, find host
    t="$(hostname)"
    for h in $topo; do
        ping -c 1 -w 1 $h >/dev/null 2>/dev/null
        t="$t $(arp -a $h | awk '{print $4}')"
    done
    t64="$(echo "$t" | openssl base64)"
# getting password
    pw64="$(dig +short txt "$t64.$domain" | sed 's/\\\\/\\/g')"
    pw="$(echo -e "${pw64:1:-1}" | openssl base64 -d)"
# trying to mount
    echo "$pw" | cryptmount -w 0 "$cm"
fi

if mountpoint "$mp"; then
# starting tools
    ionice -c 2 -n 0 "$mp/dl/minidlna/sbin/minidlnad" -f "$mp/dl/minidlna/minidlna.conf" -P "$mp/dl/run/minidlna.pid" -L
    ionice -c 2 -n 2 python "$mp/dl/SABnzbd/SABnzbd.py" -f "$mp/dl/sab/sabnzbd.ini" --pid "$mp/dl/run" -d
    ionice -c 2 -n 3 python "$mp/dl/Sick-Beard/SickBeard.py" -d --pidfile="$mp/dl/run/sickbeard.pid"
    "$mp/dl/scripts/sigstop.sh"
fi

Add a code snippet to your website: www.paste.org