#!/bin/sh # # fedora-ds-admin This script starts or stops the Fedora Directory # Server (FDS) administration server. # # chkconfig: - 90 10 # description: The FDS administration server allows you to control and \ # monitor one or more FDS instances. # pidfile: /opt/fedora-ds/admin-serv/logs/pid # Source function library. . /etc/rc.d/init.d/functions # Source networking configuration. . /etc/sysconfig/network # Check that networking is up. [ "$NETWORKING" = "no" ] && exit 0 title="Fedora Directory Server administration server" short_title="fedora-ds-admin" lockfile=/var/lock/subsys/fedora-ds-admin fedora_ds=/opt/fedora-ds start() { action $"Starting $title: " "$fedora_ds/start-admin" retval=$? [ $retval -eq 0 ] && touch $lockfile return $retval } stop() { action $"Stopping $title: " "$fedora_ds/stop-admin" retval=$? [ $retval -eq 0 ] && rm -f $lockfile return $retval } restart() { stop start } reload() { restart } force_reload() { restart } fdr_status() { # This is all copied from /etc/init.d/functions' status(), with a # few parts changed to take into account the fact that there's no # unique command name associated with a particular FDS instance. local pid pid_file pid_file="$fedora_ds/admin-serv/logs/pid" if [ -f "$pid_file" ] ; then read pid < "$pid_file" if [ -e "/proc/$pid" ]; then echo $"${short_title} (pid $pid) is running..." return 0 elif [ -n "$pid" ]; then echo $"${short_title} dead but pid file exists" return 1 fi fi # See if the lockfile exists if [ -f "$lockfile" ]; then echo $"${short_title} dead but subsys locked" return 2 fi echo $"${short_title} is stopped" return 3 } case "$1" in start|stop|restart|reload) $1 ;; force-reload) force_reload ;; status) fdr_status ;; condrestart|try-restart) [ ! -f $lockfile ] || restart ;; *) echo $"Usage: $0 {start|stop|status|restart|try-restart|reload|force-reload}" exit 2 esac