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 stop_client() {
39 start-stop-daemon --stop --retry 5 --quiet --pidfile ${PIDFILE_CLIENT} --name ${CLIENT}
40 }
42 case "$1" in
43 start) log_daemon_msg "Starting GOsa support infrastructure client"
44 if [ "$START_CLIENT" = "1" -a -x ${DAEMON_CLIENT} ]; then
45 log_progress_msg "client"
46 start_client
47 fi
48 log_end_msg $?
49 ;;
50 stop) log_daemon_msg "Stopping GOsa support infrastructure Client"
51 if [ "$START_CLIENT" = "1" -a -x ${DAEMON_CLIENT} ]; then
52 log_progress_msg "client"
53 stop_client
54 fi
55 log_end_msg $?
56 ;;
57 reload|force-reload|restart) log_daemon_msg "Restarting GOsa support infrastructure client"
58 if [ "$START_CLIENT" = "1" -a -x ${DAEMON_CLIENT} ]; then
59 stop_client
60 start_client
61 fi
62 log_progress_msg "done"
63 log_end_msg $?
64 ;;
65 status)
66 if [ "$START_CLIENT" = "1" -a -x ${DAEMON_CLIENT} ]; then
67 status=0
68 pidofproc -p "${PIDFILE_CLIENT}" "${DAEMON_CLIENT}" >/dev/null || status="$?"
69 log_daemon_msg "Status of GOsa-si client" "${NAME}"
70 if [ "$status" = 0 ]; then
71 log_progress_msg "is running"
72 log_end_msg 0
73 else
74 log_progress_msg "is not running"
75 log_end_msg $status
76 fi
77 fi
78 ;;
80 *) log_action_msg "Usage: /etc/init.d/gosa-si-client {start|stop|restart|reload|force-reload|status}"
81 exit 2
82 ;;
83 esac
84 exit 0