mirror of
https://github.com/mail-in-a-box/mailinabox.git
synced 2026-03-25 19:17:22 +01:00
Dockerize using phusion/baseimage and runit services
This commit is contained in:
30
containers/docker/runit/nsd/run
Executable file
30
containers/docker/runit/nsd/run
Executable file
@@ -0,0 +1,30 @@
|
||||
#!/bin/bash
|
||||
set -e
|
||||
|
||||
PATH=/sbin:/usr/sbin:/bin:/usr/bin
|
||||
NAME=nsd # Introduce the short server's name here
|
||||
DAEMON=/usr/sbin/$NAME # Introduce the server's location here
|
||||
CONFFILE=/etc/nsd/nsd.conf
|
||||
DAEMON_ARGS="-d -c $CONFFILE"
|
||||
|
||||
NSDC=/usr/sbin/nsd-control
|
||||
|
||||
# Exit if the package is not installed
|
||||
[ -x $DAEMON ] || exit 0
|
||||
|
||||
PIDFILE=$(nsd-checkconf -o pidfile $CONFFILE)
|
||||
|
||||
prepare_environment() {
|
||||
mkdir -p "$(dirname "$(/usr/sbin/nsd-checkconf -o pidfile $CONFFILE)")"
|
||||
chown "$(/usr/sbin/nsd-checkconf -o username $CONFFILE)" "$(dirname "$(/usr/sbin/nsd-checkconf -o pidfile $CONFFILE)")"
|
||||
mkdir -p "$(dirname "$(/usr/sbin/nsd-checkconf -o database $CONFFILE)")"
|
||||
chown "$(/usr/sbin/nsd-checkconf -o username $CONFFILE)" "$(dirname "$(/usr/sbin/nsd-checkconf -o database $CONFFILE)")"
|
||||
}
|
||||
|
||||
prepare_environment
|
||||
|
||||
# Check if daemon is running
|
||||
nc -z -w 4 localhost 10222
|
||||
/usr/local/mailinabox/tools/dns_update
|
||||
|
||||
exec $DAEMON $DAEMON_ARGS
|
||||
Reference in New Issue
Block a user