DirectAdmin script startips fails with an error c: command not found

There is a typo in /usr/local/directadmin/scripts/startips that breaks the script:

The script defines:

DIRECTADMIN_BIN=/usr/local/directadmin/directadmin

but uses:

ADDIP=`${DABIN} c | grep -m1 '^addip=' | cut -d= -f2`

resulting in errors:

./startips: line 36: c: command not found
./startips: line 62: 2a01:7c8:xxx:xx:xx:xx:0:1: command not found
./startips: line 62: 37.xxx.xxx.115: command not found

And the missing IP on a network interface.

NGINX may fail to start as a result, leaving an error:

bind() to [2a01:7c8:xxx:xx:xx:xx:0:1]:80 failed (99: Cannot assign requested address)

Suggested fixes:

--- startips.org        2021-12-08 16:05:11.000000000 +0100
+++ startips    2021-12-09 10:37:03.392490622 +0100
@@ -30,14 +30,15 @@
        fi
 fi
+DIRECTADMIN_BIN=/usr/local/directadmin/directadmin
+DIRECTADMIN_CONF=/usr/local/directadmin/conf/directadmin.conf
+
 IPPATH="/usr/local/directadmin/data/admin/"
 IPDIR="ips/"
 IPLIST="ip.list"
-ADDIP=`${DABIN} c | grep -m1 '^addip=' | cut -d= -f2`
+ADDIP=`${DIRECTADMIN_BIN} c | grep -m1 '^addip=' | cut -d= -f2`
 OS=`uname`
-DIRECTADMIN_BIN=/usr/local/directadmin/directadmin
-DIRECTADMIN_CONF=/usr/local/directadmin/conf/directadmin.conf
 if [ -s $DIRECTADMIN_CONF ] && [ -x $DIRECTADMIN_BIN ]; then
         ETH_DEV=`$DIRECTADMIN_BIN c | grep '^ethernet_dev=' | cut -d= -f2`
 fi

This is a patch to /usr/local/directadmin/scripts/startips as a temporary solution, until the DirectAdmin developers fix it on their side.

As an additional solution you can set:

net.ipv4.ip_nonlocal_bind = 1
net.ipv6.ip_nonlocal_bind = 1

with him System Device.

Regards.

Leave a Comment