Test stderr logging
parent
09a4b2fcf9
commit
0177c4e9e8
|
@ -7,13 +7,13 @@
|
|||
CONFIG_FILE='/etc/wgapi/config'
|
||||
SERVERS_FILE='/etc/wgapi/servers'
|
||||
if ! [ ${#} -eq 2 ]; then
|
||||
printf 'ERROR! Bad input: %s %s\n' "${0}" "${*}"
|
||||
printf 'ERROR! Bad input: %s %s\n' "${0}" "${*}" >&2
|
||||
"${LIB_DIR}/http_res" 500; exit
|
||||
fi & if ! [ -x '/usr/bin/wg' ]; then
|
||||
printf 'ERROR! %s could not find /usr/bin/wg\n' "${0}"
|
||||
printf 'ERROR! %s could not find /usr/bin/wg\n' "${0}" >&2
|
||||
"${LIB_DIR}/http_res" 500; exit
|
||||
fi & if ! [ -f "${CONFIG_FILE}" ]; then
|
||||
printf 'ERROR! %s could not find %s!\n' "${0}" "${CONFIG_FILE}"
|
||||
printf 'ERROR! %s could not find %s!\n' "${0}" "${CONFIG_FILE}" >&2
|
||||
"${LIB_DIR}/http_res" 500; exit
|
||||
fi
|
||||
source "${CONFIG_FILE}"
|
||||
|
@ -61,7 +61,7 @@ fi
|
|||
|
||||
# Create new domain
|
||||
domain="${hostname:?}.${username:?}.${TLD:?}"
|
||||
printf 'New domain will be %s\n' "${domain}" >>"${LOGFILE}"
|
||||
printf 'New domain will be %s\n' "${domain}" >&2
|
||||
|
||||
# Get peer IP list
|
||||
if ! wg_output="$(sudo /usr/bin/wg show "${TLD}" allowed-ips)"; then
|
||||
|
|
|
@ -6,13 +6,13 @@
|
|||
|
||||
CONFIG_FILE='/etc/wgapi/config'
|
||||
if ! [ ${#} -eq 2 ]; then
|
||||
printf 'ERROR! Bad input: %s %s\n' "${0}" "${*}" >>"${LOGFILE}"
|
||||
printf 'ERROR! Bad input: %s %s\n' "${0}" "${*}" >&2
|
||||
"${LIB_DIR}/http_res" 500; exit
|
||||
fi & if ! [ -x '/usr/bin/wg' ]; then
|
||||
printf 'ERROR! %s could not find /usr/bin/wg\n' "${0}" >>"${LOGFILE}"
|
||||
printf 'ERROR! %s could not find /usr/bin/wg\n' "${0}" >&2
|
||||
"${LIB_DIR}/http_res" 500; exit
|
||||
fi & if ! [ -f "${CONFIG_FILE}" ]; then
|
||||
printf 'ERROR! %s could not find %s!\n' "${0}" "${CONFIG_FILE}" >>"${LOGFILE}"
|
||||
printf 'ERROR! %s could not find %s!\n' "${0}" "${CONFIG_FILE}" >&2
|
||||
"${LIB_DIR}/http_res" 500; exit
|
||||
fi; source "${CONFIG_FILE}"
|
||||
ip="${1}"
|
||||
|
|
|
@ -10,13 +10,13 @@
|
|||
|
||||
CONFIG_FILE='/etc/wgapi/config'
|
||||
if ! [ ${#} -eq 4 ]; then
|
||||
printf '%s Bad usage: %s\n' "${0}" "${*}"
|
||||
printf '%s Bad usage: %s\n' "${0}" "${*}" >&2
|
||||
exit 3
|
||||
fi & if [ -f "${CONFIG_FILE}" ]; then
|
||||
printf 'ERROR: %s could not find config at %s!\n' "${0}" "${CONFIG_FILE}"
|
||||
printf 'ERROR: %s could not find config at %s!\n' "${0}" "${CONFIG_FILE}" >&2
|
||||
exit 4
|
||||
fi & if [ -x /usr/bin/wg ]; then
|
||||
printf 'ERROR: /usr/bin/wg not found\n'
|
||||
printf 'ERROR: /usr/bin/wg not found\n' >&2
|
||||
exit 5
|
||||
fi; source "${CONFIG_FILE}"
|
||||
server="${1}"
|
||||
|
|
|
@ -20,9 +20,11 @@
|
|||
[X] Let this server route traffic for all hosts
|
||||
[X] Prevent deleting user's only peer
|
||||
[X] Remove bash errors
|
||||
[ ] Move loging to STDERR
|
||||
[ ] Federated servers
|
||||
[ ] shellcheck
|
||||
[ ] Deploy on GF4
|
||||
[ ] Prepare for IPv4 exhaustion
|
||||
[ ] Deduplicate code
|
||||
[ ] shellcheck
|
||||
[ ] Write tests
|
||||
|
|
Loading…
Reference in New Issue