Scheduled Maintenance: We are aware of an issue with Google, AOL, and Yahoo services as email providers which are blocking new registrations. We are trying to fix the issue and we have several internal and external support tickets in process to resolve the issue. Please see: viewtopic.php?t=158230

 

 

 

Debian Services (Qnap Docker)

Programming languages, Coding, Executables, Package Creation, and Scripting.
Post Reply
Message
Author
vytas9425
Posts: 3
Joined: 2021-01-30 20:21

Debian Services (Qnap Docker)

#1 Post by vytas9425 »

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?

User avatar
Head_on_a_Stick
Posts: 14114
Joined: 2014-06-01 17:46
Location: London, England
Has thanked: 81 times
Been thanked: 132 times

Re: Debian Services (Qnap Docker)

#2 Post by Head_on_a_Stick »

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.
deadbang

vytas9425
Posts: 3
Joined: 2021-01-30 20:21

Re: Debian Services (Qnap Docker)

#3 Post by vytas9425 »

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?

User avatar
Head_on_a_Stick
Posts: 14114
Joined: 2014-06-01 17:46
Location: London, England
Has thanked: 81 times
Been thanked: 132 times

Re: Debian Services (Qnap Docker)

#4 Post by Head_on_a_Stick »

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
deadbang

vytas9425
Posts: 3
Joined: 2021-01-30 20:21

Re: Debian Services (Qnap Docker)

#5 Post by vytas9425 »

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.

User avatar
Head_on_a_Stick
Posts: 14114
Joined: 2014-06-01 17:46
Location: London, England
Has thanked: 81 times
Been thanked: 132 times

Re: Debian Services (Qnap Docker)

#6 Post by Head_on_a_Stick »

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.
deadbang

Post Reply