mycontroller-org / mycontroller-v1-legacy

The Open Source Controller
http://www.MyController.org
Apache License 2.0
147 stars 90 forks source link

Running as service on a pi... #333

Closed ghost closed 5 years ago

ghost commented 7 years ago

I tried to create a service on a pi...

sudo nano /lib/systemd/system/mycontroller.service
sudo chmod 644 /lib/systemd/system/mycontroller.service
sudo systemctl daemon-reload
sudo systemctl enable mycontroller.service
sudo systemctl start mycontroller.service
sudo systemctl status mycontroller.service

mycontroller.service

[Unit]
Description=mycontroller
After=multi-user.target

[Service]
Type=simple
ExecStart=/usr/bin/java  -Xms8m -Xmx100m -Dlogback.configurationFile=/home/pi/mycontroller/conf/logback.xml -Dmc.conf.file=/home/pi/mycontroller/conf/mycontroller.properties -cp /home/pi/mycontroller/lib/* org.mycontroller.standalone.StartApp
Restart=on-abort

[Install]
WantedBy=multi-user.target

which works great for a while (at least if I disable the broker and http on my system :-), but then something went wrong in the configuration and it broke... (with a broker)

So... i wanted to start over again so i removed the folder (which I though contains all the config and stuff), unzip it again in the same place. And as user pi this works great, grand new setup! But when I run it as service... I get the same gateways instead of beginning fresh... it seems it stores some information about gateways... somewhere else, so so how do I completely uninstall all config/setup/db files and start again???

now I am just stuck with local user and no service.

latest jessie with java 1.8 & mosquitto server

ghost commented 7 years ago

btw the issue I was having is a subscribed to a mtqq which apparently is not a mysensor... it mtqq stil connects, but I tried to delete it, since it was wrong... I just can't... now when it loads, almost all buttons including profile and settings are non functioning....

also running the start.sh as service will always result in a dead process...

ghost commented 7 years ago

ok i solved my own problem :-)

sudo find / -mtime -1 -print

it stores it in

/home/conf/

still i though i gave the arguments correctly in the service script... why does it not use that? :-)

ghost commented 7 years ago

just for the fun of it,.. i put it all the sub folders in /home

sudo /usr/bin/java -Xms8m -Xmx100m -Dlogback.configurationFile=/home/conf/logback.xml -Dmc.conf.file=/home/conf/mycontroller.properties -cp /home/lib/* org.mycontroller.standalone.StartApp

gives

screen shot 2017-01-01 at 18 11 10 1

if i run it without sudo it runs perfect.. so how do i run it as a service?

Avamander commented 6 years ago

@Tristan79 Create an user for mycontroller, then use "User=[username]" in your unit file and it should work, it works for me.

jkandasa commented 6 years ago

@Tristan79 Do you change anything here? https://github.com/mycontroller-org/mycontroller/blob/development/dist/src/main/package/conf/mycontroller.properties#L90

jkandasa commented 5 years ago

seems creator not interested anymore on this issue.