Need help getting 3.0 to run as a daemon in the background

using the -d switch causes appdaemon to hangup on startup.
I am using the following command in an init.d script
appdaemon -c /root/.homeassistant/appdaemon/conf/ -p /var/run/app-da.pid -d

The error log shows the conf sections are empty however if I drop the -d it starts up correctly.

This is the debug log with -d

2018-03-15 23:02:13.048481 INFO AppDaemon Version 3.0.0b5 starting
2018-03-15 23:02:13.048629 INFO Configuration read from: /root/.homeassistant/appdaemon/conf/appdaemon.yaml
2018-03-15 23:02:13.048692 DEBUG AppDaemon Section: None
2018-03-15 23:02:13.048750 DEBUG HADashboard Section: None

i think you run the command as the wrong user, causing that the appdaemon.yaml cant be read.

Currently I’m using root to test.

running as root isnt advisable.
i had some processes that i would like to run as root(sudo) so i tried running AD as root, only to find out that there other libs and processes that wont work with root.

VLC is 1 example that cant be run with root.

i cant say (with the very little information that you give) that the root user is the problem, but i would suggest to run as another user.

I would be happy to provide more information. I came from an Appdaemon 2 install and made the changes to my configs for 3. As of right now app daemon will not start as a daemon.

here is my config file.

appdaemon:
  disable_apps: 1
  threads: 10
  api_port: 5001
  plugins:
    HASS:
      type: hass
      ha_url: http://192.168.X.X:8123
      namespace: default
# Apps
hadashboard:
  dash_url: http://192.168.X.X:3030
  dashboard_dir: /root/.homeassistant/appdaemon/conf/dashboards/
log:
  accessfile: /root/.homeassistant/appdaemon/logs/access.log
  errorfile: /root/.homeassistant/appdaemon/logs/error.log
  logfile: /root/.homeassistant/appdaemon/logs/log.log
  log_generations: 3

yaml seems correct.
does it start correct when you try to start it with the same command as sudo in a terminal?

Hi ReneTode, possibly a stupid question; I have some addons showing me “Warning: Mosquitto should not be run as root/administrator.” How can I change this to run as a regular user and not ROOT?
Thanks

do you talk about apps or addons?
is this a hassio or an appdaemon question?

I am regarding to HASSIO (I installed an addon Mosquito).

As I read though the log, I see a warning that Mosquito is run as ROOT, which is not wise and shouldn’t.

Any idea how I can alter this (and other addons) to be run as a regular user rather than ROOT?

Thanks Rene

i am sorry but i have no idea about hassio.
you better start a new topic in the hassio section about that.

Thanks Rene,

I will

Did you ever get this fixed rabittn? I seem to have the same problem - runs fine in foreground but doesn’t start properly if i place it with the background.

This is with appdaemon running as a non root user - where all the files it reads are owned by that user.

how do you start it at the foreground and how are you trying to start it at the background?

Starting it in the foreground like this:

appdaemon  -D DEBUG -p /home/haas/appdaemon/appdaemon.pid -c /home/haas/appdaemon/config

Starting it in the background like this:

appdaemon  -d -D DEBUG -p /home/haas/appdaemon/appdaemon.pid -c /home/haas/appdaemon/config

The second invocation results in the following logs:

2018-12-12 22:53:27.499586 INFO AppDeamon Exited
2018-12-12 22:58:08.973002 INFO AppDaemon Version 3.0.2 starting
2018-12-12 22:58:08.974336 INFO Configuration read from: /home/haas/appdaemon/config/appdaemon.yaml
2018-12-12 22:58:08.975201 DEBUG AppDaemon Section: None
2018-12-12 22:58:08.975937 DEBUG HADashboard Section: None

try using it without debug.
debug mode is for debugging not for normal use. could be that debug and deamon running disturb each other.

That was what I originally tried - I turned on debug once it didn’t work, if I turn off debug it still doesn’t work.

and without the -p ?

The original command line I used was this:

appdaemon  -d  -c /home/haas/appdaemon/config

This also doesn’t work. I added the -p just in case it needed a pid file in daemon mode. I then added the -D DEBUG to try and see what stage it got to before hanging.

hmm, that should work as normal.
what kind of system are you running on?

Raspberry pi running ubuntu 16.04.5 LTS. I’m using the version of python3 that comes with the distro - and creating a virtualenv environment as described on the appdaemon documentation page.

I think this is a red herring though, I don’t see that this should make a difference to something that’s interpreted and where the lowest level interface are its network connections - and besides it’s clear that at least one other person has the same issue.