Skip to content

Instantly share code, notes, and snippets.

@guileen
Last active August 29, 2015 14:21
Show Gist options
  • Save guileen/eb84b5c7eb44080a19de to your computer and use it in GitHub Desktop.
Save guileen/eb84b5c7eb44080a19de to your computer and use it in GitHub Desktop.
Install supervisor and iojs on centos
yum install -y xz git
# install iojs
wget "https://iojs.org/dist/v2.3.0/iojs-v2.3.0-linux-x64.tar.xz"
tar xJvf iojs-v2.3.0-linux-x64.tar.xz
mv iojs-v2.3.0-linux-x64 /opt/
ln -s -f /opt/iojs-v2.3.0-linux-x64 /opt/iojs
ln -s -f /opt/iojs/bin/node /usr/local/bin/node
ln -s -f /opt/iojs/bin/iojs /usr/local/bin/iojs
ln -s -f /opt/iojs/bin/npm /usr/local/bin/npm
echo node version `node -v`
echo npm version `npm -v`
# install supervisor
wget --no-check-certificate "https://bootstrap.pypa.io/get-pip.py"
python get-pip.py
pip install supervisor
pip install distribute --upgrade
echo_supervisord_conf > supervisord.conf
cat <<EOF >> supervisord.conf
[include]
files=/etc/supervisord.d/*.ini
EOF
cp supervisord.conf /etc/supervisord.conf
mkdir -p /etc/supervisord.d/
echo create /etc/init.d/supervisord
cat <<EOF > /etc/init.d/supervisord
#!/bin/sh
#
# /etc/rc.d/init.d/supervisord
#
# Supervisor is a client/server system that
# allows its users to monitor and control a
# number of processes on UNIX-like operating
# systems.
#
# chkconfig: - 64 36
# description: Supervisor Server
# processname: supervisord
# Source init functions
. /etc/rc.d/init.d/functions
prog="supervisord"
prefix="/usr/"
exec_prefix="\${prefix}"
prog_bin="\${exec_prefix}/bin/supervisord"
PIDFILE="/var/run/\$prog.pid"
start()
{
echo -n \$"Starting \$prog: "
daemon \$prog_bin --pidfile \$PIDFILE -c /etc/supervisord.conf
[ -f \$PIDFILE ] && success \$"\$prog startup" || failure \$"\$prog startup"
echo
}
stop()
{
echo -n \$"Shutting down \$prog: "
[ -f \$PIDFILE ] && killproc \$prog || success \$"\$prog shutdown"
echo
}
case "\$1" in
start)
start
;;
stop)
stop
;;
status)
status \$prog
;;
restart)
stop
start
;;
*)
echo "Usage: \$0 {start|stop|restart|status}"
;;
esac
EOF
echo install service
chmod +x /etc/init.d/supervisord
chkconfig --add supervisord
chkconfig supervisord on
echo start service
/etc/init.d/supervisord start
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment