forked from UsergeTeam/Userge
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinit.sh
55 lines (47 loc) · 1.01 KB
/
init.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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
#!/bin/bash
#
# Copyright (C) 2020 by UsergeTeam@Github, < https://github.com/UsergeTeam >.
#
# This file is part of < https://github.com/UsergeTeam/Userge > project,
# and is released under the "GNU v3.0 License Agreement".
# Please see < https://github.com/uaudith/Userge/blob/master/LICENSE >
#
# All rights reserved.
. init/logbot/logbot.sh
. init/utils.sh
. init/checks.sh
trap handleSigTerm TERM
trap handleSigInt INT
initUserge() {
printLogo
assertPrerequisites
sendMessage "Initializing Userge ..."
assertEnvironment
editLastMessage "Starting Userge ..."
printLine
}
startUserge() {
runPythonModule userge "$@"
}
stopUserge() {
sendMessage "Exiting Userge ..."
exit 0
}
handleSigTerm() {
log "Exiting With SIGTERM (143) ..."
stopUserge
endLogBotPolling
exit 143
}
handleSigInt() {
log "Exiting With SIGINT (130) ..."
stopUserge
endLogBotPolling
exit 130
}
runUserge() {
initUserge
startLogBotPolling
startUserge "$@"
stopUserge
}