mirror of
https://github.com/Dichgrem/luci-app-nyn.git
synced 2025-12-18 14:42:00 -05:00
start:hello_world
This commit is contained in:
41
nyn/files/etc/init.d/nyn
Normal file
41
nyn/files/etc/init.d/nyn
Normal file
@@ -0,0 +1,41 @@
|
||||
#!/bin/sh /etc/rc.common
|
||||
|
||||
START=99
|
||||
USE_PROCD=1
|
||||
|
||||
CONFIG=/etc/nyn/config.toml
|
||||
|
||||
start_service() {
|
||||
generate_config
|
||||
|
||||
procd_open_instance
|
||||
procd_set_param command /usr/bin/nyn -config "$CONFIG"
|
||||
procd_set_param respawn
|
||||
procd_close_instance
|
||||
}
|
||||
|
||||
stop_service() {
|
||||
procd_kill nyn
|
||||
}
|
||||
|
||||
generate_config() {
|
||||
mkdir -p /etc/nyn
|
||||
|
||||
cat >"$CONFIG" <<EOF
|
||||
# Auto-generated by UCI
|
||||
|
||||
[general]
|
||||
timeout = $(uci -q get nyn.general.timeout)
|
||||
retry = $(uci -q get nyn.general.retry)
|
||||
schedule_callback = $([ "$(uci -q get nyn.general.schedule_callback)" = "1" ] && echo "true" || echo "false")
|
||||
|
||||
[crypto]
|
||||
win_ver = "$(uci -q get nyn.crypto.win_ver)"
|
||||
client_key = "$(uci -q get nyn.crypto.client_key)"
|
||||
|
||||
[[auth]]
|
||||
user = "$(uci -q get nyn.auth.user)"
|
||||
password = "$(uci -q get nyn.auth.password)"
|
||||
device = "$(uci -q get nyn.auth.device)"
|
||||
EOF
|
||||
}
|
||||
Reference in New Issue
Block a user