3 # Provides: ccdbservice
4 # Required-Start: $network
6 # Default-Start: 2 3 4 5
8 # Short-Description: Starts the ccdbservice daemon
9 # Description: CCDBService is part of the CCDB package. It is a daemon
10 # that runs in the background and responds to triggers which
11 # indicate updates to Clearcase UCM data. Such data is stored
12 # in CCDB in order to provide quicker access to UCM metadata.
15 # Author: Andrew DeFaria <Andrew@ClearSCM.com>
19 # PATH should only include /usr/* if it runs after the mountnfs.sh script
20 PATH=/sbin:/usr/sbin:/bin:/usr/bin
24 # Need to determine where this gets place. For now this is the path into my
26 CCDBBASE=/view/adefaria_tools/vob/adpscmtools/CCDB
27 DAEMON=$CCDBBASE/$NAME
28 PIDFILE=$CCDBBASE/$NAME.pid
30 SCRIPTNAME=/etc/init.d/$NAME
33 # Exit if the package is not installed
34 [ -x "$DAEMON" ] || exit 0
36 # Read configuration variable file if it is present
37 [ -r /etc/default/$NAME ] && . /etc/default/$NAME
39 # Load the VERBOSE setting and other rcs variables
42 # Define LSB log_* functions.
43 # Depend on lsb-base (>= 3.0-6) to ensure that this file is present.
44 . /lib/lsb/init-functions
47 # Function that starts the daemon/service
52 # 0 if daemon has been started
53 # 1 if daemon was already running
54 # 2 if daemon could not be started
55 start-stop-daemon --start --quiet --pidfile $PIDFILE --exec $DAEMON --test > /dev/null \
57 start-stop-daemon --start --quiet --pidfile $PIDFILE --exec $DAEMON \
64 # Function that stops the daemon/service
69 # 0 if daemon has been stopped
70 # 1 if daemon was already stopped
71 # 2 if daemon could not be stopped
72 # other if a failure occurred
73 start-stop-daemon --stop --quiet --retry=TERM/30/KILL/5 --pidfile $PIDFILE --name $NAME
75 [ "$RETVAL" = 2 ] && return 2
76 # Wait for children to finish too if this is a daemon that forks
77 # and if the daemon is only ever run from this initscript.
78 # If the above conditions are not satisfied then add some other code
79 # that waits for the process to drop all resources that could be
80 # needed by services started subsequently. A last resort is to
81 # sleep for some time.
82 start-stop-daemon --stop --quiet --oknodo --retry=0/30/KILL/5 --exec $DAEMON
83 [ "$?" = 2 ] && return 2
84 # Many daemons don't delete their pidfiles when they exit.
90 # Function that sends a SIGHUP to the daemon/service
94 # If the daemon can reload its configuration without
95 # restarting (for example, when it is sent a SIGHUP),
96 # then implement that here.
98 start-stop-daemon --stop --signal 1 --quiet --pidfile $PIDFILE --name $NAME
104 [ "$VERBOSE" != no ] && log_daemon_msg "Starting $DESC" "$NAME"
107 0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;;
108 2) [ "$VERBOSE" != no ] && log_end_msg 1 ;;
112 [ "$VERBOSE" != no ] && log_daemon_msg "Stopping $DESC" "$NAME"
115 0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;;
116 2) [ "$VERBOSE" != no ] && log_end_msg 1 ;;
120 status_of_proc "$DAEMON" "$NAME" && exit 0 || exit $?
122 #reload|force-reload)
124 # If do_reload() is not implemented then leave this commented out
125 # and leave 'force-reload' as an alias for 'restart'.
127 #log_daemon_msg "Reloading $DESC" "$NAME"
131 restart|force-reload)
133 # If the "reload" option is implemented then remove the
134 # 'force-reload' alias
136 log_daemon_msg "Restarting $DESC" "$NAME"
143 1) log_end_msg 1 ;; # Old process is still running
144 *) log_end_msg 1 ;; # Failed to start
154 #echo "Usage: $SCRIPTNAME {start|stop|restart|reload|force-reload}" >&2
155 echo "Usage: $SCRIPTNAME {start|stop|status|restart|force-reload}" >&2