Created
January 26, 2016 17:01
-
-
Save nekulin/5f9ee3b9bff04bbce4a7 to your computer and use it in GitHub Desktop.
/etc/init.d/apache-tika
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
case "${1:-''}" in | |
'start') | |
if test -f /tmp/apache-tika.pid | |
then | |
echo "Tita is already running." | |
else | |
java -jar /var/lib/apache-tika/tika-server-1.9.jar > /var/log/apache-tika/output.log 2> /var/log/apache-tika/error.log & echo $! > /tmp/apache-tika.pid | |
echo "Starting Tika..." | |
error=$? | |
if test $error -gt 0 | |
then | |
echo "${bon}Error $error! Couldn't start Tika!${boff}" | |
fi | |
fi | |
;; | |
'stop') | |
if test -f /tmp/apache-tika.pid | |
then | |
echo "Tika Selenium..." | |
PID=`cat /tmp/apache-tika.pid` | |
kill -3 $PID | |
if kill -9 $PID ; | |
then | |
sleep 2 | |
test -f /tmp/apache-tika.pid && rm -f /tmp/apache-tika.pid | |
else | |
echo "Tika could not be stopped..." | |
fi | |
else | |
echo "Tika is not running." | |
fi | |
;; | |
'restart') | |
if test -f /tmp/selenium.pid | |
then | |
kill -HUP `cat /tmp/apache-tika.pid` | |
test -f /tmp/apache-tika.pid && rm -f /tmp/apache-tika.pid | |
sleep 1 | |
java -jar /var/lib/apache-tika/tika-server-1.9.jar > /var/log/apache-tika/output.log 2> /var/log/apache-tika/error.log & echo $! > /tmp/apache-tika.pid | |
echo "Reload Tika..." | |
else | |
echo "Tika isn't running..." | |
fi | |
;; | |
*) # no parameter specified | |
echo "Usage: $SELF start|stop|restart|reload|force-reload|status" | |
exit 1 | |
;; | |
esac |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment