mirror of
https://github.com/openwrt/packages.git
synced 2026-12-06 08:45:30 +04:00
travelmate: init optimizations
- allow manual start with disabled autostart Signed-off-by: Dirk Brenken <dev@brenken.org>
This commit is contained in:
3 files changed
+16
-21
No files matched your search
@@ -7,7 +7,7 @@ include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=travelmate
|
||||
PKG_VERSION:=3.2.0
|
||||
PKG_RELEASE:=1
|
||||
PKG_RELEASE:=2
|
||||
PKG_LICENSE:=GPL-3.0-or-later
|
||||
PKG_MAINTAINER:=Dirk Brenken <dev@brenken.org>
|
||||
|
||||
|
||||
@@ -13,14 +13,14 @@ trm_ntplock="/var/run/travelmate/travelmate.ntp.lock"
|
||||
#
|
||||
[ ! -d "${trm_ntplock%/*}" ] && mkdir -p "${trm_ntplock%/*}"
|
||||
|
||||
# check for ntp hotplug event and travelmate service autostart condition
|
||||
# check for ntp hotplug event and an enabled or running travelmate service
|
||||
#
|
||||
case "${stratum}" in
|
||||
"") ;;
|
||||
*[!0-9]*) exit 0 ;;
|
||||
*) [ "${stratum}" -lt "16" ] || exit 0 ;;
|
||||
esac
|
||||
if [ "${ACTION}" = "stratum" ] && "${trm_init}" enabled; then
|
||||
if [ "${ACTION}" = "stratum" ] && { "${trm_init}" enabled || "${trm_init}" running; }; then
|
||||
if mkdir "${trm_ntplock}" 2>/dev/null; then
|
||||
logger -p user.info -t "trm-ntp" "get ntp time sync (stratum: ${stratum:-"-"})"
|
||||
fi
|
||||
|
||||
@@ -30,25 +30,20 @@ boot() {
|
||||
}
|
||||
|
||||
start_service() {
|
||||
if "${trm_init}" enabled; then
|
||||
# no instance on boot (the interface trigger starts it) and none as
|
||||
# long as travelmate is disabled, the triggers stay in place
|
||||
if [ "${action}" = "boot" ] || [ "$(uci_get travelmate global trm_enabled "0")" != "1" ]; then
|
||||
return 0
|
||||
fi
|
||||
mkdir -p "${trm_pidfile%/*}"
|
||||
printf "%s" "${1:-"${action}"}" >"${trm_actionfile}"
|
||||
procd_open_instance "travelmate"
|
||||
procd_set_param command "${trm_daemon}" run
|
||||
procd_set_param pidfile "${trm_pidfile}"
|
||||
procd_set_param nice "$(uci_get travelmate global trm_nice "0")"
|
||||
procd_set_param stdout 0
|
||||
procd_set_param stderr 1
|
||||
procd_close_instance
|
||||
else
|
||||
logger -p user.err -t "trm-init" "travelmate service autostart is disabled"
|
||||
return 1
|
||||
# no instance on boot (the interface trigger starts it) and none as
|
||||
# long as travelmate is disabled, the triggers stay in place
|
||||
if [ "${action}" = "boot" ] || [ "$(uci_get travelmate global trm_enabled "0")" != "1" ]; then
|
||||
return 0
|
||||
fi
|
||||
mkdir -p "${trm_pidfile%/*}"
|
||||
printf "%s" "${1:-"${action}"}" >"${trm_actionfile}"
|
||||
procd_open_instance "travelmate"
|
||||
procd_set_param command "${trm_daemon}" run
|
||||
procd_set_param pidfile "${trm_pidfile}"
|
||||
procd_set_param nice "$(uci_get travelmate global trm_nice "0")"
|
||||
procd_set_param stdout 0
|
||||
procd_set_param stderr 1
|
||||
procd_close_instance
|
||||
}
|
||||
|
||||
reload_service() {
|
||||
|
||||
Reference in new issue
Block a user