Last active
August 29, 2015 14:16
-
-
Save xlcommunity/56c1d7286b648319e7fd to your computer and use it in GitHub Desktop.
Sample service wrapper for Deployit on RHEL/CentOS
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 CODE AND INFORMATION ARE PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR | |
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS | |
# FOR A PARTICULAR PURPOSE. THIS CODE AND INFORMATION ARE NOT SUPPORTED BY XEBIALABS. | |
#!/bin/sh | |
# Starts and stops script | |
# For Running from Jenkins, use the following command to avoid hang behavior | |
# ssh username@server 'cd | nohup ./deployitd start > foo.out 2> foo.err < /dev/null &' | |
# | |
# deployitd - Startup Script for deployit# | |
# Option for debugging below. | |
#set -x | |
DEPLOYIT_HOME=/apps/deployit/server | |
#DEPLOYIT_HOME=/opt/deployit-server | |
case "$1" in | |
start) | |
exec $DEPLOYIT_HOME/bin/server.sh & | |
echo $! > $DEPLOYIT_HOME/bin/current.pid | |
;; | |
stop) | |
if [ -f $DEPLOYIT_HOME/bin/current.pid ]; then | |
PROCESSID=`cat $DEPLOYIT_HOME/bin/current.pid` | |
fi | |
if [ "$PROCESSID" != "" ]; then | |
rm -f $DEPLOYIT_HOME/bin/current.pid | |
echo Killing child processes for id "$PROCESSID" | |
exec pkill -P $PROCESSID | |
fi | |
;; | |
restart) | |
$0 stop | |
$0 start | |
;; | |
status) | |
if [ -f $DEPLOYIT_HOME/bin/current.pid ]; then | |
echo Deployit Service is running. | |
else | |
echo Deployit Service not running. | |
fi | |
;; | |
*) | |
echo "Usage: $0 {start|stop|restart|status}" | |
exit 1 | |
esac |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment