-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathautoRestart.sh
More file actions
executable file
·47 lines (40 loc) · 971 Bytes
/
autoRestart.sh
File metadata and controls
executable file
·47 lines (40 loc) · 971 Bytes
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
34
35
36
37
38
39
40
41
42
43
44
45
46
#!/bin/bash
source "$HOME/HeroiCraft/scripts/sourceme" || exit 4 # Exit if sourceme isn't found
#timestamp="$(date +%s)"
function tryBuild {
#lastBuild="$(cat $mainDir/BuildTools/lastbuild.txt)"
runsLeft="$(cat $HeroiCraftDIR/BuildTools/runsLeft.txt)"
if [[ $runsLeft -le 0 ]]; then
# Every 10 runs of script, run buildtools
cd $HeroiCraftDIR/BuildTools/
echo "10" > runsLeft.txt
#./buildtools.sh
cd ..
scripts/updateall.sh
else
newRunsLeft="$(expr $runsLeft - 1)"
echo "$newRunsLeft" > $HeroiCraftDIR/BuildTools/runsLeft.txt
echo "There are $newRunsLeft runs until the next build of spigot"
$HeroiCraftDIR/scripts/updateall.sh -n
fi
}
function stopServers {
cd $HeroiCraftDIR
scripts/stopall.sh $@
}
function startServers {
cd $HOME
./run.sh
}
function main {
stopServers "$@"
tryBuild
if [[ "$@" == "--no-start" ]]; then
echo ""
echo "Not restarting Minecraft Servers! Please reboot manually"
echo ""
else
startServers
fi
}
main "$@"