Created
May 2, 2012 03:38
-
-
Save artifactsauce/2573393 to your computer and use it in GitHub Desktop.
Install multiple version of perl into system region with perlbrew
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/bash | |
PERL_VERSION="5.14.2" | |
if [[ `whoami` != "root" ]]; then | |
echo "[ERROR] Must be done as root." | |
exit 1 | |
fi | |
echo "[INFO] Change environment variable HOME." `date` | |
HOME="/var/tmp/build" | |
[[ -d $HOME ]] || mkdir $HOME | |
cd $HOME | |
echo "[INFO] Change script engine root." `date` | |
export PERLBREW_ROOT="/usr/local/perlbrew" | |
echo "[INFO] Install perlbrew" `date` | |
curl -kL http://install.perlbrew.pl | bash - | |
source "$PERLBREW_ROOT/etc/bashrc" | |
echo "[INFO] Install perl" $PERL_VERSION `date` | |
perlbrew install $PERL_VERSION | |
perlbrew use $PERL_VERSION | |
if [[ `which perl` != "/usr/bin/perl" ]]; then | |
echo "[INFO] Success to install perl into" `which perl` | |
else | |
echo "[ERROR] Failed to install perl with perlbrew" | |
fi |
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/bash | |
PERL_VERSION="5.14.2" | |
if [[ `whoami` != "root" ]]; then | |
echo "Must be done as root." | |
exit 1 | |
fi | |
HOME="/var/tmp/build" | |
[[ -d $HOME ]] || mkdir $HOME | |
cd $HOME | |
export PERLBREW_ROOT="/usr/local/perlbrew" | |
source $PERLBREW_ROOT/etc/bashrc | |
perlbrew use $PERL_VERSION | |
echo "[INFO] Install cpan package: App::cpanminus" `date` | |
curl -kL http://cpanmin.us | perl - App::cpanminus | |
if [[ `which cpanm` ]]; then | |
while read LINE; do | |
[[ "$LINE" =~ ^\# ]] && continue | |
echo "[INFO] Install cpan package:" $LINE `date` | |
cpanm $LINE 2> cpan_error.log | |
done < "pm_list.txt" | |
else | |
echo "[ERROR] cpanm has not been installed" | |
fi |
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/bash | |
APP_NAME="myapp" | |
APP_ROOT="/var/www/myapp" | |
APP_LIB="$APP_ROOT/lib" | |
APP_PSGI="$APP_ROOT/myapp.psgi" | |
WORKERS="5" | |
PORT="5001" | |
PERL_NAME="5.14.2" | |
. /etc/webapps/webapprc |
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
# Comment | |
App::cpanoutdated | |
App::pmuninstall | |
MIYAGAWA/Plack-0.99_05.tar.gz | |
http://example.org/LDS/CGI.pm-3.20.tar.gz | |
--interactive Task::Kensho |
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
# Source function library. | |
. /etc/init.d/functions | |
# Get config. | |
test -f /etc/sysconfig/network && . /etc/sysconfig/network | |
# Check that we are root ... so non-root users stop here | |
if [ `whoami` != "root" ]; then | |
echo "It has to be done as root." | |
exit 1 | |
fi | |
# Check that networking is up. | |
[ "${NETWORKING}" = "yes" ] || exit 0 | |
RETVAL=0; | |
PID_FILE="/var/run/webapps/${APP_NAME}.pid" | |
STATUS_FILE="/var/run/webapps/${APP_NAME}.status" | |
INTERVAL="5" | |
HOST="127.0.0.1" | |
APP_USER="webapp" | |
export PERLBREW_ROOT="/usr/local/perlbrew" | |
source ${PERLBREW_ROOT}/etc/bashrc | |
perlbrew use perl-${PERL_NAME} | |
SERVER="starman" | |
DAEMON="start_server" | |
DAEMON_OPTS="--port ${HOST}:${PORT} --interval ${INTERVAL} --pid-file ${PID_FILE} --status-file ${STATUS_FILE} -- `which ${SERVER}` -I${APP_LIB} --workers ${WORKERS} --disable-keepalive -E production ${APP_PSGI}" | |
start() { | |
if [ -f $PID_FILE ]; then | |
echo "${APP_NAME} has been started..."; | |
return 1; | |
fi | |
echo -n $"Starting ${APP_NAME}: " | |
sudo -H -u ${APP_USER} CATALYST_DEBUG=0 ${DAEMON} ${DAEMON_OPTS} & | |
RETVAL=$? | |
echo | |
return $RETVAL; | |
} | |
reload () { | |
echo -n $"Reloading ${APP_NAME}: " | |
kill -HUP `cat ${PID_FILE}` | |
RETVAL=$? | |
echo | |
return $RETVAL; | |
} | |
stop() { | |
echo -n $"Stopping ${APP_NAME}: " | |
kill -INT `cat ${PID_FILE}` | |
RETVAL=$? | |
echo | |
return $RETVAL; | |
} | |
case "$1" in | |
start) | |
start | |
;; | |
stop) | |
stop | |
;; | |
reload) | |
reload | |
;; | |
*) | |
echo $"Usage: $0 {start|stop|reload}" | |
exit 1 | |
esac | |
exit $RETVAL |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment