Skip to content

Instantly share code, notes, and snippets.

@chadtodd2077
Created January 24, 2023 21:14
Show Gist options
  • Select an option

  • Save chadtodd2077/bb2761e846a02d2d97421fdea2c8bd9b to your computer and use it in GitHub Desktop.

Select an option

Save chadtodd2077/bb2761e846a02d2d97421fdea2c8bd9b to your computer and use it in GitHub Desktop.
brook.sh
#!/bin/sh
[ $(id -u) != "0" ] && { echo "${CFAILURE}Error: You must be root to run this script${CEND}"; exit 1; }
read -p "Enter your Brook Server Listen Port (Default is 9527):" bport
echo " Your Brook Server Port is $bport"
read -p "Enter your Brook Server Password:" bpwd
echo " Your Brook Server Password is $bpwd"
DOWNLOAD_URL=$(curl -s https://api.github.com/repos/txthinking/brook/releases/latest | grep "brook_linux_amd64" | cut -d : -f 2,3 | tr -d \" | awk 'NR==2 {print $0}')
wget -q $DOWNLOAD_URL -O /usr/bin/brook
chmod +x /usr/bin/brook
apt update
apt install supervisor -y
cat > /etc/supervisor/conf.d/brook.conf<<EOF
[program:brook]
directory = /usr/bin
command = /usr/bin/brook server --listen :$bport --password $bpwd
autostart = true
autorestart = true
EOF
supervisorctl reload
supervisorctl status
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment