Last active
September 12, 2016 11:50
-
-
Save am-kantox/c19046c76c2a117e03bc to your computer and use it in GitHub Desktop.
init.d service to start/stop/restart RapidMiner Server
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
#!/bin/sh | |
RMS=`basename "$0"` | |
RMS_HOME=/home/ubuntu/Apps/rms | |
application_start() { | |
echo -n "Starting RapidMiner Server daemon... " | |
# to satisfy fcuking RMS, run as a user: | |
# sudo -u ubuntu $RMS_HOME/bin/standalone.sh 2>&1 > $RMS_HOME/log/$RMS-$(date +"%m-%d-%y").log & | |
$RMS_HOME/bin/standalone.sh 2>&1 >/var/log/$RMS.log & | |
sleep 1 | |
echo "\033[01;38;05;46mdone\033[0m" | |
ps -Ao pid,command | grep java | grep $RMS_HOME | awk '{print $1}' > /var/run/$RMS.pid | |
echo | |
} | |
application_stop() { | |
echo -n "Stopping RapidMiner Server daemon... " | |
if [ -e /var/run/$RMS.pid ] | |
then | |
kill `cat /var/run/$RMS.pid` | |
sleep 1 | |
echo "\033[01;38;05;46mdone\033[0m" | |
rm -f /var/run/$RMS.pid | |
else | |
echo "\033[01;38;05;214mnot running\033[0m" | |
fi | |
} | |
application_restart() { | |
application_stop | |
sleep 1 | |
application_start | |
} | |
case "$1" in | |
'start') | |
application_start | |
;; | |
'stop') | |
application_stop | |
;; | |
'restart') | |
application_restart | |
;; | |
*) | |
echo "usage $0 start|stop|restart" | |
esac |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment