travelmate: update 1.5.2

* print to stdout if 'logger' is not available
* add support to set the service nice level (default is 0)
* small fixes / polish up for forthcoming 19.07 release

Signed-off-by: Dirk Brenken <dev@brenken.org>
This commit is contained in:
Dirk Brenken 2019-11-06 21:02:17 +01:00
parent 426ed75dbe
commit 0d406b2a42
No known key found for this signature in database
GPG Key ID: 9D71CD547BFAE684
3 changed files with 14 additions and 5 deletions

View File

@ -6,7 +6,7 @@
include $(TOPDIR)/rules.mk
PKG_NAME:=travelmate
PKG_VERSION:=1.5.1
PKG_VERSION:=1.5.2
PKG_RELEASE:=1
PKG_LICENSE:=GPL-3.0-or-later
PKG_MAINTAINER:=Dirk Brenken <dev@brenken.org>

View File

@ -23,6 +23,7 @@ start_service()
procd_open_instance "travelmate"
procd_set_param command "${trm_script}" "${@}"
procd_set_param pidfile "${trm_pidfile}"
procd_set_param nice "$(uci_get travelmate extra trm_nice "0")"
procd_set_param stdout 1
procd_set_param stderr 1
procd_close_instance

View File

@ -13,7 +13,7 @@
#
LC_ALL=C
PATH="/usr/sbin:/usr/bin:/sbin:/bin"
trm_ver="1.5.1"
trm_ver="1.5.2"
trm_enabled=0
trm_debug=0
trm_iface="trm_wwan"
@ -34,6 +34,7 @@ trm_rtfile="/tmp/trm_runtime.json"
trm_fetch="$(command -v uclient-fetch)"
trm_iwinfo="$(command -v iwinfo)"
trm_wpa="$(command -v wpa_supplicant)"
trm_logger="$(command -v logger)"
trm_action="${1:-"start"}"
trm_pidfile="/var/run/travelmate.pid"
@ -100,6 +101,7 @@ f_envload()
if [ "${trm_enabled}" -ne 1 ]
then
f_log "info" "travelmate is currently disabled, please set 'trm_enabled' to '1' to use this service"
> "${trm_pidfile}"
exit 0
fi
@ -482,12 +484,17 @@ f_log()
if [ -n "${log_msg}" ] && { [ "${class}" != "debug" ] || [ "${trm_debug}" -eq 1 ]; }
then
logger -p "${class}" -t "travelmate-${trm_ver}[${$}]" "${log_msg}"
if [ -x "${trm_logger}" ]
then
"${trm_logger}" -p "${class}" -t "travelmate-${trm_ver}[${$}]" "${log_msg}"
else
printf "%s %s %s\\n" "${class}" "travelmate-${trm_ver}[${$}]" "${log_msg}"
fi
if [ "${class}" = "err" ]
then
trm_ifstatus="error"
f_jsnup
logger -p "${class}" -t "travelmate-${trm_ver}[${$}]" "Please check 'https://github.com/openwrt/packages/blob/master/net/travelmate/files/README.md' (${trm_sysver})"
> "${trm_pidfile}"
exit 1
fi
fi
@ -705,8 +712,9 @@ do
done
elif [ "${trm_action}" = "stop" ]
then
> "${trm_rtfile}"
f_log "info" "travelmate instance stopped ::: action: ${trm_action}, pid: $(cat ${trm_pidfile} 2>/dev/null)"
> "${trm_rtfile}"
> "${trm_pidfile}"
exit 0
else
f_log "info" "travelmate instance started ::: action: ${trm_action}, pid: ${$}"