-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathcreateAndRun.sh
executable file
·33 lines (24 loc) · 992 Bytes
/
createAndRun.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
#!/bin/bash
#
# Copyright (c) 2023 exersalza
# This project is licensed under the GNU 3 license. more information https://github.com/exersalza/salty-cpp-bot/blob/main/LICENSE
#
set -x
if ! [[ "$1" == "y" ]]
then
echo "Please make sure, you have all the config files prepared. When you did run the command with 'y' as argument."
exit
fi
: === Create Container... ===
docker build -t salty_cpp_bot:$(date "+%y%m%d") .
sleep 1
: === Start bot... ===
#hopefull fix, but next creation will show
docker stop "$(docker ps -a -q --filter ancestor="$(cat "$HOME"/.salty_cpp_bot_docker_version)" --format="{{.ID}}"))"
docker run -d salty_cpp_bot:$(date "+%y%m%d")
: === Start Docker checker... ===
# Get the version in a file to survive script/server crashes
printf "salty_cpp_bot:$(date "+%y%m%d")" > "$HOME"/.salty_cpp_bot_docker_version
screen kill salty_cpp_bot_checker
screen -dmS salty_cpp_bot_checker ./dockerChecker.py
: === Successfully started everything, you\'re good to go. ===