forked from UsergeTeam/Userge
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinit.sh
51 lines (44 loc) · 991 Bytes
/
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
#!/bin/bash
#
# Copyright (C) 2020-2021 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/UsergeTeam/Userge/blob/master/LICENSE >
#
# All rights reserved.
. init/logbot/logbot.sh
. init/proc.sh
. init/utils.sh
. init/checks.sh
trap 'handleSig SIGHUP' HUP
trap 'handleSig SIGTERM' TERM
trap 'handleSig SIGINT' INT
trap '' USR1
handleSig() {
log "Exiting With $1 ..."
killProc
}
initUserge() {
printLogo
assertPrerequisites
sendMessage "Initializing Userge ..."
assertEnvironment
editLastMessage "Starting Userge ..."
printLine
}
startUserge() {
startLogBotPolling
runPythonModule userge "$@"
}
stopUserge() {
sendMessage "Exiting Userge ..."
endLogBotPolling
}
runUserge() {
initUserge
startUserge "$@"
local code=$?
stopUserge
return $code
}