-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathcbridge-starter-services.sh
executable file
·53 lines (47 loc) · 1.26 KB
/
cbridge-starter-services.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
#!/bin/sh
# Starter script for Chaosnet services not already built-in in cbridge (typically stream services).
# Make sure the chaosnet library is found
PYTHONPATH=.:$PYTHONPATH
# Start DOMAIN server (the stream protocol; cbridge has the simple DNS protocol built-in)
DOMAINP=0
# The NAME protocol (corresponding to TCP finger, port 79)
NAMEDP=0
# The FINGER protocol (for lisp machines and other single-user machines)
FINGERDP=0
# The LOAD protocol
LOADDP=0
# The HOSTAB protocol
# Read config file
[ -f ./cbridge-services.conf ] && . ./cbridge-services.conf
# first allow cbridge to start
sleep 3
i=0
while [ ! -S /tmp/chaos_stream ]; do
i=$((i+1));
if [ $i -gt 5 ]; then
echo "No socket at /tmp/chaos_stream - is cbridge running?";
exit 1;
fi;
sleep 2;
done
# Run anyway, but notify user
./hostat -q -t 3 3040 || echo FYI: No route to Router.Chaosnet.NET?
if [ $DOMAINP -gt 0 ]; then
python3 ./domain.py &
fi
if [ $NAMEDP -gt 0 ]; then
python3 ./named.py &
fi
if [ $FINGERDP -gt 0 ]; then
if [ "$AFFILIATION" != "" ]; then
python3 ./fingerd.py -a $AFFILIATION &
else
python3 ./fingerd.py &
fi
fi
if [ $LOADDP -gt 0 ]; then
python3 ./loadd.py &
fi
if [ $HOSTABP -gt 0 ]; then
python3 ./hostabd.py -s $HOSTAB_DNS -D $HOSTAB_DOMAIN &
fi