reformatted to use my template

This commit is contained in:
2022-03-31 15:04:54 -05:00
parent a9ea7bf8d5
commit 7bac005fe7
32 changed files with 8222 additions and 783 deletions

19
scripts/mac-linux/install Normal file
View File

@@ -0,0 +1,19 @@
#!/bin/bash
#change to ccurrent directory
cd -- "$( dirname -- "${BASH_SOURCE[0]}" )"
cd ../..
#discord token
[ ! -f "token.txt" ] && touch "token.txt"
if [ ! -s "token.txt" ]
then
printf "Enter your discord bot token: "
read token
printf $token > "token.txt"
fi
#run
npm install
npm run build

42
scripts/mac-linux/start Normal file
View File

@@ -0,0 +1,42 @@
#!/bin/bash
#change to current directory
cd -- "$( dirname -- "${BASH_SOURCE[0]}" )"
cd ../..
#colors
C1='\033[1;37m'
C2='\033[1;33m'
NC='\033[0m'
#make log folder
if [[ ! -d log ]]
then
mkdir log
fi
#current file number
num=0
if [[ -f log/number ]]
then
num=$(cat log/number)
fi
echo $num > log/number
#watchdog
while true
do
#increment log file number
num=$(( num + 1 ))
echo $num > log/number
#run
npm start 2> log/$num.err | tee log/$num.out
#give chance to close program
printf "\n\n\n${C1}press ${C2}Control+C${C1} to close${NC}\n\n\n"
sleep 5
done

View File

@@ -0,0 +1,12 @@
#!/bin/bash
#change to ccurrent directory
cd -- "$( dirname -- "${BASH_SOURCE[0]}" )"
#start
if [[ $(screen -ls | grep $(npm run getname -s)) ]]; then
echo "Session already exists"
else
screen -S $(npm run getname -s) -d -m ./start
echo "Created session"
fi

View File

@@ -0,0 +1,12 @@
#!/bin/bash
#change to ccurrent directory
cd -- "$( dirname -- "${BASH_SOURCE[0]}" )"
#start
if [[ $(tmux ls | grep $(npm run getname -s)) ]]; then
echo "Session already exists"
else
tmux new-session -d -s $(npm run getname -s) ./start
echo "Created session"
fi