PtokaX forum

Stuff => Offtopic => Topic started by: deseven on 07 December, 2009, 10:23:15

Title: HOWTO: Run a StrongDC++ on a headless linux/freebsd server
Post by: deseven on 07 December, 2009, 10:23:15
You may know, that the console DC-client software in linux/freebsd is terrible.
If you need to share some files from you server to other users - there are not many options.
You can use microDC, for example, but be ready for bugs, instability and lack of many important features (such as magnet links).

But you can run any StrongDC++ clone, such as FlylinkDC, Greylink, ApexDC++, etc.

So, basic requirements are:
- any linux distro or FreeBSD
- Xvfb (it called xorg-vfbserver in FreeBSD)
- wine 1.0.1 or higher

First of all you should configure your client in Windows or just edit Settings\DCPlusPlus.xml and Settings\Favorites.xml files.

Make sure that MagnetAction set to 1 and MagnetAsk set to 0.

Then just save this script with any desired name ("dc" for example) and edit CLIENTPATH variable:
#!/bin/bash

CLIENTPATH="/serv/greylink/greylink.exe"
DISPNUM=":1"
WINEPATH=`which wine`
XVFBPATH=`which Xvfb`

case "$1" in
   start)
       echo -n $"Starting: "
       nohup $XVFBPATH $DISPNUM > Xvfb.log &
       export DISPLAY=$DISPNUM
       nohup $WINEPATH $CLIENTPATH > wine.log &
       echo $"[OK]"
       ;;
   stop)
       echo -n $"Stopping: "
       nohup killall wine > /dev/null &
       nohup killall Xvfb > /dev/null &
       echo $"[OK]"
       ;;
   restart)
       $0 stop
       $0 start
       ;;
   start-debug)
       echo -n $"Starting in interactive mode: "
       nohup $XVFBPATH $DISPNUM > Xvfb.log &
       export DISPLAY=$DISPNUM
       $WINEPATH $CLIENTPATH
       $0 stop
       ;;
   magnet)
       echo -n $"Sending magnet: "
       export DISPLAY=$DISPNUM
       $WINEPATH $CLIENTPATH /magnet $2
       echo $"[OK]"
       ;;
   *)
       echo $"Usage: start|start-debug|stop|restart|magnet"
       exit 1

esac

exit 1



Use "dc start" to start your DC-client, "dc stop" to stop it, "dc restart" to restart it, "dc start-debug" to check for possible wine problems and "dc magnet <magnet-link-with-quotes>" to add a magnet-link.
FreeBSD users must also check the bash path in the first line of the script.

Tested in CentOS 5.3, Ubuntu 9.10 and FreeBSD 7.2.

Hope this will help someone. Good luck and sorry for my english :)
Title: Re: HOWTO: Run a StrongDC++ on a headless linux/freebsd server
Post by: bastya_elvtars on 27 December, 2009, 18:55:05
For *BSD one needs to install bash from ports/pkgsrc as it is not supplied by default. Great work by the way, although a Bourne-version would be better. (I am not that huge shell guru so I cannot mod it, just playing a PITA as usual. :P) Anyway, thanks for this howto.