-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathjuno
executable file
·147 lines (121 loc) · 2.5 KB
/
juno
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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
#!/bin/bash
# Copyright (c) 2010-12, Mitchell Cooper
DIR=`dirname "$(cd "${0%/*}" 2>/dev/null; echo "$PWD"/"${0##*/}")"`
ARGS=$@
showusage() {
cat << EOF
usage: $0 [action]
start start juno IRCd
forcestart attempt to start juno under any circumstances
stop terminate juno IRCd
debug start in NOFORK mode with printed output
rehash rehash the server configuration file
help print this information
mkpasswd runs the password generator
EOF
}
runningq() {
if [ -e "$DIR/etc/juno.pid" ]; then
PID=`cat $DIR/etc/juno.pid`
RUNNING=true
fi
}
splash() {
cat << "EOF"
_ _ _
(_) (_) | |
_ _ _ _ __ ___ _ _ __ ___ __| |
| | | | | '_ \ / _ \ | | '__/ __|/ _` |
| | |_| | | | | (_) |-| | | | (__| (_| |
| |\__,_|_| |_|\___/ |_|_| \___|\__,_|
_/ |
|__/
EOF
}
check_if_running() {
if [ ! "$RUNNING" ]; then
echo "juno is not running!"
exit 1
fi
}
dostart() {
echo "Starting juno"
splash
$DIR/run/ircd $DIR
}
start() {
if [ "$RUNNING" ]; then
echo "juno is already running!"
exit 1
fi
dostart
}
forcestart() {
if [ -e "$DIR/etc/juno.pid" ]; then
rm -v $DIR/etc/juno.pid
fi
dostart
}
debug() {
if [ "$RUNNING" ]; then
echo "juno is already running!"
exit 1
fi
echo "Running in NOFORK mode."
splash
$DIR/run/ircd $DIR NOFORK
}
stop() {
check_if_running
echo "Signaling $PID TERM"
kill -TERM $PID
}
main() {
case "${ARGS[0]}" in
start)
start
;;
debug)
debug
;;
forcestart)
forcestart
;;
rehash)
check_if_running
echo "Rehashing server"
echo rehash > $DIR/etc/HUP
kill -HUP $PID
;;
stop)
stop
;;
restart)
stop
#sleep .01
forcestart
;;
reset)
rm -v $DIR/etc/juno.pid
;;
mkpasswd)
$DIR/run/mkpasswd
;;
lines)
$DIR/run/lines
;;
help)
showusage
;;
*)
echo "Incorrect parameter: ${ARGS[0]}"
echo "$0 help for help"
;;
esac
}
if [ ! "$1" ]; then
showusage
exit
fi
runningq
main