Created
June 8, 2017 22:42
-
-
Save densmirnov/a16951d5d4d95a0f35bc44bc06ced30c to your computer and use it in GitHub Desktop.
Simple Alias to run GunBot instances with PM2
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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