-
Notifications
You must be signed in to change notification settings - Fork 1
/
irc_bashbot.sh
executable file
·59 lines (51 loc) · 1.41 KB
/
irc_bashbot.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
56
57
58
59
#!/usr/bin/env bash
#===============================================================================
# FILE: irc_bashbot.sh
# USAGE: ./irc_bashbot.sh
# DESCRIPTION: this is an irc bot that accepts commands real time
# OPTIONS: none so far
# REQUIREMENTS: decently minimal for now
# BUGS: there are some just have not found them yet
# NOTES: better documentation in the README file
# AUTHOR: cesar@pissedoffadmins.com
# ORGANIZATION: pissedoffadmins.com
# CREATED: 14 Oct 2016
# REVISION: 30
#===============================================================================
## check and source config file
if [[ -e config/irc_bashbot.config ]]
then
source config/irc_bashbot.config
else
printf "%s\n" \
"Config file not found" \
"Exiting"
exit 1
fi
## make sure script is running in the background if not force it
_TMPPID="$$"
case $(ps -o stat= -p $$) in
*+*)
## if running in foreground
exec $0 & disown $!
kill -9 ${_TMPPID} 2>&1
;;
*)
## if running in background
;;
esac
## main script elements like TRAP and TEMP_FILE
source core/main.shlib
## logging shlib
source core/logging.shlib
## SEND && RECV funcs
source core/helpers.shlib
## NICK, USER, JOIN
source core/connectors.shlib
## main SEND RECV && PONG loop
source core/loop.shlib
## calling main funcs
main
logging
connectors
loop