Skip to content

Commit 28e0bd3

Browse files
committed
Split out commonly used functions into bin/lib, update all convenience scripts with new online check function
1 parent f7fea9c commit 28e0bd3

24 files changed

+253
-177
lines changed

bin/angel2bar

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -32,12 +32,14 @@ if [ "$1" == "-l" ]; then
3232
botctrl -a sit -n Angel -u beachbar
3333
else
3434
# Check if online
35-
botctrl -a status -c Easy | grep 'Angelus Portal' >/dev/null || {
36-
# Maybe Easy is not online
37-
botctrl -a status -c Angel | grep 'Angelus Portal' >/dev/null || {
38-
echo "Angelus Portal does not appear to be online"
39-
exit 1
40-
}
35+
[ -f /usr/local/BotControl/lib/online ] || {
36+
echo "ERROR: cannot locate /usr/local/BotControl/lib/online"
37+
exit 1
38+
}
39+
source /usr/local/BotControl/lib/online
40+
co_bot_online Angel || {
41+
echo "Angelus Portal does not appear to be online"
42+
exit 1
4143
}
4244

4345
botctrl -a stand -c Angel >/dev/null 2>&1

bin/angel2barstool

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -32,12 +32,14 @@ if [ "$1" == "-l" ]; then
3232
botctrl -a sit -n Angel -u slstool
3333
else
3434
# Check if online
35-
botctrl -a status -c Easy | grep 'Angelus Portal' >/dev/null || {
36-
# Maybe Easy is not online
37-
botctrl -a status -c Angel | grep 'Angelus Portal' >/dev/null || {
38-
echo "Angelus Portal does not appear to be online"
39-
exit 1
40-
}
35+
[ -f /usr/local/BotControl/lib/online ] || {
36+
echo "ERROR: cannot locate /usr/local/BotControl/lib/online"
37+
exit 1
38+
}
39+
source /usr/local/BotControl/lib/online
40+
co_bot_online Angel || {
41+
echo "Angelus Portal does not appear to be online"
42+
exit 1
4143
}
4244

4345
botctrl -a stand -c Angel >/dev/null 2>&1

bin/angel2clubdj

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -32,12 +32,14 @@ if [ "$1" == "-l" ]; then
3232
botctrl -a sit -n Angel -u clubdj
3333
else
3434
# Check if online
35-
botctrl -a status -c Easy | grep 'Angelus Portal' >/dev/null || {
36-
# Maybe Easy is not online
37-
botctrl -a status -c Angel | grep 'Angelus Portal' >/dev/null || {
38-
echo "Angelus Portal does not appear to be online"
39-
exit 1
40-
}
35+
[ -f /usr/local/BotControl/lib/online ] || {
36+
echo "ERROR: cannot locate /usr/local/BotControl/lib/online"
37+
exit 1
38+
}
39+
source /usr/local/BotControl/lib/online
40+
co_bot_online Angel || {
41+
echo "Angelus Portal does not appear to be online"
42+
exit 1
4143
}
4244

4345
botctrl -a stand -c Angel >/dev/null 2>&1

bin/angel2lifeguard

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -32,12 +32,14 @@ if [ "$1" == "-l" ]; then
3232
botctrl -a sit -n Angel -u lifeguard
3333
else
3434
# Check if online
35-
botctrl -a status -c Easy | grep 'Angelus Portal' >/dev/null || {
36-
# Maybe Easy is not online
37-
botctrl -a status -c Angel | grep 'Angelus Portal' >/dev/null || {
38-
echo "Angelus Portal does not appear to be online"
39-
exit 1
40-
}
35+
[ -f /usr/local/BotControl/lib/online ] || {
36+
echo "ERROR: cannot locate /usr/local/BotControl/lib/online"
37+
exit 1
38+
}
39+
source /usr/local/BotControl/lib/online
40+
co_bot_online Angel || {
41+
echo "Angelus Portal does not appear to be online"
42+
exit 1
4143
}
4244

4345
botctrl -a stand -c Angel >/dev/null 2>&1

bin/angel2pole

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -32,12 +32,14 @@ if [ "$1" == "-l" ]; then
3232
botctrl -a sit -n Angel -u rpole
3333
else
3434
# Check if online
35-
botctrl -a status -c Easy | grep 'Angelus Portal' >/dev/null || {
36-
# Maybe Easy is not online
37-
botctrl -a status -c Angel | grep 'Angelus Portal' >/dev/null || {
38-
echo "Angelus Portal does not appear to be online"
39-
exit 1
40-
}
35+
[ -f /usr/local/BotControl/lib/online ] || {
36+
echo "ERROR: cannot locate /usr/local/BotControl/lib/online"
37+
exit 1
38+
}
39+
source /usr/local/BotControl/lib/online
40+
co_bot_online Angel || {
41+
echo "Angelus Portal does not appear to be online"
42+
exit 1
4143
}
4244

4345
botctrl -a stand -c Angel >/dev/null 2>&1

bin/bot2bar

Lines changed: 16 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -42,11 +42,14 @@ case "${bot}" in
4242
;;
4343
Angel*|angel*)
4444
# Check if online
45-
botctrl -a status -c Easy | grep Angel >/dev/null || {
46-
botctrl -a status -c Angel | grep Angel >/dev/null || {
47-
echo "Angelus does not appear to be online"
48-
exit 1
49-
}
45+
[ -f /usr/local/BotControl/lib/online ] || {
46+
echo "ERROR: cannot locate /usr/local/BotControl/lib/online"
47+
exit 1
48+
}
49+
source /usr/local/BotControl/lib/online
50+
co_bot_online Angel || {
51+
echo "Angelus Portal does not appear to be online"
52+
exit 1
5053
}
5154
botctrl -a stand -c Angel >/dev/null 2>&1
5255
sleep 1
@@ -56,11 +59,14 @@ case "${bot}" in
5659
;;
5760
Easy*|easy*)
5861
# Check if online
59-
botctrl -a status -c Angel | grep Easy >/dev/null || {
60-
botctrl -a status -c Easy | grep Easy >/dev/null || {
61-
echo "Easy does not appear to be online"
62-
exit 1
63-
}
62+
[ -f /usr/local/BotControl/lib/online ] || {
63+
echo "ERROR: cannot locate /usr/local/BotControl/lib/online"
64+
exit 1
65+
}
66+
source /usr/local/BotControl/lib/online
67+
co_bot_online Easy || {
68+
echo "Easy Islay does not appear to be online"
69+
exit 1
6470
}
6571
botctrl -a stand -c Easy >/dev/null 2>&1
6672
sleep 1

bin/bot2barstool

Lines changed: 16 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -42,11 +42,14 @@ case "${bot}" in
4242
;;
4343
Angel*|angel*)
4444
# Check if online
45-
botctrl -a status -c Easy | grep Angel >/dev/null || {
46-
botctrl -a status -c Angel | grep Angel >/dev/null || {
47-
echo "Angelus does not appear to be online"
48-
exit 1
49-
}
45+
[ -f /usr/local/BotControl/lib/online ] || {
46+
echo "ERROR: cannot locate /usr/local/BotControl/lib/online"
47+
exit 1
48+
}
49+
source /usr/local/BotControl/lib/online
50+
co_bot_online Angel || {
51+
echo "Angelus Portal does not appear to be online"
52+
exit 1
5053
}
5154
botctrl -a stand -c Angel >/dev/null 2>&1
5255
sleep 1
@@ -56,11 +59,14 @@ case "${bot}" in
5659
;;
5760
Easy*|easy*)
5861
# Check if online
59-
botctrl -a status -c Angel | grep Easy >/dev/null || {
60-
botctrl -a status -c Easy | grep Easy >/dev/null || {
61-
echo "Easy does not appear to be online"
62-
exit 1
63-
}
62+
[ -f /usr/local/BotControl/lib/online ] || {
63+
echo "ERROR: cannot locate /usr/local/BotControl/lib/online"
64+
exit 1
65+
}
66+
source /usr/local/BotControl/lib/online
67+
co_bot_online Easy || {
68+
echo "Easy Islay does not appear to be online"
69+
exit 1
6470
}
6571
botctrl -a stand -c Easy >/dev/null 2>&1
6672
sleep 1

bin/bot2dj

Lines changed: 16 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -78,11 +78,14 @@ case "${BOT}" in
7878
;;
7979
Angel*|angel*)
8080
# Check if online
81-
botctrl -a status -c Easy | grep Angel >/dev/null || {
82-
botctrl -a status -c Angel | grep Angel >/dev/null || {
83-
echo "Angelus does not appear to be online"
84-
exit 1
85-
}
81+
[ -f /usr/local/BotControl/lib/online ] || {
82+
echo "ERROR: cannot locate /usr/local/BotControl/lib/online"
83+
exit 1
84+
}
85+
source /usr/local/BotControl/lib/online
86+
co_bot_online Angel || {
87+
echo "Angelus Portal does not appear to be online"
88+
exit 1
8689
}
8790
botctrl -a stand -c Angel >/dev/null 2>&1
8891
sleep 1
@@ -92,11 +95,14 @@ case "${BOT}" in
9295
;;
9396
Easy*|easy*)
9497
# Check if online
95-
botctrl -a status -c Angel | grep Easy >/dev/null || {
96-
botctrl -a status -c Easy | grep Easy >/dev/null || {
97-
echo "Easy does not appear to be online"
98-
exit 1
99-
}
98+
[ -f /usr/local/BotControl/lib/online ] || {
99+
echo "ERROR: cannot locate /usr/local/BotControl/lib/online"
100+
exit 1
101+
}
102+
source /usr/local/BotControl/lib/online
103+
co_bot_online Easy || {
104+
echo "Easy Islay does not appear to be online"
105+
exit 1
100106
}
101107
botctrl -a stand -c Easy >/dev/null 2>&1
102108
sleep 1

bin/bot2pool

Lines changed: 16 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -42,11 +42,14 @@ case "${bot}" in
4242
;;
4343
Angel*|angel*)
4444
# Check if online
45-
botctrl -a status -c Easy | grep Angel >/dev/null || {
46-
botctrl -a status -c Angel | grep Angel >/dev/null || {
47-
echo "Angelus does not appear to be online"
48-
exit 1
49-
}
45+
[ -f /usr/local/BotControl/lib/online ] || {
46+
echo "ERROR: cannot locate /usr/local/BotControl/lib/online"
47+
exit 1
48+
}
49+
source /usr/local/BotControl/lib/online
50+
co_bot_online Angel || {
51+
echo "Angelus Portal does not appear to be online"
52+
exit 1
5053
}
5154
botctrl -a stand -c Angel >/dev/null 2>&1
5255
sleep 1
@@ -56,11 +59,14 @@ case "${bot}" in
5659
;;
5760
Easy*|easy*)
5861
# Check if online
59-
botctrl -a status -c Angel | grep Easy >/dev/null || {
60-
botctrl -a status -c Easy | grep Easy >/dev/null || {
61-
echo "Easy does not appear to be online"
62-
exit 1
63-
}
62+
[ -f /usr/local/BotControl/lib/online ] || {
63+
echo "ERROR: cannot locate /usr/local/BotControl/lib/online"
64+
exit 1
65+
}
66+
source /usr/local/BotControl/lib/online
67+
co_bot_online Easy || {
68+
echo "Easy Islay does not appear to be online"
69+
exit 1
6470
}
6571
botctrl -a stand -c Easy >/dev/null 2>&1
6672
sleep 1

bin/bots2bar

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -41,16 +41,14 @@ done
4141
for bot in Angel Easy
4242
do
4343
# Check if online
44-
if [ "${bot}" == "Angel" ]; then
45-
use="Easy"
46-
else
47-
use="Angel"
48-
fi
49-
botctrl -a status -c ${use} | grep ${bot} >/dev/null || {
50-
botctrl -a status -c ${bot} | grep ${bot} >/dev/null || {
51-
echo "${bot} does not appear to be online"
52-
continue
53-
}
44+
[ -f /usr/local/BotControl/lib/online ] || {
45+
echo "ERROR: cannot locate /usr/local/BotControl/lib/online"
46+
exit 1
47+
}
48+
source /usr/local/BotControl/lib/online
49+
co_bot_online ${bot} || {
50+
echo "${bot} does not appear to be online"
51+
continue
5452
}
5553

5654
botctrl -a stand -c ${bot} >/dev/null 2>&1

0 commit comments

Comments
 (0)