56 lines
1003 B
Plaintext
56 lines
1003 B
Plaintext
|
#!/bin/bash
|
||
|
# lazy cheap service script patch for alpine
|
||
|
dnsmasq_start() {
|
||
|
dnsmasq -7 /etc/dnsmasq.d
|
||
|
}
|
||
|
|
||
|
dnsmasq_stop() {
|
||
|
kill -9 $(pidof dnsmasq)
|
||
|
}
|
||
|
|
||
|
dnsmasq_restart() {
|
||
|
dnsmasq_stop; dnsmasq_start;
|
||
|
}
|
||
|
|
||
|
status() {
|
||
|
if pidof $service 2&>1 > /dev/null ; then
|
||
|
echo "$service running"
|
||
|
else
|
||
|
echo "$service not running"
|
||
|
fi;
|
||
|
}
|
||
|
|
||
|
nginx_start() {
|
||
|
nginx -t && \
|
||
|
nginx
|
||
|
}
|
||
|
nginx_stop() {
|
||
|
nginx -t && \
|
||
|
kill -9 $(pidof nginx)
|
||
|
}
|
||
|
nginx_restart() {
|
||
|
nginx_stop
|
||
|
nginx_start
|
||
|
}
|
||
|
dnsmasq_status() {
|
||
|
status
|
||
|
}
|
||
|
nginx_status() {
|
||
|
status
|
||
|
}
|
||
|
|
||
|
service="$1"
|
||
|
command="$2"
|
||
|
if [[ "$service" == 'lighttpd' ]] ; then
|
||
|
echo -e "Lighttpd replaced by nginx in diginc/pi-hole:alpine\nrunning service nginx $command instead";
|
||
|
service='nginx'
|
||
|
fi;
|
||
|
|
||
|
|
||
|
if [[ "$service" == 'dnsmasq' ]] || [[ "$service" == 'nginx' ]] ; then
|
||
|
${service}_${command} || echo "Unknown option $command"
|
||
|
else
|
||
|
echo "$service service wrapper not patched into alpine container"
|
||
|
exit 1
|
||
|
fi
|