Skip to content

Instantly share code, notes, and snippets.

@nekulin
Created January 26, 2016 17:01
Show Gist options
  • Save nekulin/5f9ee3b9bff04bbce4a7 to your computer and use it in GitHub Desktop.
Save nekulin/5f9ee3b9bff04bbce4a7 to your computer and use it in GitHub Desktop.
/etc/init.d/apache-tika
#!/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