~fkooman/vpn-maint-scripts

ref: 1.2.0 vpn-maint-scripts/bin/vpn-maint-verify-config -rwxr-xr-x 531 bytes
ed277a5eFrançois Kooman update CHANGES 2 years ago
                                                                                
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#!/bin/sh

if ! [ "root" = "$(id -u -n)" ]; then
    echo "ERROR: ${0} must be run as root!"; exit 1
fi

CONFIG_FILE_LIST="
    /etc/vpn-user-portal/config.php
    /etc/vpn-server-api/config.php
    /etc/vpn-server-node/config.php
"

for CONFIG_FILE in ${CONFIG_FILE_LIST}; do
    if [ -f "${CONFIG_FILE}" ]; then
        if ! /usr/bin/php -l "${CONFIG_FILE}" >/dev/null 2>/dev/null; then
            echo "Syntax error in \"${CONFIG_FILE}\":"
            /usr/bin/php -l "${CONFIG_FILE}"
            exit 1
        fi
    fi
done