Running DC++ on my RPI3

MicroDC2 Seems to be a good client to use for a headless server. It is configured by command line and there appears to be an update released just recently (first update in 5 years). The package installs using apt-get in Debian (I’m using Debian since there isn’t a proper Ubuntu release for the RPI3 yet).

sudo apt-get install microdc2

From here you can open microdc2 by just typing microdc2 into the Command prompt. Usage instructions are here, although to share a folder in the new version I used “share /directory/to/be/shared” (no ‘set’ beforehand). This all worked after allowing my listen port in UFW (awesome), then I made a config file with all the commands I want to run on start-up (as described in the instructions).

Note; another DC++ option could be eiskaltdcpp-daemon, although I couldn’t find good documentation at the time for that..

Running MicroDC2 at boot

I’ve used this script at boot:

#!/bin/bash

function check_online
{
 netcat -z -w 5 8.8.8.8 53 && echo 1 || echo 0
}

# Initial check to see if we're online
IS_ONLINE=$(check_online)
# How many times we should check if we're online - prevents infinite looping
MAX_CHECKS=5
# Initial starting value for checks
CHECKS=0

# Loop while we're not online.
while [ $IS_ONLINE -eq 0 ];do
 # We're offline. Sleep for a bit, then check again

sleep 10;
 IS_ONLINE=check_online

CHECKS=$[ $CHECKS + 1 ]
 if [ $CHECKS -gt $MAX_CHECKS ]; then
 break
 fi
done

screen -dm -S microdc2 microdc2

The final line starts microDC2 using screen in the background, and it only does this after it can ping 8.8.8.8 (googles DNS) (the script had to be amended slightly). The ping is required otherwise is will try to run microdc2 before the network is ready. Yes I could have used upstart or whatever, but this took less time to figure out.

I then added this line in my local crontab (using ‘crontab -e’ without sudo)

@reboot "/home/user/scripts/ScreenMicroDC2.sh"

I can connect to the screen terminal using ‘screen -r’ (r for reconnect). Awesome 🙂

Leave a Reply

Your email address will not be published. Required fields are marked *