Debian Services (Qnap Docker)

Need help with C, C++, perl, python, etc?

Debian Services (Qnap Docker)

Postby vytas9425 » 2021-01-30 21:44

Hello, I have created Debian docker in Qnap NAS. I'm trying to enable and start service for Traccar software.
I'm using Traccar on my Raspberry Pi 3 along Octoprint, so I took all (Traccar) files and copied to Debian on Qnap for testing, started java and everyting worked fine, but I can't get traccar.service file to run.
On Raspberry I could use systemctl command to start, stop, ect, but on Qnap, I almost can't do anything, Debian even didn't had sudo installed.

So I copied service file to /etc/systemd/system/traccar.service and typed, what Traccar Instalation instructions sed, but getting error.
root@1ccacf022fc9:/# systemctl daemon-reload
System has not been booted with systemd as init system (PID 1). Can't operate.
Failed to connect to bus: Host is down

root@1ccacf022fc9:/# systemctl start traccar.service
System has not been booted with systemd as init system (PID 1). Can't operate.
Failed to connect to bus: Host is down


I tried to Google and found out that I have to use service command instead of systemctl, and how I understand that services location changed to /etc/init.d/, so I duplicate traccar.service file and try start service:
root@1ccacf022fc9:/# sudo service traccar.service start
traccar.service: unrecognized service

root@1ccacf022fc9:/# sudo service /etc/init.d/traccar.service start
/etc/init.d/traccar.service: unrecognized service

root@1ccacf022fc9:/# sudo service ssh status <--- Testing command
[ ok ] sshd is running.


Service --status-all not showing my service in list.
root@1ccacf022fc9:/# sudo service --status-all
[ - ] dbus
[ ? ] hwclock.sh
[ - ] procps
[ + ] ssh
[ - ] sudo
[ - ] x11-common

How I understand my service should be added somehow to this list to manipulate service status.
Maybe someone could help me to start my service file?
vytas9425
 
Posts: 3
Joined: 2021-01-30 20:21

Re: Debian Services (Qnap Docker)

Postby Head_on_a_Stick » 2021-01-31 08:36

Unit files for systemd are not shell scripts and so cannot be added to /etc/init.d/.

Perhaps try http://www.trek.eu.org/devel/sysd2v/ to convert the unit file to a sysvinit script.
Black Lives Matter

Debian buster-backports ISO image: for new hardware support
User avatar
Head_on_a_Stick
 
Posts: 13262
Joined: 2014-06-01 17:46
Location: /dev/chair

Re: Debian Services (Qnap Docker)

Postby vytas9425 » 2021-01-31 10:19

Head_on_a_Stick wrote:Unit files for systemd are not shell scripts and so cannot be added to /etc/init.d/.

Perhaps try http://www.trek.eu.org/devel/sysd2v/ to convert the unit file to a sysvinit script.

How to run this file, I tried sh, but it stuck, is there should be specific locations for this file, how to run this converter?
vytas9425
 
Posts: 3
Joined: 2021-01-30 20:21

Re: Debian Services (Qnap Docker)

Postby Head_on_a_Stick » 2021-01-31 10:34

Code: Select all
wget http://www.trek.eu.org/devel/sysd2v/sysd2v-0.3.sh
chmod +x sysd2v-0.3.sh
./sysd2v-0.3.sh /path/to/unit/file > sysvinit_script_name
# cp sysvinit_script_name /etc/init.d/
# /etc/init.d/sysvinit_script_name start
# update-rc.d sysvinit_script_name defaults
Black Lives Matter

Debian buster-backports ISO image: for new hardware support
User avatar
Head_on_a_Stick
 
Posts: 13262
Joined: 2014-06-01 17:46
Location: /dev/chair

Re: Debian Services (Qnap Docker)

Postby vytas9425 » 2021-01-31 12:25

Head_on_a_Stick wrote:
Code: Select all
wget http://www.trek.eu.org/devel/sysd2v/sysd2v-0.3.sh
chmod +x sysd2v-0.3.sh

./sysd2v-0.3.sh /path/to/unit/file > sysvinit_script_name
# cp sysvinit_script_name /etc/init.d/
# /etc/init.d/sysvinit_script_name start
# update-rc.d sysvinit_script_name defaults

I don't know if I run this program correctly, I downloaded sh to root forlder and typed:
root@3571c108c0ed:/# chmod +x sysd2v-0.3.sh

root@3571c108c0ed:/# ./sysd2v-0.3.sh /etc/systemd/system > traccar.service
cat: /etc/systemd/system: Is a directory

root@3571c108c0ed:/# cp traccar.service /etc/init.d/

root@3571c108c0ed:/# /etc/init.d/traccar.service start
bash: /etc/init.d/traccar.service: Permission denied

root@3571c108c0ed:/# update-rc.d traccar.service defaults

root@3571c108c0ed:/# /etc/init.d/traccar.service start
bash: /etc/init.d/traccar.service: Permission denied

In /etc/init.d/ folder appeared my traccar.service file, but content of this file not really promissing:
#!/bin/sh
# Generated by sysd2v v0.3 -- http://www.trek.eu.org/devel/sysd2v
# kFreeBSD do not accept scripts as interpreters, using #!/bin/sh and sourcing.
if [ true != "$INIT_D_SCRIPT_SOURCED" ] ; then
set "$0" "$@"; INIT_D_SCRIPT_SOURCED=true . /lib/init/init-d-script
fi
### BEGIN INIT INFO
# Provides: system
# Required-Start: $remote_fs
# Required-Stop:
# Default-Start: 2 3 4 5
# Default-Stop:
# Description: SERVICE_DESCRIPTION
### END INIT INFO
DESC=\"system\"
DAEMON=none
PIDFILE=none

do_start_override () :

do_stop_override () :

do_status_override () :



Do I did something wrong?
I tried to type sysvinit_traccar.service insted traccar.service but still the same.
vytas9425
 
Posts: 3
Joined: 2021-01-30 20:21

Re: Debian Services (Qnap Docker)

Postby Head_on_a_Stick » 2021-01-31 12:31

vytas9425 wrote:
Code: Select all
root@3571c108c0ed:/# ./sysd2v-0.3.sh /etc/systemd/system > traccar.service

You need to provide the path to the actual unit file rather than just to a directory that contains unit files.

And please use code tags rather than quote tags when posting terminal output.
Black Lives Matter

Debian buster-backports ISO image: for new hardware support
User avatar
Head_on_a_Stick
 
Posts: 13262
Joined: 2014-06-01 17:46
Location: /dev/chair


Return to Programming

Who is online

Users browsing this forum: No registered users and 3 guests

fashionable