Skip to content

Instantly share code, notes, and snippets.

@chromakode
Created May 1, 2012 21:14
Show Gist options
  • Save chromakode/2571449 to your computer and use it in GitHub Desktop.
Save chromakode/2571449 to your computer and use it in GitHub Desktop.
Start reddit in a chroot
#!/bin/bash
#
# Max's groovy chroot script
#
# Install Ubuntu Natty via debootstrap and then run Neil's install script.
# Then adjust the bind mounts to suit your personal locations for the reddit code.
#
if mount | grep -q reddit
then
# If this script has already run, we'll just open a chroot shell.
chroot reddit bash
else
# Alias system dirs for access within the chroot.
mount -o bind /sys reddit/sys
mount -o bind /proc reddit/proc
# Add your code directories to the chroot.
mount -o bind Documents/code/reddit/reddit-public reddit/home/reddit/reddit
mount -o bind Documents/code/reddit reddit/home/reddit/code
chroot reddit bash -c '\
/etc/init.d/postgresql start; \
/etc/init.d/rabbitmq-server start; \
/etc/init.d/cassandra start; \
/etc/init.d/memcached start; \
/etc/init.d/haproxy start; \
/etc/init.d/stunnel4 start; \
start svscan; \
sudo -H -u reddit bash';
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment