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 20, 2017
1 parent 75aafe3 commit 422043a
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 4 deletions.
7 changes: 7 additions & 0 deletions resources/etc/default/openhab2
Original file line number Diff line number Diff line change
Expand Up @@ -29,3 +29,10 @@ EXTRA_JAVA_OPTS=""
#
#OPENHAB_USER=openhab
#OPENHAB_GROUP=openhab
#
# The Karaf startmode for the openHAB runtime. Only available for systemctl/systemd systems.
# Defaults to daemon when unset here. Multiple options can be used without quotes.
# debug increases log output. daemon launches the Karaf/openHAB processes.
#
#
#OPENHAB_STARTMODE=debug
15 changes: 11 additions & 4 deletions resources/systemd/openhab2.service
Original file line number Diff line number Diff line change
Expand Up @@ -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 422043a

Please sign in to comment.