1 #!/bin/sh
2 # Start/stop the GOsa support daemon infrastructure.
3 #
4 ### BEGIN INIT INFO
5 # Provides: gosa-si-client
6 # Required-Start: $network $remote_fs $named $syslog $time
7 # Required-Stop: $network $remote_fs $named $syslog $time
8 # Default-Start: 2 3 4 5
9 # Default-Stop: 0 1 6
10 # Short-Description: GOsa message server/client component
11 # Description: gosa-si establishes the communication between a couple of
12 # GOsa hosting servers and optionally clients to do event
13 # signaling for all communication partners.
14 ### END INIT INFO
16 # variables for the gosa-si client.
17 CLIENT="gosa-si-client"
18 DAEMON_CLIENT="/usr/sbin/${CLIENT}"
19 RUN_DIRECTORY="/var/run/gosa-si"
20 PIDFILE_CLIENT="$RUN_DIRECTORY/${CLIENT}.pid"
22 PATH="/sbin:/usr/sbin:/bin:/usr/bin"
24 # Load defaults
25 [ -r /etc/default/gosa-si-client ] && . /etc/default/gosa-si-client
27 # Load LSB support functions
28 . /lib/lsb/init-functions
30 if [ ! -d "/var/run/gosa-si" ]; then
31 mkdir $RUN_DIRECTORY
32 fi
34 start_client() {
35 start-stop-daemon --start --quiet --pidfile ${PIDFILE_CLIENT} --name ${CLIENT} --startas ${DAEMON_CLIENT} -- $DEBUG
36 }
38 # to be rewritten ugly !!
39 stop_client() {
40 start-stop-daemon --stop --retry 5 --quiet --pidfile ${PIDFILE_CLIENT} --name ${CLIENT}
41 kill `ps -C gosa-si-client -o pid=` > /dev/null 2>&1
42 ! ps -C gosa-si-client -o pid= > /dev/null 2>&1
43 }
45 case "$1" in
46 start) log_daemon_msg "Starting GOsa support infrastructure client"
47 if [ "$START_CLIENT" = "1" -a -x ${DAEMON_CLIENT} ]; then
48 log_progress_msg "client"
49 start_client
50 fi
51 log_end_msg $?
52 ;;
53 stop) log_daemon_msg "Stopping GOsa support infrastructure Client"
54 if [ "$START_CLIENT" = "1" -a -x ${DAEMON_CLIENT} ]; then
55 log_progress_msg "client"
56 stop_client
57 fi
58 log_end_msg $?
59 ;;
60 reload|force-reload|restart) log_daemon_msg "Restarting GOsa support infrastructure client"
61 if [ "$START_CLIENT" = "1" -a -x ${DAEMON_CLIENT} ]; then
62 stop_client
63 start_client
64 fi
65 log_progress_msg "done"
66 log_end_msg $?
67 ;;
68 status)
69 if [ "$START_CLIENT" = "1" -a -x ${DAEMON_CLIENT} ]; then
70 status=0
71 pidofproc -p "${PIDFILE_CLIENT}" "${DAEMON_CLIENT}" >/dev/null || status="$?"
72 log_daemon_msg "Status of GOsa-si client" "${NAME}"
73 if [ "$status" = 0 ]; then
74 log_progress_msg "is running"
75 log_end_msg 0
76 else
77 log_progress_msg "is not running"
78 log_end_msg $status
79 fi
80 fi
81 ;;
83 *) log_action_msg "Usage: /etc/init.d/gosa-si-client {start|stop|restart||reload|force-reload|status}"
84 exit 2
85 ;;
86 esac
87 exit 0