Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Better handling of openHAB startup problems in systemd #70

Closed
ThomDietrich opened this issue Jul 13, 2017 · 2 comments
Closed

Better handling of openHAB startup problems in systemd #70

ThomDietrich opened this issue Jul 13, 2017 · 2 comments
Assignees

Comments

@ThomDietrich
Copy link
Member

ThomDietrich commented Jul 13, 2017

Hey all, Hey @BClark09,

we are seeing problems similar to this quite often.

To the extend of your knowledge, can you think of any easy or practical way to have systemctl status actually report startup failures? It might be worth it to look into this topic. Best! Thomas

Also see: openhab/openhabian#50 (comment)

@BClark09
Copy link
Member

BClark09 commented Jul 13, 2017

The output of systemctl status openhab2 --full and sudo journalctl -u openhab -b both give as much information as start.sh distribution provides. If start.sh continues successfully, then the service doesn't care what /usr/share/openhab2/runtime/karaf.

I don't know why start.sh exists, but if it's just to set the working directory for manual setups, we do this in the service script already, so should run the Karaf file directly. We should also remove the restart on failure flag (as the last error message will always be about too many restart attempts) and use a service file such as:

openhab2.service

[Unit]
Description=openHAB 2 - empowering the smart home
Documentation=http://docs.openhab.org
Documentation=https://community.openhab.org
Wants=network-online.target
After=network-online.target

[Service]
Environment=OPENHAB_HOME=/usr/share/openhab2
Environment=OPENHAB_CONF=/etc/openhab2
Environment=OPENHAB_RUNTIME=/usr/share/openhab2/runtime
Environment=OPENHAB_USERDATA=/var/lib/openhab2
Environment=OPENHAB_LOGDIR=/var/log/openhab2
Environment=OPENHAB_STARTMODE=daemon
EnvironmentFile=-/etc/default/openhab2
User=openhab
Group=openhab
WorkingDirectory=/usr/share/openhab2
ExecStart=/usr/share/openhab2/runtime/bin/karaf $OPENHAB_STARTMODE
ExecStop=/usr/share/openhab2/runtime/bin/stop
TimeoutStopSec=120

[Install]
WantedBy=multi-user.target

/etc/default/openhab2 additions

#OPENHAB_STARTMODE=debug

wdyt?

@BClark09 BClark09 self-assigned this Jul 13, 2017
@ThomDietrich
Copy link
Member Author

Sounds and looks good! I will not be able to test now, will do that tomorrow!
I'll also look into sd_notify.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants