Skip to content

Instantly share code, notes, and snippets.

@dai0304
Last active December 12, 2015 00:18
Show Gist options
  • Save dai0304/4682685 to your computer and use it in GitHub Desktop.
Save dai0304/4682685 to your computer and use it in GitHub Desktop.
#!/bin/bash
# Crowd startup script
#chkconfig: 2345 80 05
#description: Crowd
# Based on script at http://www.bifrost.org/problems.html
RUN_AS_USER=ec2-user
CATALINA_HOME=/mnt/atlassians/crowd/apache-tomcat
start() {
echo "Starting Crowd: "
if [ "x$USER" != "x$RUN_AS_USER" ]; then
su - $RUN_AS_USER -c "$CATALINA_HOME/bin/startup.sh"
else
$CATALINA_HOME/bin/startup.sh
fi
echo "done."
}
stop() {
echo "Shutting down Crowd: "
if [ "x$USER" != "x$RUN_AS_USER" ]; then
su - $RUN_AS_USER -c "$CATALINA_HOME/bin/shutdown.sh"
else
$CATALINA_HOME/bin/shutdown.sh
fi
echo "done."
}
case "$1" in
start)
start
;;
stop)
stop
;;
restart)
stop
sleep 10
#echo "Hard killing any remaining threads.."
#kill -9 `cat $CATALINA_HOME/work/catalina.pid`
start
;;
*)
echo "Usage: $0 {start|stop|restart}"
esac
exit 0
#!/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=jira
# Location of application's bin directory
BASE=/mnt/atlassians/jira
# Location of Java JDK
export JAVA_HOME=/usr/lib/jvm/jre
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
#!/bin/bash
# Stash startup script
#chkconfig: 2345 80 05
#description: Stash
# RUN_AS: The user to run fisheye as. Its recommended that you create a separate user account for security reasons
RUN_AS=ec2-user
# STASH_INSTALLATION: The path to the Stash installation. Its recommended to create a symbolic link to the latest version so
# the process will still work after upgrades.
STASH_INSTALLATION="/mnt/atlassians/stash"
STASH_HOME="/mnt/atlassians/stash-home"
stashctl() {
if [ "x$USER" != "x$RUN_AS" ]; then
su - "$RUN_AS" -c "export STASH_HOME=$STASH_HOME;$STASH_INSTALLATION/bin/$1"
else
"export STASH_HOME=$STASH_HOME;$STASH_INSTALLATION/bin/$1"
fi
}
case "$1" in
start)
stashctl start-stash.sh
;;
stop)
stashctl stop-stash.sh
;;
restart)
stashctl stop-stash.sh
sleep 10
stashctl start-stash.sh
;;
*)
echo "Usage: $0 {start|stop|restart}"
esac
exit 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment