Skip to content
This repository was archived by the owner on Mar 26, 2020. It is now read-only.

Commit 42264f3

Browse files
committed
Conglomerate start.sh and stop.sh
1 parent 07c6851 commit 42264f3

File tree

3 files changed

+11
-28
lines changed

3 files changed

+11
-28
lines changed

scripts/start.sh renamed to scripts/bot.sh

+10-3
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@
22

33
# Check if argument is passed, and set PYTHON_LAUNCHER var to the argument passed
44
# If not passed, just use "python"
5-
if [[ -z "$1" ]] ; then
5+
if [[ -z "$2" ]] ; then
66
PYTHON_LAUNCHER=python
77
else
8-
PYTHON_LAUNCHER=$1
8+
PYTHON_LAUNCHER=$2
99
fi
1010

1111
# Get python launcher (cut by spaces, get second result, then cut by "b" (beta), and get first result)
@@ -27,4 +27,11 @@ if [[ -f "./.env" ]] ; then
2727
source ./.env
2828
fi
2929

30-
${PYTHON_LAUNCHER} ./runner.py
30+
case "$1" in
31+
start)
32+
${PYTHON_LAUNCHER} ./runner.py ;;
33+
stop)
34+
read -r pid < ./.pid; kill -TERM ${pid} ;;
35+
*)
36+
echo "Invalid option!"; exit 1 ;;
37+
esac

scripts/generate_systemd_service.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ fi
2020

2121
# Change into parent dir of script
2222
C_DIR=`pwd`
23-
cd `dirname "$(readlink -f $0)"`/..
23+
cd "`dirname "$(readlink -f $0)"`/.."
2424

2525
# Cat our script into nyachan.service
2626
cat <<- EOM > ${C_DIR}/nyachan.service

scripts/stop.sh

-24
This file was deleted.

0 commit comments

Comments
 (0)