LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 11-10-2012, 11:02 PM   #1
yaximik
Member
 
Registered: Nov 2010
Posts: 90

Rep: Reputation: 0
please help with interpreting script behavior


Hi,

I wanted to install local instances of Galaxy connected to PostgreSQL. Using combination of web user guides http://vallandingham.me/galaxy_install.html and http://www.agapow.net/science/bioinf...talling-galaxy, I managed to complete essentially the same install on two machines - 64-bit SciLinux55 and 64-bit RHEL58. Manual launch works fine on both machines:
Code:
su - galaxy
cd galaxy-dist
sh run.sh --reload
......
Starting server in PID 26613.
serving on 0.0.0.0:7070 view at http://127.0.0.1:7070
[CTRL-c]
^C caught in monitor process
Both guides end with creating launch scripts, albeit different. Although these can be accessed on the web pages, I provide them here:
http://www.agapow.net/science/bioinf...talling-galaxy
Code:
#!/bin/bash
#
# /etc/rc.d/init.d/galaxy
#
# Manages the Galaxy webserver
# Based on http://www.sensi.org/~alec/unix/redhat/sysvinit.html
#
# chkconfig: 2345 80 20
# description: Manages the Galaxy webserver

# The chkconfig is levels, strat priority, stop priority. Last two should add to 100.
# You get an error/failure if you try to restrat a stopped service.

# Source function library.
. /etc/rc.d/init.d/functions

GALAXY_USER=galaxy
GALAXY_DIST_HOME=/home/galaxy/galaxy_dist
GALAXY_RUN="${GALAXY_DIST_HOME}/run.sh"
GALAXY_PID="${GALAXY_DIST_HOME}/paster.pid"

case "$1" in
        start)
                          echo -n "Starting galaxy services: "
                          daemon --user $GALAXY_USER "${GALAXY_RUN} --daemon --pid-file=${GALAXY_PID}"
                          touch /var/lock/subsys/galaxy
        ;;
        stop)
                          echo -n "Shutting down galaxy services: "
                          daemon --user $GALAXY_USER "${GALAXY_RUN} --stop-daemon"
                          rm -f /var/lock/subsys/galaxy
        ;;
        status)
                          daemon --user galaxy "${GALAXY_RUN} --status"
        ;;
        restart)
                          $0 stop; $0 start
        ;;
        reload)
                          $0 stop; $0 start
        ;;
        *)
                          echo "Usage: galaxy {start|stop|status|reload|restart"
                          exit 1
        ;;
esac
and http://vallandingham.me/galaxy_install.html
Code:
#!/bin/bash

#--- config

SERVICE_NAME=galaxy
RUN_AS=galaxy
RUN_IN=/usr/local/galaxy/galaxy-dist

#--- main actions

start() {
        echo "Starting $SERVICE_NAME... "
        cmd="cd $RUN_IN && sh run.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.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."
}

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
}

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
                status
                exit $?
                ;;
        '')
                usage >&2
                exit 1
                ;;
        *)
                notsupported "$1" >&2
                usage >&2
                exit 1
                ;;
esac
I just copied these and saved as /etc/init.d/galaxy and /etc/init.d/galaxys. What puzzled me is that the first script (/etc/init.d/galaxy from Agapow.net) works as intended in SciLinux55. However, the very same script does not work on RHEL59 generating error:
Code:
[root@G5NNJN1 ~]# /etc/init.d/galaxy start
Starting galaxy services: ERROR: Your Python version is: 2.4
Galaxy is currently supported on Python 2.5, 2.6 and 2.7.  To run Galaxy,
please download and install a supported version from python.org.  If a
supported version is installed but is not your default, getgalaxy.org
contains instructions on how to force Galaxy to use a different version.
[root@G5NNJN1 ~]# python -V
Python 2.7
[root@G5NNJN1 ~]# su - galaxy
[galaxy@G5NNJN1 ~]$ python -V
Python 2.7
[galaxy@G5NNJN1 ~]$
However, the second script (/etc/init.d/galaxys from Vallandingham's web site) works on RHEL58 just as supposed to without complains.

What could be the issue?
 
Old 11-11-2012, 03:07 PM   #2
smallpond
Senior Member
 
Registered: Feb 2011
Location: Massachusetts, USA
Distribution: Fedora
Posts: 4,138

Rep: Reputation: 1263Reputation: 1263Reputation: 1263Reputation: 1263Reputation: 1263Reputation: 1263Reputation: 1263Reputation: 1263Reputation: 1263
Do you have two versions of python installed?
 
Old 11-12-2012, 06:52 AM   #3
yaximik
Member
 
Registered: Nov 2010
Posts: 90

Original Poster
Rep: Reputation: 0
Yes, both SciLinux55 and RHEL58 are based on Python 2.4, but Galaxy requires 2.5-2.7. Both machines have local installs of 2.7, which is made available to every user (as shown).
 
Old 11-12-2012, 02:00 PM   #4
fakie_flip
Senior Member
 
Registered: Feb 2005
Location: San Antonio, Texas
Distribution: Gentoo Hardened using OpenRC not Systemd
Posts: 1,495

Rep: Reputation: 85
Try changing the she-bang line to #!/bin/bash -x
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Interpreting $variables inside programs run from a shell script TheBigH Programming 6 06-10-2011 08:36 AM
[SOLVED] Watch not interpreting escape codes in bash script Arashi Programming 4 07-27-2010 08:31 AM
Need help interpreting half a line of script! Completely Clueless Linux - Software 5 03-03-2009 08:25 AM
interpreting perl script meniscus Linux - Newbie 35 11-30-2006 10:40 AM
Send string to std output without interpreting (script) ta0kira Programming 6 06-29-2005 08:50 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 06:16 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration