mirror of
https://github.com/coolsnowwolf/lede.git
synced 2025-04-16 04:13:31 +00:00
Luci-app-nps change to use procd init script (#1895)
* Add luci-app-nps https://github.com/cnlh/nps * Luci-app-nps change to use procd init script * optimize Shell script
This commit is contained in:
parent
ff6b0c1c67
commit
cf19c5720c
@ -2,8 +2,7 @@
|
||||
# Copyright (C) 2006-2011 OpenWrt.org
|
||||
|
||||
START=50
|
||||
SERVICE_WRITE_PID=1
|
||||
SERVICE_DAEMONIZE=1
|
||||
USE_PROCD=1
|
||||
|
||||
LOGFILE="/var/etc/nps.log"
|
||||
tmpconf="/tmp/etc/nps.conf"
|
||||
@ -46,23 +45,20 @@ nps_write_bool() {
|
||||
fi
|
||||
}
|
||||
|
||||
start() {
|
||||
start_service() {
|
||||
config_load nps
|
||||
config_foreach nps_header nps
|
||||
|
||||
if [ "$Enabled" = "0" ];then
|
||||
stop
|
||||
else
|
||||
if [ "$Enabled" = "1" ];then
|
||||
logger -t FRPC 'Starting Nps service'
|
||||
service_start /usr/bin/npc -config=$tmpconf -log_level=$Log_level -log_path=$LOGFILE
|
||||
#service_start /usr/bin/npc -config=$tmpconf -log_level=$Log_level -log_path=$LOGFILE
|
||||
procd_open_instance
|
||||
procd_set_param command /usr/bin/npc -config=$tmpconf -log_level=$Log_level
|
||||
procd_set_param file $tmpconf
|
||||
procd_set_param respawn
|
||||
procd_set_param stdout 1
|
||||
procd_set_param stderr 1
|
||||
procd_close_instance
|
||||
fi
|
||||
|
||||
return 0
|
||||
}
|
||||
|
||||
stop() {
|
||||
service_stop /usr/bin/npc
|
||||
rm $tmpconf
|
||||
logger -t FRPC 'Nps service stopped'
|
||||
return 0
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user