-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Copy from https://github.com/hbz/lobid-resources/blob/master/web/monit_restart.sh. Should be in sync.
- Loading branch information
Showing
1 changed file
with
45 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
#!/bin/sh | ||
|
||
USAGE="<GIT REPO NAME> {start|stop} <PORT> [<JAVA OPTS>]" | ||
|
||
if [ $# -lt 3 ]; then | ||
echo "$USAGE | ||
THIS SCRIPT SHOULD ONLY BE USED BY -MONIT-! | ||
If you want to restart an instance, use ./restart.sh | ||
First 3 parameters are mandatory. | ||
Don't forget that the process is monitored by 'monit'. | ||
It will restart automatically if you stop the API. | ||
If you want to stop it permanently, do 'sudo /etc/ini.d/monit stop' first. | ||
" | ||
exit 65 | ||
fi | ||
|
||
REPO=$1 | ||
ACTION=$2 | ||
PORT=$3 | ||
JAVA_OPTS="$4" | ||
|
||
HOME="/home/sol" | ||
|
||
# it is important to set the proper locale | ||
. $HOME/.locale | ||
JAVA_OPTS=$(echo "$JAVA_OPTS" |sed 's#,#\ #g') | ||
|
||
cd $HOME/git/$REPO | ||
case $ACTION in | ||
start) | ||
if [ -f target/universal/stage/RUNNING_PID ]; then | ||
kill $(cat target/universal/stage/RUNNING_PID) | ||
fi | ||
JAVA_OPTS="$JAVA_OPTS -XX:+HeapDumpOnOutOfMemoryError" $HOME/activator-dist-1.3.5/activator "start $PORT" | ||
;; | ||
stop) | ||
kill $(cat target/universal/stage/RUNNING_PID) | ||
;; | ||
*) | ||
echo "usage: $USAGE" | ||
;; | ||
esac | ||
exit 0 |