Add a program to autostart

Having issues with your DietPi installation, or, found a bug? Post it here.
klingsor
Posts: 5
Joined: Mon Dec 30, 2019 7:53 pm

Add a program to autostart

Post by klingsor »

I recently installed Bazarr to my Dietpi instalation but now I need to add the new path for the application and I don't know where is the location.

I need to add python bazarr.py and the path where I installed to the autostart on DietPi, so Bazarr can start with Sonarr, Radarr, Jackett and Transmission.

Any suggestion?

Cheers.
User avatar
Joulinar
Posts: 2068
Joined: Sat Nov 16, 2019 12:49 am

Re: Add a program to autostart

Post by Joulinar »

Hi,

as this software is not available on DietPi Software catalog, you would need to follow Bazarr vendor instructions to create the autostart entries:

https://github.com/morpheus65535/bazarr ... ian-Ubuntu

Google is your friend 8)
Pls let us know if a solution is working. This could help others if they hit by similar situation. Your DietPi Team
klingsor
Posts: 5
Joined: Mon Dec 30, 2019 7:53 pm

Re: Add a program to autostart

Post by klingsor »

Thanks, I follow the instructions but I cannot make it to start with the Pi :( Maybe it is not compatible with Dietpi.
User avatar
johnvick
Legend
Posts: 693
Joined: Wed Jun 08, 2016 11:53 am
Location: New Zealand

Re: Add a program to autostart

Post by johnvick »

I don't see any reason it shouldn't work. You could try a Docker install? Docker take a bit of learning but there are numerous tutorials around to get you started. One advantage of this approach is you don't have to mess around with Python versions - if some of your programs need a specific Python version things can get messy. Docker does away with this possible pitfall.

John
User avatar
Joulinar
Posts: 2068
Joined: Sat Nov 16, 2019 12:49 am

Re: Add a program to autostart

Post by Joulinar »

I guess there is a configuration issue on the service file because I did a quick and dirty installation on one of my VM's and it's working fine

Code: Select all

root@DietPiVM1:~# journalctl -u bazarr.service
-- Logs begin at Thu 2020-01-02 18:52:34 CET, end at Thu 2020-01-02 18:53:29 CET. --
Jan 02 18:52:38 DietPiVM1 systemd[1]: Starting Bazarr Daemon...
Jan 02 18:53:08 DietPiVM1 systemd[1]: Started Bazarr Daemon.
Jan 02 18:53:23 DietPiVM1 bazarr[702]: Bazarr starting...
Jan 02 18:53:23 DietPiVM1 bazarr[702]: 2020-01-02 18:53:23,486 - root                             (7f245fb1f740) :  INFO (main:2260) - BAZARR is started
 and waiting for request on http://0.0.0.0:6767/
root@DietPiVM1:~#
did you tried to start the service from command line

Code: Select all

 systemctl start bazarr.service
is that working? you can check the status as follow

Code: Select all

systemctl status bazarr.service
it should deliver something like this

Code: Select all

root@DietPiVM1:~# systemctl status bazarr.service
● bazarr.service - Bazarr Daemon
   Loaded: loaded (/etc/systemd/system/bazarr.service; enabled; vendor preset: enabled)
   Active: active (running) since Thu 2020-01-02 18:53:08 CET; 4min 29s ago
  Process: 517 ExecStartPre=/bin/sleep 30 (code=exited, status=0/SUCCESS)
 Main PID: 702 (python)
    Tasks: 14 (limit: 2381)
   Memory: 141.2M
   CGroup: /system.slice/bazarr.service
           ├─702 /usr/bin/python /root/bazarr/bazarr.py
           └─706 /usr/bin/python -u /root/bazarr/bazarr/main.py

Jan 02 18:52:38 DietPiVM1 systemd[1]: Starting Bazarr Daemon...
Jan 02 18:53:08 DietPiVM1 systemd[1]: Started Bazarr Daemon.
Jan 02 18:53:23 DietPiVM1 bazarr[702]: Bazarr starting...
Jan 02 18:53:23 DietPiVM1 bazarr[702]: 2020-01-02 18:53:23,486 - root                             (7f245fb1f740) :  INFO (main:2260) - BAZARR is started
 and waiting for request on http://0.0.0.0:6767/
Pls let us know if a solution is working. This could help others if they hit by similar situation. Your DietPi Team
klingsor
Posts: 5
Joined: Mon Dec 30, 2019 7:53 pm

Re: Add a program to autostart

Post by klingsor »

I think that the problem is the version of python, bazarr needs 3.6 or greater, but my istallation doesn't recognize that I have installed python 3.8 and I don't know how to change it.

Any suggestion how force to my dietpi to execute python 3.8?

Regards.
User avatar
Joulinar
Posts: 2068
Joined: Sat Nov 16, 2019 12:49 am

Re: Add a program to autostart

Post by Joulinar »

Again my question. Are you able to start the service like this?

Code: Select all

systemctl start bazarr.service
Pls let us know if a solution is working. This could help others if they hit by similar situation. Your DietPi Team
User avatar
johnvick
Legend
Posts: 693
Joined: Wed Jun 08, 2016 11:53 am
Location: New Zealand

Re: Add a program to autostart

Post by johnvick »

Edit your systemd startup script along the lines of:

[Service]
ExecStart=/usr/bin/python3.8 /opt/Bazaar....etc

You can have several Pythons versions installed but only one default, so other version can be used like this.

Reconsider using Docker it gets round this type of Python stuff.

John
klingsor
Posts: 5
Joined: Mon Dec 30, 2019 7:53 pm

Re: Add a program to autostart

Post by klingsor »

This is my /etc/systemd/system/bazarr.service:

Code: Select all

[Unit]
Description=bazarr Daemon
After=syslog.target network.target

[Service]
User=root
Group=root

Type=simple
ExecStart=python /opt/bazarr/bazarr.py
TimeoutStopSec=20
KillMode=process
Restart=on-failure

[Install]
WantedBy=multi-user.target
And this is what I get when I put sudo systemctl start bazarr:

Code: Select all

Failed to start bazarr.service: Unit bazarr.service is not loaded properly: Invalid argument.
See system logs and 'systemctl status bazarr.service' for details.
I have tried with Docker but I have not managed to install anything or start it; I have followed the steps of https://hub.docker.com/r/linuxserver/bazarr, I have copied the Docker Pull Command but I cannot follow. Can someone tell me what are the steps to follow?

If from terminal I write python /opt/bazarr/bazarr.py I start the application but as soon as I close the terminal it ends.
Any ideas?

Thank you very much and greetings.
User avatar
johnvick
Legend
Posts: 693
Joined: Wed Jun 08, 2016 11:53 am
Location: New Zealand

Re: Add a program to autostart

Post by johnvick »

What does
# systemctl status bazarr.service say?

In your systemd script put the full path to python3.8.

Or else, assuming Docker is correctly instaled - run this from CLI: (change paths accordingly then paste)

docker create \
--name=bazarr \
-e PUID=1000 \
-e PGID=1000 \
-e TZ=Europe/London \
-e UMASK_SET=022 `#optional` \
-p 6767:6767 \
-v /home/john/bazarr/config:/config \
-v /mnt/movies:/movies \
-v /mnt/tv:/tv \
--restart unless-stopped \
linuxserver/bazarr

Just tried this works fine

PS - not a good idea to run this as root as you have done. In the docker script UID 1000 will probly be your own user ID but

# id john (in my case) will give you the UID to use.
Post Reply