Skip to content

Instantly share code, notes, and snippets.

@pulse00
Created May 27, 2015 11:05
Show Gist options
  • Save pulse00/5f30262c1425189d28f0 to your computer and use it in GitHub Desktop.
Save pulse00/5f30262c1425189d28f0 to your computer and use it in GitHub Desktop.
Installs disque on debian/ubuntu. As with disque itself, this is NOT production ready.
#!/bin/sh
#### Installs disque and daemontools for monitoring a disque node as a service
#### Dependencies
# - git
# - build-essential
## Install daemontools
if [ -f "/etc/init/svscan.conf" ];
then
echo "Daemontools already installed, skipping..."
else
echo "Installing daemontools..."
apt-get -y install daemontools
# for some reason, /etc/service isn't created, need to do that.
mkdir -p /etc/service
# need to make a conf file for booting
cd /etc/init/
touch svscan.conf
# treat like the cron process
echo "start on runlevel [2345]" > svscan.conf
echo "" >> svscan.conf
echo "expect fork" >> svscan.conf
echo "respawn" >> svscan.conf
echo "exec svscanboot" >> svscan.conf
service svscan start
echo "complete"
fi
if [ -f "/usr/local/bin/disque" ];
then
echo "Disque is already installed"
else
echo "Installing disque..."
## Compile and install disque
cd /opt
git clone https://github.com/antirez/disque.git
cd disque
make
cp src/disque /usr/local/bin/disque && chmod +x /usr/local/bin/disque
cp src/disque-server /usr/local/bin/disque-server && chmod +x /usr/local/bin/disque-server
mkdir /etc/service/disque
echo "#!/bin/sh\n\n/usr/local/bin/disque-server /opt/disque/disque.conf" > /etc/service/disque/run
chmod +x /etc/service/disque/run
echo "Disque installed. Use 'svstat /etc/service/disque' to check the service status."
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment