Skip to content

Instantly share code, notes, and snippets.

@ssbarnea
Created April 2, 2012 12:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save ssbarnea/2283018 to your computer and use it in GitHub Desktop.
Save ssbarnea/2283018 to your computer and use it in GitHub Desktop.
Improved /etc/init.d/jira script.
#!/bin/sh -e
# JIRA startup script
#chkconfig: 2345 80 05
#description: JIRA
# Define some variables
# Name of app ( JIRA, Confluence, etc )
APP=jira
# Name of the user to run as
USER=root
# Location of application's bin directory
BASE=/opt/jira
# Location of Java JDK
#export JAVA_HOME=/usr/lib/jvm/java-6-sun
export JAVA_HOME=/usr/lib/jvm/default-java
case "$1" in
# Start command
start)
echo "Starting $APP"
/bin/su -m $USER -c "cd $BASE/logs && $BASE/bin/startup.sh &> /dev/null"
;;
# Stop command
stop)
echo "Stopping $APP"
/bin/su -m $USER -c "$BASE/bin/shutdown.sh &> /dev/null"
echo "$APP stopped successfully"
;;
# Restart command
restart)
$0 stop
sleep 5
$0 start
;;
*)
echo "Usage: /etc/init.d/$APP {start|restart|stop}"
exit 1
;;
esac
exit 0
@ssbarnea
Copy link
Author

ssbarnea commented Apr 2, 2012

Feel free to add your comments, fixes, or patches, as Atlassian consider startup on Linux as not a part of their support :p

@Phoenix0610
Copy link

Awesome man..thanks for the help :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment