-
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.
Add restart.sh; remove RUNNING_PID when starting
This makes sure that monit can start the process properly.
- Loading branch information
Showing
2 changed files
with
37 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
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,36 @@ | ||
#!/bin/sh | ||
|
||
USAGE="\nusage: <GIT REPO NAME> | ||
This script will just echo -en \033[1mSTOP\033[0m the process! | ||
First parameter is mandatory. | ||
The process is normally be monitored by 'monit'. | ||
Monit will automatically restart it when it's stopped. | ||
Have a look at /etc/monit/conf.d/play-instances.rc to see | ||
which paramters are used (port, java opts etc.) | ||
To see if monit is really observing your instances, try: | ||
$ monit status | ||
If you want to stop it permanently via cmd, do this first: | ||
$ sudo /etc/ini.d/monit stop | ||
" | ||
|
||
if [ ! $# -eq 1 ]; then | ||
echo "$USAGE" | ||
exit 65 | ||
fi | ||
|
||
REPO=$1 | ||
ACTION=$2 | ||
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 | ||
kill $(cat target/universal/stage/RUNNING_PID) | ||
echo "Going to sleep for 11 seconds. Then lookup the process list for the repo name. | ||
If everything is fine, 'monit' is going to start the $REPO instance ..." | ||
sleep 11 | ||
|
||
ps -ef | grep $REPO | ||
exit 0 |