Skip to content

Instantly share code, notes, and snippets.

@densmirnov
Created June 8, 2017 22:42
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save densmirnov/a16951d5d4d95a0f35bc44bc06ced30c to your computer and use it in GitHub Desktop.
Save densmirnov/a16951d5d4d95a0f35bc44bc06ced30c to your computer and use it in GitHub Desktop.
Simple Alias to run GunBot instances with PM2
#!/bin/bash
export ARCH FOLDER GUNTHY PM2
ARCH=$(uname -m)
if [[ "$OSTYPE" == "linux-gnu" && "$ARCH" == "x86_64" ]]; then
GUNTHY="gunthy-linuxx64"
elif [[ "$OSTYPE" == "linux-gnu" && "$ARCH" == "i686" ]]; then
GUNTHY="gunthy-linuxx86"
elif [[ "$OSTYPE" == "darwin"* ]]; then
GUNTHY="gunthy-macos"
else
GUNTHY="Unknown OS! Exiting!"
fi
FOLDER=$(which GUNTHY)
# FOLDER=$(pwd)
PM2=$(which pm2)
touch ~/.bash_aliases
echo -e "function gunstart() { \"\$PM2\" start -n \"\$1\" -o \"\$FOLDER\"/\"\$2\"-\"\$1\"-log.txt -e \"\$FOLDER\"/\"\$2\"-\"\$1\"-err.txt \$(pwd)/\"$GUNTHY\" -- \"\$1\" \"\$2\" ;}" >>~/.bash_aliases
source "$HOME"/.bash_aliases;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment