Start TDPS with systemd

Questions and information regarding the TeamDrive Personal Server - Fragen und Informationen zum TeamDrive Personal Server

Start TDPS with systemd

Postby wagnbeu0 » 20 Oct 2015, 17:24

Hi, I successful changed my Pi from raspbmc to OSMC which is now based on systemd.

Does anyone have a running startscript so my personal server will start automatically after every boot?
wagnbeu0
 
Posts: 52
Joined: 25 Jun 2013, 10:01

Re: Start TDPS with systemd

Postby wagnbeu0 » 21 Oct 2015, 13:10

So, ich habe es nun geschafft:

Der PÜersonal Server ist auf der Distribution OSMC unter /opt/tdps entpackt. Die Dateien gehören dem lokalen User teamdrive, der aquch den Dienst starten soll.

Man muss eine Datei /lib/systemd/system/tdps.service erstellen mit diesem Inhalt:
Code: Select all
[Unit]
Description=TeamDrive 1.1.058 Server Linux
After=network.target

[Service]
User=teamdrive
PIDFile=/opt/tdps/tdpsd.pid
ExecStart=/opt/tdps/tdpsd -c /opt/tdps/tdps.config -m /opt/tdps/mime.types -w /opt/tdps/
ExecStop=/opt/tdps/stop-tdps -p /opt/tdps/tdpsd.pid
KillMode=process

[Install]
WantedBy=multi-user.target


Danach mit
Code: Select all
systemctl enable tdps

Den Dienst starten.

Achtung: Ich musste noch manuell einen symlink setzen, damit der Server startet:
Code: Select all
ln -s /lib/ld-linux-armhf.so.3 /lib/ld-linux.so.3


vielleicht hilft euch das ja.
wagnbeu0
 
Posts: 52
Joined: 25 Jun 2013, 10:01

Unit fails after each systemctl stop tdps.service

Postby Tronde » 08 Aug 2020, 15:00

# English (German below)

Hello, I would like to pick up this thread because I used the information from here to write a systemd service unit of my on for the TeamDrive Personal Server (version 1.1.070), today. My service unit looks like:

Code: Select all
$ cat /etc/systemd/system/tdps.service
[Unit]
Description="TeamDrive Personal Server"
After=network.target

[Service]
User=tdps
PIDFile=/opt/tdps/tdpsd.pid
ExecStart=/opt/tdps/tdpsd -c /opt/tdps/tdps.config -m /opt/tdps/mime.types -w /opt/tdps
ExecStop=/opt/tdps/stop-tdps -p /opt/tdps/tdpsd.pid
KillMode=process
PrivateTmp=yes
ProtectHome=yes
ProtectSystem=yes

[Install]
WantedBy=multi-user.target


I'm able to successfully start the service. But each time I stop it via
Code: Select all
sudo systemctl stop tdps.service
the unit fails with following status:

Code: Select all
$ sudo systemctl status tdps.service
● tdps.service - "TeamDrive Personal Server"
   Loaded: loaded (/etc/systemd/system/tdps.service; disabled; vendor preset: enabled)
   Active: failed (Result: exit-code) since Sat 2020-08-08 14:43:56 CEST; 8min ago
  Process: 26963 ExecStart=/opt/tdps/tdpsd -c /opt/tdps/tdps.config -m /opt/tdps/mime.types -w /opt/tdps (code=exited, status=1/FAILURE)
  Process: 26991 ExecStop=/opt/tdps/stop-tdps -p /opt/tdps/tdpsd.pid (code=exited, status=0/SUCCESS)
 Main PID: 26963 (code=exited, status=1/FAILURE)

Aug 08 14:43:18 vmd54920.contaboserver.net systemd[1]: Started "TeamDrive Personal Server".
Aug 08 14:43:55 vmd54920.contaboserver.net systemd[1]: Stopping "TeamDrive Personal Server"...
Aug 08 14:43:55 vmd54920.contaboserver.net systemd[1]: tdps.service: Main process exited, code=exited, status=1/FAILURE
Aug 08 14:43:56 vmd54920.contaboserver.net stop-tdps[26991]: TeamDrive Personal Server stopped
Aug 08 14:43:56 vmd54920.contaboserver.net systemd[1]: tdps.service: Failed with result 'exit-code'.
Aug 08 14:43:56 vmd54920.contaboserver.net systemd[1]: Stopped "TeamDrive Personal Server".


In /opt/tdps/tpdsd.log I found this:

Code: Select all
===========================================
200808 14:43:55 TeamDrive Personal Server shutdown
200808 14:43:56 [Error] NetworkHandler2: void CSThread::throwSignal(CSThread.cc:404) Terminated (15)
200808 14:43:56 [Note] TeamDrive Personal Server no longer published


Well, the server is no longer published but I don't like the unit to fail. Does someone have an idea what to do so the service could be stopped without causing the unit to fail?

# Deutsch

Hi, ich greife dieses Thema auf, da ich auf dessen Basis selbst eine Service-Unit erstellt habe. Der Server lässt sich erfolgreich über die Service-Unit starten. Jedoch endet die Unit nach jedem Stopp des Dienstes im Status "failed". Meine Unit, der Status beim Stop und ein Auszug aus dem tdpsd.log sind in den obigen Code-Blöcken dargestellt.

Kann mir jemand erklären, warum die Unit beim Stopp des Dienstes in den Status 'failed' geht? Also warum der Exit-Status ungleich 0 ist? Ich vermute es hat etwas damit zu tun, dass der Prozess mit SIGTERM beendet wird, bin mir aber nicht sicher.

Was kann ich tun, um den Dienst zu stoppen und einen Fehlerstatus der Unit zu vermeiden?

MfG
Tronde
Tronde
 
Posts: 118
Joined: 09 Mar 2009, 17:16


Return to TeamDrive Personal Server (TDPS)

Who is online

Users browsing this forum: jacobcak545 and 3 guests