Merge pull request #1911 from miloaec/dev

adding contrib init for reports and modifying status check to have ou…
This commit is contained in:
Eric Rasche
2016-03-14 10:33:48 -05:00
2 changed files with 109 additions and 12 deletions
+14 -12
View File
@@ -8,6 +8,8 @@
# chkconfig: 2345 98 20
# description: Galaxy http://galaxyproject.org/
#--- loading functions
. /etc/init.d/functions
#--- config
SERVICE_NAME="galaxy"
@@ -53,17 +55,17 @@ stop() {
echo "done."
}
status() {
echo -n "$SERVICE_NAME status: "
while read pid; do
if [ "$(readlink -m /proc/$pid/cwd)" = "$(readlink -m $RUN_IN)" ]; then
echo "started"
return 0
fi
done < <(ps ax -o 'pid cmd' | grep -P '^\s*\d+ python ./scripts/paster.py serve' | awk '{print $1}')
echo "stopped"
return 3
galaxy_status() {
if [[ $(grep '\[server:' $RUN_IN/config/galaxy.ini|awk -F'(:)|(])' '{ print $2 }') == 'main' ]]
then
echo -n "$SERVICE_NAME status: "
status -p $RUN_IN/paster.pid galaxy
else
for proc in $(grep '\[server:' $RUN_IN/config/galaxy.ini|awk -F'(:)|(])' '{ print $2 }')
do
status -p $RUN_IN/${proc}.pid ${proc}
done
fi
}
notsupported() {
@@ -90,7 +92,7 @@ case "$1" in
;;
status)
set +e
status
galaxy_status
exit $?
;;
'')
+95
View File
@@ -0,0 +1,95 @@
#!/bin/bash
#
# Init file for Galaxy (http://galaxyproject.org/)
# Suitable for use on Fedora and derivatives (RedHat Enterprise Linux, Scientific Linux, CentOS)
#
# Contributed by Brad Chapman
#
# chkconfig: 2345 98 20
# description: Galaxy http://galaxyproject.org/
#--- loading functions
. /etc/init.d/functions
#--- config
SERVICE_NAME="galaxy-reports"
RUN_AS="galaxy"
RUN_IN="/path/to/galaxy-dist"
#--- main actions
start() {
echo "Starting $SERVICE_NAME... "
cmd="cd $RUN_IN && sh run_reports.sh --daemon"
case "$(id -un)" in
$RUN_AS)
eval "$cmd"
;;
root)
su - $RUN_AS -c "$cmd"
;;
*)
echo "*** ERROR *** must be $RUN_AS or root in order to control this service" >&2
exit 1
esac
echo "...done."
}
stop() {
echo -n "Stopping $SERVICE_NAME... "
cmd="cd $RUN_IN && sh run_reports.sh --stop-daemon"
case "$(id -un)" in
$RUN_AS)
eval "$cmd"
;;
root)
su - $RUN_AS -c "$cmd"
;;
*)
echo "*** ERROR *** must be $RUN_AS or root in order to control this service" >&2
exit 1
esac
echo "done."
}
notsupported() {
echo "*** ERROR*** $SERVICE_NAME: operation [$1] not supported"
}
usage() {
echo "Usage: $SERVICE_NAME start|stop|restart|status"
}
#---
case "$1" in
start)
start "$@"
;;
stop)
stop
;;
restart|reload)
stop
start
;;
status)
set +e
echo -n "$SERVICE_NAME status: "
status -p $RUN_IN/reports_webapp.pid $SERVICE_NAME
exit $?
;;
'')
usage >&2
exit 1
;;
*)
notsupported "$1" >&2
usage >&2
exit 1
;;
esac