diff options
author | Timothy Pearson <kb9vqf@pearsoncomputing.net> | 2013-03-21 00:18:37 -0500 |
---|---|---|
committer | Timothy Pearson <kb9vqf@pearsoncomputing.net> | 2013-03-21 00:18:37 -0500 |
commit | ac5d8cedab866edcd70f33badef9e3f18b55c9f3 (patch) | |
tree | 2a87bac5fada9f28bc105ebe4cdd7e15bad1485a /ubuntu/maverick | |
parent | 9729a641b920e937801a31a96b86ac2ea98a1d66 (diff) | |
download | tde-packaging-ac5d8cedab866edcd70f33badef9e3f18b55c9f3.tar.gz tde-packaging-ac5d8cedab866edcd70f33badef9e3f18b55c9f3.zip |
Add certificate updater init files to kcmldap on Debian and Ubuntu
Diffstat (limited to 'ubuntu/maverick')
-rw-r--r-- | ubuntu/maverick/applications/kcmldap/debian/tde-ldap-cert-updater.init | 108 |
1 files changed, 108 insertions, 0 deletions
diff --git a/ubuntu/maverick/applications/kcmldap/debian/tde-ldap-cert-updater.init b/ubuntu/maverick/applications/kcmldap/debian/tde-ldap-cert-updater.init new file mode 100644 index 000000000..4a2ef03ad --- /dev/null +++ b/ubuntu/maverick/applications/kcmldap/debian/tde-ldap-cert-updater.init @@ -0,0 +1,108 @@ +#!/bin/sh +### BEGIN INIT INFO +# Provides: tde-ldap-cert-updater +# Required-Start: $local_fs $remote_fs +# Required-Stop: $local_fs $remote_fs +# Should-Start: console-screen kbd acpid hal krb5-kdc nis +# Should-Stop: console-screen kbd +# Default-Start: 2 3 4 5 +# Default-Stop: 0 1 6 +# Short-Description: TDE LDAP Realm Certificate Update Daemon +# Description: TDE LDAP Realm Certificate Update Daemon +### END INIT INFO +# /etc/init.d/tde-ldap-cert-updater: start or stop the TDE LDAP Realm Certificate Update Daemon +# +# description: TDE LDAP Realm Certificate Update Daemon +# + +. /lib/lsb/init-functions + +set -e + +PATH=/opt/trinity/bin:/usr/bin:/sbin:/usr/sbin:/bin +DAEMON=/opt/trinity/bin/tdeldapcertupdater +PIDFILE=/var/run/tdeldapcertupdater.pid +UPGRADEFILE=/var/run/tdeldapcertupdater.upgrade + +DESC="TDE LDAP Realm Certificate Update Daemon" + +# If we upgraded the daemon, we can't use the --exec argument to +# start-stop-daemon since the inode will have changed. The risk here is that +# in a situation where the daemon died, its pidfile was not cleaned up, and +# some other process is now running under that pid, start-stop-daemon will send +# signals to an innocent process. However, this seems like a corner case. +# C'est la vie! +if [ -e $UPGRADEFILE ]; then + SSD_ARGS="--pidfile $PIDFILE --startas $DAEMON" +else + SSD_ARGS="--pidfile $PIDFILE --exec $DAEMON" +fi + +stillrunning () { + if expr "$(cat /proc/$DAEMONPID/cmdline 2> /dev/null)" : "$DAEMON" > /dev/null 2>&1; then + true + else + # if the daemon does not remove its own pidfile, we will + rm -f $PIDFILE $UPGRADEFILE + false + fi; +} + +case "$1" in + start) + log_action_begin_msg "Starting $DESC" + if start-stop-daemon --background --start --make-pidfile --quiet $SSD_ARGS -- $ARG; then + log_action_end_msg 0 + else + log_warning_msg "already running" + log_action_end_msg 0 + fi + ;; + + restart) + /etc/init.d/tde-ldap-cert-updater stop + if [ -f $PIDFILE ]; then + if stillrunning; then + exit 1 + fi + fi + /etc/init.d/tde-ldap-cert-updater start + ;; + + reload) + log_action_begin_msg "Reloading $DESC" + if start-stop-daemon --stop --signal 1 --quiet $SSD_ARGS; then + log_action_end_msg 0 + else + log_failure_msg "not running" + log_action_end_msg 1 + fi + ;; + + force-reload) + /etc/init.d/tde-ldap-cert-updater reload + ;; + + stop) + log_action_begin_msg "Stopping $DESC" + if [ ! -f $PIDFILE ]; then + log_failure_msg "Not running ($PIDFILE not found)" + log_action_end_msg 0 + exit 0 + else + if start-stop-daemon --stop --quiet $SSD_ARGS; then + log_action_end_msg 0 + else + log_failure_msg "not running" + log_action_end_msg 1 + fi + fi + ;; + + *) + echo "Usage: /etc/init.d/tde-ldap-cert-updater {start|stop|restart|reload|force-reload}" + exit 1 + ;; +esac + +exit 0 |