debian-apache-tika – Diff between revs 1 and 3

Subversion Repositories:
Rev:
Show entire fileIgnore whitespace
Rev 1 Rev 3
Line 15... Line 15...
15   15  
16 # Skip systemd redirect. 16 # Skip systemd redirect.
Line 17... Line 17...
17 _SYSTEMCTL_SKIP_REDIRECT=OHYES 17 _SYSTEMCTL_SKIP_REDIRECT=OHYES
18 18
19 # PATH should only include /usr/* if it runs after the mountnfs.sh script 19 # PATH should only include /usr/* if it runs after the mountnfs.sh script
20 PATH=/sbin:/usr/sbin:/bin:/usr/bin 20 PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
21 DESC="Apache tika content indexing." 21 DESC="Apache Tika content indexing"
22 NAME=tika -  
23 DAEMON=/usr/bin/java 22 NAME=tika
24 DAEMON_ARGS="-jar /usr/share/java/tika-server.jar -h $HOST -p $PORT" 23 DAEMON=/usr/bin/java
25 PIDFILE=/var/run/$NAME.pid -  
26 SCRIPTNAME=/etc/init.d/$NAME -  
27 USER=tika -  
28 GROUP=tika -  
Line 29... Line 24...
29 HOST=localhost 24 PIDFILE=/var/run/$NAME.pid
30 PORT=9998 25 SCRIPTNAME=/etc/init.d/$NAME
Line 31... Line 26...
31 26
32 # Exit if the package is not installed 27 # Exit if the package is not installed
Line 33... Line 28...
33 [ -f "$DAEMON" ] || exit 0 28 [ -x "$DAEMON" ] || exit 0
Line 40... Line 35...
40 35
41 # Define LSB log_* functions. 36 # Define LSB log_* functions.
42 # Depend on lsb-base (>= 3.2-14) to ensure that this file is present 37 # Depend on lsb-base (>= 3.2-14) to ensure that this file is present
43 # and status_of_proc is working. 38 # and status_of_proc is working.
44 . /lib/lsb/init-functions 39 . /lib/lsb/init-functions
-   40  
-   41 # Turn on berbose logging.
-   42 VERBOSE=yes
-   43 # Daemon arguments.
-   44 DAEMON_ARGS="-jar /usr/share/java/tika-server.jar -h ${HOST} -p ${PORT}"
45 45  
46 # 46 #
47 # Function that starts the daemon/service 47 # Function that starts the daemon/service
48 # 48 #
49 do_start() 49 do_start()
50 { 50 {
51 # Return 51 # Return
52 # 0 if daemon has been started 52 # 0 if daemon has been started
53 # 1 if daemon was already running 53 # 1 if daemon was already running
54 # 2 if daemon could not be started 54 # 2 if daemon could not be started
55 start-stop-daemon --start --quiet --pidfile $PIDFILE -c $USER:$GROUP --make-pidfile --exec $DAEMON --background --test > /dev/null \ -  
56 || return 1 55 start-stop-daemon --start --quiet --pidfile $PIDFILE --exec $DAEMON --test > /dev/null || return 1
57 start-stop-daemon --start --quiet --pidfile $PIDFILE -c $USER:$GROUP --make-pidfile --exec $DAEMON --background -- \ -  
58 $DAEMON_ARGS \ -  
59 || return 2 -  
60 # Add code here, if necessary, that waits for the process to be ready -  
61 # to handle requests from services started subsequently which depend -  
62 # on this one. As a last resort, sleep for some time. 56 start-stop-daemon --start --quiet --pidfile $PIDFILE --make-pidfile --exec $DAEMON --background --chuid tika --group tika --startas $DAEMON -- $DAEMON_ARGS > /dev/null || return 2
63 } 57 }
64 -  
65 # -  
66 # Function that stops the daemon/service -  
67 # 58  
68 do_stop() 59 do_stop()
69 { 60 {
70 # Return 61 # Return
71 # 0 if daemon has been stopped 62 # 0 if daemon has been stopped
72 # 1 if daemon was already stopped 63 # 1 if daemon was already stopped
73 # 2 if daemon could not be stopped 64 # 2 if daemon could not be stopped
74 # other if a failure occurred 65 # other if a failure occurred
75 start-stop-daemon --stop --quiet --retry=TERM/30/KILL/5 --pidfile $PIDFILE --name $NAME 66 start-stop-daemon --quiet --stop --retry=TERM/30/KILL/5 --pidfile $PIDFILE --name $DAEMON
76 RETVAL="$?" 67 RETVAL="$?"
77 [ "$RETVAL" = 2 ] && return 2 68 [ "$RETVAL" = 2 ] && return 2
78 # Wait for children to finish too if this is a daemon that forks 69 # Wait for children to finish too if this is a daemon that forks
79 # and if the daemon is only ever run from this initscript. 70 # and if the daemon is only ever run from this initscript.
80 # If the above conditions are not satisfied then add some other code 71 # If the above conditions are not satisfied then add some other code
81 # that waits for the process to drop all resources that could be 72 # that waits for the process to drop all resources that could be
82 # needed by services started subsequently. A last resort is to 73 # needed by services started subsequently. A last resort is to
83 # sleep for some time. 74 # sleep for some time.
84 start-stop-daemon --stop --quiet --oknodo --retry=0/30/KILL/5 --exec $DAEMON 75 start-stop-daemon --stop --quiet --oknodo --retry=0/30/KILL/5 --exec $DAEMON
85 [ "$?" = 2 ] && return 2 76 [ "$?" = 2 ] && return 2
86 # Many daemons don't delete their pidfiles when they exit. 77 # Many daemons don't delete their pidfiles when they exit.
87 rm -f $PIDFILE 78 rm -f $PIDFILE
88 return "$RETVAL" 79 return "$RETVAL"
89 } 80 }
90 -  
91 # -  
92 # Function that sends a SIGHUP to the daemon/service -  
93 # -  
94 do_reload() { -  
95 # -  
96 # If the daemon can reload its configuration without -  
97 # restarting (for example, when it is sent a SIGHUP), -  
98 # then implement that here. -  
99 # -  
100 start-stop-daemon --stop --signal 1 --quiet --pidfile $PIDFILE --name $NAME -  
101 return 0 -  
102 } -  
103 81  
104 case "$1" in 82 case "$1" in
105 start) 83 start)
106 [ "$VERBOSE" != no ] && log_daemon_msg "Starting $DESC" "$NAME" 84 [ "$VERBOSE" != no ] && log_daemon_msg "Starting $DESC" "$NAME"
107 do_start 85 do_start
108 case "$?" in 86 case "$?" in
109 0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;; 87 0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;;
110 2) [ "$VERBOSE" != no ] && log_end_msg 1 ;; 88 2) [ "$VERBOSE" != no ] && log_end_msg 1 ;;
111 esac 89 esac
112 ;; 90 ;;
113 stop) 91 stop)
114 [ "$VERBOSE" != no ] && log_daemon_msg "Stopping $DESC" "$NAME" 92 [ "$VERBOSE" != no ] && log_daemon_msg "Stopping $DESC" "$NAME"
115 do_stop 93 do_stop
116 case "$?" in 94 case "$?" in
117 0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;; 95 0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;;
118 2) [ "$VERBOSE" != no ] && log_end_msg 1 ;; 96 2) [ "$VERBOSE" != no ] && log_end_msg 1 ;;
119 esac -  
120 ;; 97 esac
121 status) -  
122 status_of_proc "$DAEMON" "$NAME" && exit 0 || exit $? -  
123 ;; -  
124 #reload|force-reload) -  
125 # -  
126 # If do_reload() is not implemented then leave this commented out -  
127 # and leave 'force-reload' as an alias for 'restart'. -  
128 # -  
129 #log_daemon_msg "Reloading $DESC" "$NAME" -  
130 #do_reload -  
131 #log_end_msg $? -  
132 #;; 98 ;;
133 restart|force-reload) -  
134 # -  
135 # If the "reload" option is implemented then remove the -  
136 # 'force-reload' alias -  
137 # 99 restart|force-reload)
138 log_daemon_msg "Restarting $DESC" "$NAME" 100 log_daemon_msg "Restarting $DESC" "$NAME"
139 do_stop 101 do_stop
140 case "$?" in 102 case "$?" in
141 0|1) 103 0|1)
142 do_start 104 do_start
143 case "$?" in 105 case "$?" in
144 0) log_end_msg 0 ;; 106 0) log_end_msg 0 ;;
145 1) log_end_msg 1 ;; # Old process is still running 107 1) log_end_msg 1 ;; # Old process is still running
146 *) log_end_msg 1 ;; # Failed to start 108 *) log_end_msg 1 ;; # Failed to start
147 esac 109 esac
148 ;; 110 ;;
149 *) 111 *)
150 # Failed to stop 112 # Failed to stop
151 log_end_msg 1 113 log_end_msg 1
152 ;; 114 ;;
153 esac 115 esac
154 ;; 116 ;;
155 *) 117 *)
156 #echo "Usage: $SCRIPTNAME {start|stop|restart|reload|force-reload}" >&2 -  
157 echo "Usage: $SCRIPTNAME {start|stop|status|restart|force-reload}" >&2 118 echo "Usage: $SCRIPTNAME {start|stop|restart|force-reload}" >&2
158 exit 3 119 exit 3
159 ;; 120 ;;
160 esac -  
161 -