# Add a program to autostart

**URL:** https://dietpi.com/forum/t/add-a-program-to-autostart/3703
**Category:** Troubleshooting
**Created:** [30 December 2019 19:01 UTC](https://dietpi.com/forum/t/add-a-program-to-autostart/3703 "2019-12-30T19:01:58Z")
**Posts on this page:** 13
**Page:** 1

<div class="post-metadata">

### Author: ![klingsor](https://dietpi.com/forum/letter_avatar_proxy/v4/letter/k/edb3f5/32.png) [@klingsor](https://dietpi.com/forum/u/klingsor)
#### Post date: [30 December 2019 19:01 UTC](https://dietpi.com/forum/t/add-a-program-to-autostart/3703/1 "2019-12-30T19:01:58Z")

</div>

I recently installed [Bazarr](https://www.bazarr.media/) 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.

---

<div class="post-metadata">

### Author: ![Joulinar](https://dietpi.com/forum/user_avatar/dietpi.com/joulinar/32/57_2.png) [@Joulinar](https://dietpi.com/forum/u/Joulinar)
#### Post date: [30 December 2019 20:35 UTC](https://dietpi.com/forum/t/add-a-program-to-autostart/3703/2 "2019-12-30T20:35:30Z")

</div>

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/wiki/systemd-service-file-for-Debian-Ubuntu](https://github.com/morpheus65535/bazarr/wiki/systemd-service-file-for-Debian-Ubuntu)

Google is your friend 🕶

---

<div class="post-metadata">

### Author: ![klingsor](https://dietpi.com/forum/letter_avatar_proxy/v4/letter/k/edb3f5/32.png) [@klingsor](https://dietpi.com/forum/u/klingsor)
#### Post date: [2 January 2020 16:39 UTC](https://dietpi.com/forum/t/add-a-program-to-autostart/3703/3 "2020-01-02T16:39:47Z")

</div>

Thanks, I follow the instructions but I cannot make it to start with the Pi ☹ Maybe it is not compatible with Dietpi.

---

<div class="post-metadata">

### Author: ![johnvick](https://dietpi.com/forum/user_avatar/dietpi.com/johnvick/32/16_2.png) [@johnvick](https://dietpi.com/forum/u/johnvick)
#### Post date: [2 January 2020 17:10 UTC](https://dietpi.com/forum/t/add-a-program-to-autostart/3703/4 "2020-01-02T17:10:35Z")

</div>

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

---

<div class="post-metadata">

### Author: ![Joulinar](https://dietpi.com/forum/user_avatar/dietpi.com/joulinar/32/57_2.png) [@Joulinar](https://dietpi.com/forum/u/Joulinar)
#### Post date: [2 January 2020 18:00 UTC](https://dietpi.com/forum/t/add-a-program-to-autostart/3703/5 "2020-01-02T18:00:22Z")

</div>

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

```nohighlight
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

```nohighlight
 systemctl start bazarr.service

```

is that working? you can check the status as follow

```nohighlight
systemctl status bazarr.service

```

it should deliver something like this

```nohighlight
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/

```

---

<div class="post-metadata">

### Author: ![klingsor](https://dietpi.com/forum/letter_avatar_proxy/v4/letter/k/edb3f5/32.png) [@klingsor](https://dietpi.com/forum/u/klingsor)
#### Post date: [4 January 2020 10:44 UTC](https://dietpi.com/forum/t/add-a-program-to-autostart/3703/6 "2020-01-04T10:44:40Z")

</div>

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.

---

<div class="post-metadata">

### Author: ![Joulinar](https://dietpi.com/forum/user_avatar/dietpi.com/joulinar/32/57_2.png) [@Joulinar](https://dietpi.com/forum/u/Joulinar)
#### Post date: [4 January 2020 13:56 UTC](https://dietpi.com/forum/t/add-a-program-to-autostart/3703/7 "2020-01-04T13:56:50Z")

</div>

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

```nohighlight
systemctl start bazarr.service

```

---

<div class="post-metadata">

### Author: ![johnvick](https://dietpi.com/forum/user_avatar/dietpi.com/johnvick/32/16_2.png) [@johnvick](https://dietpi.com/forum/u/johnvick)
#### Post date: [4 January 2020 20:59 UTC](https://dietpi.com/forum/t/add-a-program-to-autostart/3703/8 "2020-01-04T20:59:37Z")

</div>

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

---

<div class="post-metadata">

### Author: ![klingsor](https://dietpi.com/forum/letter_avatar_proxy/v4/letter/k/edb3f5/32.png) [@klingsor](https://dietpi.com/forum/u/klingsor)
#### Post date: [10 January 2020 17:38 UTC](https://dietpi.com/forum/t/add-a-program-to-autostart/3703/9 "2020-01-10T17:38:32Z")

</div>

This is my _/etc/systemd/system/bazarr.service_:

```nohighlight
[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_:

```nohighlight
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](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.

---

<div class="post-metadata">

### Author: ![johnvick](https://dietpi.com/forum/user_avatar/dietpi.com/johnvick/32/16_2.png) [@johnvick](https://dietpi.com/forum/u/johnvick)
#### Post date: [10 January 2020 18:29 UTC](https://dietpi.com/forum/t/add-a-program-to-autostart/3703/10 "2020-01-10T18:29:22Z")

</div>

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.

---

<div class="post-metadata">

### Author: ![Joulinar](https://dietpi.com/forum/user_avatar/dietpi.com/joulinar/32/57_2.png) [@Joulinar](https://dietpi.com/forum/u/Joulinar)
#### Post date: [10 January 2020 19:03 UTC](https://dietpi.com/forum/t/add-a-program-to-autostart/3703/11 "2020-01-10T19:03:12Z")

</div>

To which directory you installed bazarr?

---

<div class="post-metadata">

### Author: ![klingsor](https://dietpi.com/forum/letter_avatar_proxy/v4/letter/k/edb3f5/32.png) [@klingsor](https://dietpi.com/forum/u/klingsor)
#### Post date: [10 January 2020 20:36 UTC](https://dietpi.com/forum/t/add-a-program-to-autostart/3703/12 "2020-01-10T20:36:42Z")

</div>

> [@](#):
>
> What does # systemctl status bazarr.service say?

This is my systemctl status bazarr.service

```plaintext
bazarr.service - bazarr Daemon
  Loaded: error (Reason: Invalid argument)
  Active: inactive (dead)

```

I don’t know what is the Invalid argument.

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

I think that this is the full path /usr/local/bin/python, I follow this instructions for the instalation of python 3.8:

> **[How to install Python 3.8 on Raspberry Pi (Raspbian) - installvirtual](https://installvirtual.com/how-to-install-python-3-8-on-raspberry-pi-raspbian/)**
>
> How to install Python 3.8 on Raspberry Pi (Raspbian) In this tutorial, I will show you how to install Python 3.8.0 on Raspberry Pi running

> [@](#):
>
> To which directory you installed bazarr?

The path is /opt/bazarr/bazarr.py.

Thanks for all.

---

<div class="post-metadata">

### Author: ![Joulinar](https://dietpi.com/forum/user_avatar/dietpi.com/joulinar/32/57_2.png) [@Joulinar](https://dietpi.com/forum/u/Joulinar)
#### Post date: [10 January 2020 21:17 UTC](https://dietpi.com/forum/t/add-a-program-to-autostart/3703/13 "2020-01-10T21:17:54Z")

</div>

Hi,

somehow your config file for the service looks different than the file described on the Bazarr install guide. You are missing some lines unter [Service]

```nohighlight
[Unit]
Description=Bazarr Daemon
After=syslog.target network.target
# After=syslog.target network.target sonarr.service radarr.service

[Service]
WorkingDirectory=/opt/bazarr/
User=your_user(username of your choice)
Group=your_group(group of your choice)
UMask=0002
Restart=on-failure
RestartSec=5
Type=simple
ExecStart=/usr/bin/python /opt/bazarr/bazarr.py
KillSignal=SIGINT
TimeoutStopSec=20
SyslogIdentifier=bazarr
ExecStartPre=/bin/sleep 30

[Install]
WantedBy=multi-user.target

```

To check which python you are running, you can type the following to command line

```nohighlight
which python

```
