Skip to content

Commit

Permalink
Bash Skripts
Browse files Browse the repository at this point in the history
  • Loading branch information
Gamer08YouTube committed May 4, 2020
1 parent 9f2fcc3 commit e50310e
Show file tree
Hide file tree
Showing 2 changed files with 90 additions and 0 deletions.
56 changes: 56 additions & 0 deletions start.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
#!/usr/bin/env bash

#| Script Version (2019.1.10)
#| Script Author Jan Heil
#| Script Website www.byte-store.de


#
# Default example Script from center.byte-store.de
# Language English
#

SERVER_STARTBINARY_JAVA="DiscordBot.jar"
SERVER_STARTBINARY_JS="index.js"

for i in "$@"
do
case ${i} in
-s=*|--screen=*)
SCREEN="${i#*=}"
shift # Server Screen Name
;;
-l=*|--language=*)
LANGUAGE="${i#*=}"
shift # Server Language
;;
-b=*|--binary=*)
BIN="${i#*=}"
shift # Server Path
;;
*)
# Start script unknown option
;;
esac
done

if ! screen -list | grep -q ${SCREEN}; then
if [ ${LANGUAGE} == "java" ]; then
if test -f "$BIN$SERVER_STARTBINARY_JAVA"; then
screen -SL ${SCREEN} -Logfile ./triox-server.log java -jar "$BIN$SERVER_STARTBINARY_JAVA"
else
echo "SERVER_BINARY"
exit 1
fi
else
if test -f "$BIN$SERVER_STARTBINARY_JS"; then
screen -SL ${SCREEN} -Logfile ./triox-server.log node "$BIN$SERVER_STARTBINARY_JS"
else
echo "SERVER_BINARY"
exit 1
fi
fi
echo "SERVER_STARTING"
else
echo "SERVER_ONLINE"
fi
34 changes: 34 additions & 0 deletions stop.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
#!/usr/bin/env bash

#| Script Version (2019.1.10)
#| Script Author Jan Heil
#| Script Website www.byte-store.de


#
# Default example Script from center.byte-store.de
# Language English
#

SERVER_STARTBINARY_JAVA="DiscordBot.jar"
SERVER_STARTBINARY_JS="index.js"

for i in "$@"
do
case ${i} in
-s=*|--screen=*)
SCREEN="${i#*=}"
shift # Server Screen Name
;;
*)
# Start script unknown option
;;
esac
done

if screen -list | grep -q ${SCREEN}; then
screen -X -S ${SCREEN} quit
echo "SERVER_STOPPING"
else
echo "SERVER_OFFLINE"
fi

0 comments on commit e50310e

Please sign in to comment.