Skip to content

Instantly share code, notes, and snippets.

@manboubird
Created August 17, 2013 07:36
Show Gist options
  • Save manboubird/6255753 to your computer and use it in GitHub Desktop.
Save manboubird/6255753 to your computer and use it in GitHub Desktop.
#!/bin/bash
PID_FILE=/usr/local/hive/pid/hiveserver2.pid
if [ -f ${PID_FILE} ]; then
echo "PID_FILE exists. ${PID_FILE}"
echo "kill `cat ${PID_FILE}`"
echo "rm ${PID_FILE}"
exit
fi
/usr/local/hive/bin/hiveserver2 >> /usr/local/hive/logs/hiveserver2.`date +%F`.log 2>&1 &
PID=$!
echo "PID = ${PID}, PID_FILE = ${PID_FILE}"
echo "kill ${PID}"
echo $PID > ${PID_FILE}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment