DirectAdmin script starttips fails with error c: command not found

D

There is an error 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`

Which results 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 IP on the network interface is missing.

As a result NGINX may fail to start, causing an error:

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

Suggested solution:

--- 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 can fix it on their end.

As an additional solution you can set:

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

with sysctl tool.

Respect.

Add comment

By Ranjan