Page 1 of 2

Start TDPS as Service under Linux

PostPosted: 16 Feb 2011, 16:03
by SFu
Hello,

Today I had to upgrade my environment and install a dedicated TeamDrive Server machine without a screen, only text mode operation.
While setting this env up, I imagined that multiple TDPS Users want to do the same, let the TDPS server running on a “little machine with just a huge amount of disk storage” behind.
This was the reason to create the following how-to.

So, let us start to setup our TeamDrive Personal Server as a Service:

Part 1: Download and Installation
First of all, logon to your server and - if not already done - open a command box (bash).
Time by time you can download a new version of TDPS from http://www.teamdrive.com/de/download_server.html so please take a look an update the following command:
Code: Select all
wget http://s3download.teamdrive.net/TeamDrivePersonalServerLinux_10044.tar.gz


next we'll extract the file
Code: Select all
tar xzf TeamDrivePersonalServerLinux_10044.tar.gz


after that, we will move the new directory tdpsd into /opt, you can also choose /var or /usr/bin or /usr/local/bin or ...
Code: Select all
mv tdpsd /opt/tdpsd


Now, take a moment, create your MD5 Password Hash and configure the tdps.config, to finish the installation :-)


Part 2: User and startscript
Next we will need a deamon user, "tdpsd", without a homedrive and without a shell. If you need to have a special UID add -u xyz to the command
Code: Select all
sudo useradd -s /bin/false -d /bin/null tdpsd


now set a password
Code: Select all
sudo passwd tdpsd


as we will start TDPS with that user account we should make it the owner of the directory and files
Code: Select all
sudo chown -R tdpsd:tdpsd /opt/tdpsd/


next we will need the startup script, you can download it here: http://www.cuivienen.name/downloads/tdpsd or directly on your server
Code: Select all
sudo wget http://www.cuivienen.name/downloads/tdpsd


The script should run out-of-the-box, the only parts you may need to edit are the User and/or the path of tdpsd.
DESC="TeamDrive 1.0.44 Server Linux"
NAME=tdpsd
USER=tdpsd
DIR=/opt/tdpsd
DAEMON=$DIR/tdpsd
PIDFILE=/var/run/$NAME.pid
SCRIPTNAME=/etc/init.d/$NAME


now, let us move the script to /etc/init.d
Code: Select all
sudo mv tdpsd /etc/init.d


...and set the required rights
Code: Select all
sudo chmod 755 /etc/init.d/tdpsd



Part 3: start/stop and autostart
Now we are in the final phase :-)
To start TDPSD we just need to run
Code: Select all
sudo service tdpsd start


To stop it's just
Code: Select all
sudo service tdpsd stop


So, let us set the last bit - autostart
Code: Select all
sudo update-rc.d -f tdpsd defaults


FINISHED :D

Greeting

SFu

Re: How-To: Start TDPSD as Service under Linux

PostPosted: 25 Feb 2011, 17:22
by Detlef Schmuck
@SFu Thanks a lot for your great description !

-Detlef

Re: How-To: Start TDPSD as Service under Linux

PostPosted: 14 Jun 2012, 05:24
by tmassey
Here are a few changes for Red Hat systems:

1) A password for the user account is not required. Skip it.

2) You need a Red Hat based init script. So do I: this one works, but could be better. I'm forced to use "exec" instead of "daemon" because, unlike Debian, you can't chdir. This is annoying, but not a deal-killer. But if you know of a better way to do this, please let us know.

Code: Select all
#!/bin/sh
#
# DESCRIPTION
#
#   Startup init script for TeamDrive Personal Server on Redhat linux.
#
# Created for TeamDrive Personal Server version 1.0.44.
#
# chkconfig: - 92 34
# description: Starts and stops the TeamDrive server

# Source function library.
if [ -f /etc/init.d/functions ] ; then
  . /etc/init.d/functions
elif [ -f /etc/rc.d/init.d/functions ] ; then
  . /etc/rc.d/init.d/functions
else
  exit 0
fi

RETVAL=0

DESC="TeamDrive 1.0.44 Server Linux"
NAME=tdpsd
USER=tdpsd
DIR=/opt/tdpsd
DAEMON=$DIR/tdpsd
LOCKFILE=/var/lock/subsys/$NAME

start() {
    echo -n "Starting $DESC: "
    cd $DIR
$DIR/tdps.config --log-file=$DIR/tdpsd.log
    cd $DIR
    exec $DAEMON --user=$USER --pid-file=$DIR/$NAME.pid --config-file=$DIR/tdps.config --log-file=$DIR/tdpsd.log
    RETVAL=$?
    echo
    [ $RETVAL -eq 0 ] && touch $LOCKFILE || \
       RETVAL=1
    return $RETVAL
}

stop() {
    echo -n "Shutting down $DESC: "
    killproc $DAEMON
    RETVAL=$?
    [ $RETVAL -eq 0 ] && rm -f $LOCKFILE
    echo ""
    return $RETVAL
}

restart() {
    stop
    start
}

rhstatus() {
    status $DAEMON
}

case "$1" in
  start)
        start
        ;;
  stop)
        stop
        ;;
  restart)
        restart
        ;;
  status)
        rhstatus
        ;;
  *)
        echo "Usage: $0 {start|stop|restart|status}"
        exit 1
esac

exit $?


3) Autostart is different. Use this command: chkconfig --level 345 tdpsd on


This works for me. Like I said, please update us with any improvements you can add!

Re: How-To: Start TDPSD as Service under Linux

PostPosted: 03 Jul 2012, 12:59
by nKognito
Hello,
I have Debian 6,
I tried this manual, everything fine untill I trying to run that code: service tdpsd start, it fails with such error:
/etc/init.d/tdpsd: No such file or directory

But I did everything like in this manual! Can you help to solve that issue please?
Thank you

Re: How-To: Start TDPSD as Service under Linux

PostPosted: 23 Aug 2012, 15:29
by dr.pepper
corrupt init-script file!!!

use converter to remove windows-specific wordwraps from tdpsd:

Code: Select all
apt-get install dos2unix

Code: Select all
cd /path/to/tdpsd

Code: Select all
dos2unix tdpsd


c'est tout 8-)

Re: How-To: Start TDPSD as Service under Linux

PostPosted: 08 Oct 2012, 19:14
by Conan
Guten nabend, Könnte mir evtl. jemand die anleitung in deutsch übersetzten? mein eng ist misserabel. Ich hab einen ubuntu 12.04 server und den Teamdriver server, der einwandfrei funktioniert. Ich möchte aber, das der server beim booten automatisch mit startet.
GRuss

Re: How-To: Start TDPSD as Service under Linux

PostPosted: 14 Oct 2012, 23:32
by Tronde
Guten Abend.

Mit der freundlichen Genehmigung von SFu habe ich den Teil des Tutorials übersetzt, der sich mit dem Startscript und dem Autostart beschäfigt. Du findest das Tutorial in meinem Blog unter dem Link: http://www.my-it-brain.de/wordpress/teamdrive-personal-server-als-dienst-konfigurieren/.

Viel Spaß damit und danke nochmal an SFu.

MfG
Tronde

Re: How-To: Start TDPSD as Service under Linux

PostPosted: 16 Oct 2012, 22:12
by Conan
Ich danke dir! Klapt super bei mir.

Gruss Conan

Re: How-To: Start TDPSD as Service under Linux

PostPosted: 18 Mar 2013, 15:41
by f.endor
When I try to do:
sudo service tdpsd start
I become:
tdpsd: unrecognized service
Why?
How is it not possible to run tdpsd?
I have Ubuntu 12.4 (12.4.2 LTS).

Re: How-To: Start TDPSD as Service under Linux

PostPosted: 18 Mar 2013, 16:08
by f.endor
I think I could start the service.
It says: "Starting TeamDrive 1.0.47 Server Linux: tdpsd."
But nothing is written in the log data. Is it started?