#!/bin/bash # Start/stop the GOsa support daemon infrastructure. # ### BEGIN INIT INFO # Provides: gosa-si # Required-Start: $syslog $time # Required-Stop: $syslog $time # Default-Start: 2 3 4 5 # Default-Stop: 0 1 6 # Short-Description: GOsa message server/client component # Description: gosa-si establishes the communication between a couple of # GOsa hosting servers and optionally clients to do event # signaling for all communication partners. ### END INIT INFO # Load defaults DEBUG=-vvv [ -r /etc/default/gosa-si ] && . /etc/default/gosa-si # Load LSB support functions . /lib/lsb/init-functions start_client() { start-stop-daemon --start --quiet --pidfile /var/run/gosa-si-client.pid --name gosa-si-client --startas /usr/sbin/gosa-si-client -- $DEBUG } start_server() { start-stop-daemon --start --quiet --pidfile /var/run/gosa-si-server.pid --name gosa-si-server --startas /usr/sbin/gosa-si-server -- $1 $DEBUG } stop_client() { start-stop-daemon --stop --retry 5 --quiet --pidfile /var/run/gosa-si-client.pid --name gosa-si-client kill `ps -C gosa-si-client -o pid=` &> /dev/null } stop_server() { start-stop-daemon --stop --retry 5 --quiet --pidfile /var/run/gosa-si-server.pid --name gosa-si-server kill `ps -C gosa-si-server -o pid=` &> /dev/null } case "$1" in start) log_daemon_msg "Starting GOsa support infrastructure" if [ -x /usr/sbin/gosa-si-server ]; then log_progress_msg "daemon" start_server fi if [ "$START_CLIENT" == "1" -a -x /usr/sbin/gosa-si-client ]; then log_progress_msg "client" start_client fi log_end_msg $? ;; stop) log_daemon_msg "Stopping GOsa support infrastructure" if [ "$START_CLIENT" == "1" -a -x /usr/sbin/gosa-si-client ]; then log_progress_msg "client" stop_client fi if [ -x /usr/sbin/gosa-si-server ]; then log_progress_msg "daemon" stop_server fi log_end_msg $? ;; reload|force-reload|restart) log_daemon_msg "Restarting GOsa support infrastructure" if [ "$START_CLIENT" == "1" -a -x /usr/sbin/gosa-si-client ]; then stop_client fi if [ -x /usr/sbin/gosa-si-server ]; then if [ "$START_BUS" == "1" ]; then stop_server start_server else stop_server start_server fi fi if [ "$START_CLIENT" == "1" -a -x /usr/sbin/gosa-si-client ]; then start_client fi log_progress_msg "done" log_end_msg $? ;; *) log_action_msg "Usage: /etc/init.d/gosa-si {start|stop|restart|reload|force-reload}" exit 2 ;; esac exit 0