Skip to content

Instantly share code, notes, and snippets.

@benevans
Created September 25, 2014 10:46
Show Gist options
  • Save benevans/346cf56f7464e1ee6e3f to your computer and use it in GitHub Desktop.
Save benevans/346cf56f7464e1ee6e3f to your computer and use it in GitHub Desktop.
Artifactory start script for supervisord
#!/bin/bash
# Artifactory start script for supervisord
# Derived from http://serverfault.com/questions/425132/controlling-tomcat-with-supervisor
ARTHOME=$HOME/artifactory-3.3.1
function shutdown() {
echo "$(date): Shutting down Artifactory"
$ARTHOME/bin/artifactory.sh stop
}
echo "$(date): Starting Artifactory"
$ARTHOME/bin/artifactory.sh start
# These signals from supervisord will trigger shutdown
trap shutdown HUP INT QUIT ABRT KILL ALRM TERM TSTP
ARTPID=$(cat $ARTHOME/run/artifactory.pid)
echo "Waiting for $ARTPID"
# Tomcat process isn't a direct child of this script, so can't use
# wait $ARTPID. Instead just poll the process /proc file.
while [ -e /proc/$ARTPID ]; do
sleep 2
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment