Skip to content

Instantly share code, notes, and snippets.

@kaloyan-raev
Last active October 31, 2016 07:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kaloyan-raev/e2201049e3c76fad2714811c6a07bd6e to your computer and use it in GitHub Desktop.
Save kaloyan-raev/e2201049e3c76fad2714811c6a07bd6e to your computer and use it in GitHub Desktop.
Eclipse Che service script for AWS
#! /bin/sh
### BEGIN INIT INFO
# Provides: che
# Required-Start: $remote_fs $syslog
# Required-Stop: $remote_fs $syslog
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Eclipse Che
# Description: Starts and stops Eclipse Che
#
### END INIT INFO
export CHE_HOME=/opt/che
export JAVA_HOME=/opt/jre1.8.0_112
do_start()
{
export CHE_IP=`curl -s http://169.254.169.254/latest/meta-data/public-ipv4`
su ubuntu -c "$CHE_HOME/bin/che.sh start"
}
do_stop()
{
su ubuntu -c "$CHE_HOME/bin/che.sh stop"
}
case "$1" in
start)
do_start
;;
stop)
do_stop
sleep 10
;;
restart)
do_stop
sleep 20
do_start
;;
*)
echo "Usage: che {start|stop|restart}" >&2
exit 3
;;
esac
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment