-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathbrowserStartup.sh
executable file
·67 lines (57 loc) · 2.06 KB
/
browserStartup.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
#!/bin/bash
# file to start environment necessary for the genome browser, currently only used on OSX:
# starts mysql and apache
# with parameter "-e" modifies PATH and restarts a login shell
set -e
APACHEDIR=/usr/local/apache
BASEDIR=$APACHEDIR/ext
MYSQLPID=$BASEDIR/logs/mysql.pid
# try to kill and start mysql
if [ -f $BASEDIR/logs/mysql.pid ]; then
kill `cat $BASEDIR/logs/mysql.pid` 2> /dev/null || true
sleep 3
fi
if [ -f $BASEDIR/bin/mysqld_safe ]; then
$BASEDIR/bin/mysqld_safe --defaults-file=$BASEDIR/my.cnf --user=_mysql --pid-file=$MYSQLPID &
fi
sleep 5
# try to kill and start apache
if [ -f "$BASEDIR/logs/httpd.pid" ]; then
kill `cat $BASEDIR/logs/httpd.pid` 2> /dev/null || true
fi
if [ -f $BASEDIR/bin/httpd ]; then
$BASEDIR/bin/httpd -d "$BASEDIR"
fi
if [ ! -f $MYSQLPID ]; then
echo File $MYSQLPID does not exist after mysql startup.
echo Apparently Mysql is unable to start.
echo The error log file location was output to the screen by myqld above.
echo Some ideas on the reasons might be available in $BASEDIR/my.cnf or the mysql error log file
exit 250
fi
if [[ "$1" == "-e" ]]; then
export PATH="$BASEDIR/bin:$PATH"
export MYSQLINC=$APACHEDIR/ext/include
export MYSQLLIBS="/$APACHEDIR/ext/lib/libmysqlclient.a -lz -lc++"
export SSLDIR=$APACHEDIR/ext/include
export USE_SSL=1
export PNGLIB=$APACHEDIR/ext/lib/libpng.a
# careful - PNGINCL is the only option that requires the -I prefix
export PNGINCL=-I$APACHEDIR/ext/include
export CGI_BIN=$APACHEDIR/cgi-bin
export SAMTABIXDIR=$APACHEDIR/kent/samtabix
export USE_SAMTABIX=1
export SCRIPTS=$APACHEDIR/util
export BINDIR=$APACHEDIR/util
# find parent process name of this process and spawn new shell if it's bash or tcsh
parent=`ps -p $PPID -o comm=`
if [[ "$parent" == "tcsh" ]]; then
echo Adapting PATH and starting new tcsh
tcsh
elif [[ "$parent" == "bash" ]]; then
echo Adapting PATH and starting new bash
bash -l
else
echo Not changing PATH, parent is not bash or tcsh
fi
fi