Skip to content

Commit ecffd71

Browse files
committed
documentation for start/stop in readme and console script
1 parent 774a06c commit ecffd71

File tree

2 files changed

+125
-0
lines changed

2 files changed

+125
-0
lines changed

README.md

+106
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,112 @@ Using https://www.devuan.org just compile and install Dowse following
113113
the procedure above. Images are available for a several popular ARM
114114
devices including RaspberryPI2 and 3, BananaPI, Cubieboard etc.
115115

116+
# Starting Dowse
117+
118+
Here below an example start script launching all services in
119+
Dowse. Some can be commented / expunged ad-hoc depending from use
120+
cases, since the only vital functions are `redis-server`, `dhcpd` and
121+
`dnscrypt-proxy`.
122+
123+
```zsh
124+
#/usr/bin/env zsh
125+
126+
source /etc/dowse/settings
127+
source /usr/local/dowse/zshrc
128+
129+
notice "Starting Dowse"
130+
131+
# start the redis daemon (core k/v service)
132+
start redis-server
133+
134+
notice "Starting all daemons in Dowse"
135+
136+
# launch the dhcp daemon
137+
start dhcpd
138+
139+
# start the dns encrypted tunneling
140+
start dnscrypt-proxy
141+
142+
# start the sql database
143+
start mysqld
144+
145+
# start web interface
146+
start webui
147+
148+
# start the mqtt/websocket hub
149+
start mosquitto
150+
151+
# netdata dashboard for the technical status
152+
start netdata
153+
154+
# nodejs/node-red
155+
start node-red
156+
157+
# start the cronjob handler (with resolution to seconds)
158+
start seccrond
159+
160+
notice "Dowse succesfully started"
161+
162+
}
163+
```
164+
165+
Adding the following line one can set up an open network, what we call it "party mode":
166+
167+
```
168+
echo "set party-mode ON" | redis-cli
169+
```
170+
171+
As a good practice, such a script can be launched from `/etc/rc.local` for user dowse using `setuidgid` from the `daemontools` package.
172+
173+
The next is an example on how to stop dowse, for instance from a stop.sh script:
174+
175+
```zsh
176+
#/usr/bin/env zsh
177+
178+
source /usr/local/dowse/zshrc
179+
180+
notice "Stopping all daemons in Dowse"
181+
182+
stop seccrond
183+
184+
stop mosquitto
185+
186+
stop webui
187+
188+
stop mysqld
189+
190+
# stop nodejs/node-red
191+
stop node-red
192+
193+
# stop the dashboard
194+
stop netdata
195+
196+
# stop the dns crypto tunnel
197+
stop dnscrypt-proxy
198+
199+
# stop the dhcp server
200+
stop dhcpd
201+
202+
# remove the layer 2 firewall rules
203+
ebtables-stop
204+
205+
# remove the layer 3 firewall rules
206+
iptables-snat-off
207+
iptables-stop
208+
209+
# restore backup if present
210+
# [[ -r /etc/resolv.conf.dowse-backup ]] && {
211+
# mv /etc/resolv.conf.dowse-backup /etc/resolv.conf
212+
# }
213+
214+
stop redis-server
215+
216+
notice "Dowse has stopped running."
217+
```
218+
219+
The scripts above are found in dowse source as `start.sh` and `stop.sh` and can be customised and called from the system at boot. It is also possible to run an interactive console with completion where dowse commands are available using the `console.sh` script. Once in the console all the above start/stop commands and even more internals will be available to be launched interactively.
220+
221+
116222
# Visualization
117223

118224
The DNS visualization is produced in a custom format which can be

console.sh

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
#!/bin/sh
2+
PREFIX=/usr/local/dowse
3+
if ! [ -r $PREFIX/zshrc ]; then
4+
echo "Dowse is not installed, run 'make' and 'sudo make install' first."
5+
return 1
6+
fi
7+
ZDOTDIR=$HOME/.dowse
8+
mkdir -p $ZDOTDIR
9+
cat <<EOF > $ZDOTDIR/.zshrc
10+
# local zshrc for easy start of console
11+
# generated by dowse console.sh
12+
# can be discarded after use
13+
pushd $PREFIX > /dev/null
14+
source zshrc
15+
export PROMPT="%F{yellow}%(?..%? )%{\$reset_color%}dowse@%{\$fg[red]%}%m %{\$reset_color%}%3c %# "
16+
EOF
17+
18+
ZDOTDIR=$ZDOTDIR zsh
19+

0 commit comments

Comments
 (0)