[packages/onelogin-ldap_connector] init: handle pidfile writing
glen
glen at pld-linux.org
Thu Sep 24 16:34:47 CEST 2015
commit 3e019d093104e02d8b7f7c41e6cf89fdf4a247a3
Author: Elan Ruusamäe <glen at delfi.ee>
Date: Thu Sep 24 17:34:23 2015 +0300
init: handle pidfile writing
ol-ldapc.init | 26 ++++++++++++++++++++------
ol-ldapc.sysconfig | 3 +++
onelogin-ldap_connector.spec | 2 +-
3 files changed, 24 insertions(+), 7 deletions(-)
---
diff --git a/onelogin-ldap_connector.spec b/onelogin-ldap_connector.spec
index 4511ef6..b694e4e 100644
--- a/onelogin-ldap_connector.spec
+++ b/onelogin-ldap_connector.spec
@@ -4,7 +4,7 @@
Summary: Onelogin Directory Integration
Name: onelogin-ldap_connector
Version: 1.25
-Release: 0.4
+Release: 0.5
License: ?
Group: Libraries
# Forever free account can be obtained from https://www.onelogin.com/signup
diff --git a/ol-ldapc.init b/ol-ldapc.init
index d601724..e3b1d00 100755
--- a/ol-ldapc.init
+++ b/ol-ldapc.init
@@ -28,6 +28,8 @@ BASEDN="dc=example,dc=org"
TOKEN=""
SYNC_INTERVAL=30
OBJECT_CLASSES="posixAccount"
+JAVA_OPTIONS="-XX:-UseGCOverheadLimit -Xmx64M -Xms64M"
+OPTIONS=""
# Get service config - may override defaults
[ -f /etc/sysconfig/ol-ldapc ] && . /etc/sysconfig/ol-ldapc
@@ -35,6 +37,20 @@ OBJECT_CLASSES="posixAccount"
appdir="/usr/lib/ol-ldapc"
pidfile="/var/run/ol-ldapc.pid"
+daemon_start() {
+ java \
+ -jar $appdir/ldap-connector.jar \
+ --sync-interval "$SYNC_INTERVAL" \
+ --object-classes "$OBJECT_CLASSES" \
+ --base-dn "$BASEDN" \
+ --token "$TOKEN" \
+ $OPTIONS \
+ > /dev/null 2>&1 &
+ RETVAL=$?
+ pid=$!
+ echo "$pid" > $pidfile
+}
+
start() {
# Check if the service is already running?
if [ -f /var/lock/subsys/ol-ldapc ]; then
@@ -43,12 +59,7 @@ start() {
fi
msg_starting "OneLogin LDAP Connector"
- daemon --fork --chdir "$appdir" \
- java -XX:-UseGCOverheadLimit -Xmx64M -Xms64M -jar "$appdir/ldap-connector.jar" \
- --sync-interval "$SYNC_INTERVAL" \
- --object-classes "$OBJECT_CLASSES" \
- --base-dn "$BASEDN" \
- --token "$TOKEN"
+ daemon --chdir "$appdir" setsid "$0" daemon_start
RETVAL=$?
[ $RETVAL -eq 0 ] && touch /var/lock/subsys/ol-ldapc
}
@@ -95,6 +106,9 @@ case "$1" in
force-reload)
condrestart 7
;;
+ daemon_start)
+ daemon_start "$@"
+ ;;
status)
status --pidfile $pidfile ol-ldapc java
RETVAL=$?
diff --git a/ol-ldapc.sysconfig b/ol-ldapc.sysconfig
index d47f9cc..36dcf7d 100644
--- a/ol-ldapc.sysconfig
+++ b/ol-ldapc.sysconfig
@@ -11,3 +11,6 @@ SYNC_INTERVAL=30
# LDAP object classes to sync
OBJECT_CLASSES="posixAccount"
+
+# Any other options
+OPTIONS=""
================================================================
---- gitweb:
http://git.pld-linux.org/gitweb.cgi/packages/onelogin-ldap_connector.git/commitdiff/3e019d093104e02d8b7f7c41e6cf89fdf4a247a3
More information about the pld-cvs-commit
mailing list