-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
09c3dd3
commit 4ede1ca
Showing
2 changed files
with
42 additions
and
0 deletions.
There are no files selected for viewing
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
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
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 |