Skip to content

Instantly share code, notes, and snippets.

@weiser
Created August 14, 2014 22:52
Show Gist options
  • Save weiser/1f3455e64b7051ce0ef1 to your computer and use it in GitHub Desktop.
Save weiser/1f3455e64b7051ce0ef1 to your computer and use it in GitHub Desktop.
From 3beb93369a5557823cffb80494ed43434f4df20d Mon Sep 17 00:00:00 2001
From: David Weiser <davidann@moz.com>
Date: Tue, 12 Aug 2014 10:04:41 -0700
Subject: [PATCH] Use Bigtop to detect $JAVA_HOME
`service` clears most environment variables (see `man service`) so $JAVA_HOME is not set in
kiji-rest.initd. And, because $JAVA_HOME isn't set, I can't run this program via `service`.
This sets $JAVA_HOME if Bigtop is present.
---
kiji-rest/src/main/scripts/kiji-rest.initd | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/kiji-rest/src/main/scripts/kiji-rest.initd b/kiji-rest/src/main/scripts/kiji-rest.initd
index d946a7f..3161a1c 100644
--- a/kiji-rest/src/main/scripts/kiji-rest.initd
+++ b/kiji-rest/src/main/scripts/kiji-rest.initd
@@ -24,6 +24,13 @@
# description: KijiREST Service
#
+# Autodetect JAVA_HOME if not defined
+if [ -e /usr/libexec/bigtop-detect-javahome ]; then
+ . /usr/libexec/bigtop-detect-javahome
+elif [ -e /usr/lib/bigtop-utils/bigtop-detect-javahome ]; then
+ . /usr/lib/bigtop-utils/bigtop-detect-javahome
+fi
+
RETVAL=0
SLEEP_TIME=5
--
1.9.2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment