Skip to content

Commit

Permalink
Luci-app-nps change to use procd init script (#1895)
Browse files Browse the repository at this point in the history
* Add luci-app-nps

https://github.com/cnlh/nps

* Luci-app-nps change to use procd init script

* optimize Shell script
  • Loading branch information
Ardentwheel authored and coolsnowwolf committed Oct 28, 2019
1 parent 5f42c97 commit 2d08ce2
Showing 1 changed file with 12 additions and 16 deletions.
28 changes: 12 additions & 16 deletions package/lean/luci-app-nps/root/etc/init.d/nps
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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
logger -t FRPC 'Starting Nps service'
service_start /usr/bin/npc -config=$tmpconf -log_level=$Log_level -log_path=$LOGFILE
if [ "$Enabled" = "1" ];then
logger -t FRPC 'Starting Nps service'
#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
}

0 comments on commit 2d08ce2

Please sign in to comment.