Skip to content

Commit

Permalink
add node env and bots sh
Browse files Browse the repository at this point in the history
  • Loading branch information
TitusKirch committed Sep 25, 2021
1 parent 09c3dd3 commit 4ede1ca
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 0 deletions.
3 changes: 3 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# node env
NODE_ENV=production

# bot config
BOT_CLIENT_ID=XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
BOT_CLIENT_SECRET=XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
Expand Down
39 changes: 39 additions & 0 deletions bot.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
#!/bin/bash

# setup
tmux_session_bot=discordbot

# get applicatio dir and switch to it
application_dir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
cd $application_dir

start() {
echo "Start bot..."
tmux new-session -d -s $tmux_session_bot \; send-keys "cd $application_dir ;npm run start" Enter
}
stop() {
echo "Stop bot..."
tmux kill-session -t $tmux_session_bot
}
restart() {
stop
sleep 5
start
}

# check command
case $1 in
"--start" )
start
;;
"--stop" )
stop
;;
"--restart" )
restart
;;
*)
echo "Error: Your input was incorrect."
exit 1
;;
esac

0 comments on commit 4ede1ca

Please sign in to comment.