Skip to content

Commit

Permalink
Refactor systemd service to output karaf log
Browse files Browse the repository at this point in the history
Signed-off-by: Ben Clark <ben@benjyc.uk>
  • Loading branch information
BClark09 committed Jul 19, 2017
1 parent 75aafe3 commit 3772481
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 5 deletions.
5 changes: 5 additions & 0 deletions resources/etc/default/openhab2
Original file line number Diff line number Diff line change
Expand Up @@ -29,3 +29,8 @@ EXTRA_JAVA_OPTS=""
#
#OPENHAB_USER=openhab
#OPENHAB_GROUP=openhab
#
# The startmode for the openHAB runtime. Only available for systemctl/systemd systems.
# Defaults to daemon when unset here.
#
#OPENHAB_STARTMODE=debug
17 changes: 12 additions & 5 deletions resources/systemd/openhab2.service
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[Unit]
Description=openHAB 2 - empowering the smart home
Description=openHAB 2 - Empowering the smart home
Documentation=http://docs.openhab.org
Documentation=https://community.openhab.org
Wants=network-online.target
Expand All @@ -11,15 +11,22 @@ 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/start.sh server
ExecStop=/usr/share/openhab2/runtime/bin/stop
# Shutdown delay in seconds, before process is tried to be killed with KILL (if configured)
TimeoutStopSec=120
ExecStart=/usr/share/openhab2/runtime/bin/karaf $OPENHAB_STARTMODE
ExecStop=/usr/share/openhab2/runtime/bin/karaf stop

SuccessExitStatus=0 143
RestartSec=5
Restart=on-failure
TimeoutStopSec=120

LimitNOFILE=102642

[Install]
WantedBy=multi-user.target

0 comments on commit 3772481

Please sign in to comment.