Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: procd script cannot auto re-auth (procd脚本不能在掉线之后自动重新登录) #39

Merged
merged 1 commit into from
Aug 31, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 10 additions & 7 deletions docs/init.d/goauthing
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,20 @@ START=98
PROG="/usr/bin/goauthing" # cp script to this path first
CONF="/etc/goauthing.json"

start_pre() {
"$PROG" -c "$CONF" -D deauth
"$PROG" -c "$CONF" -D auth
"$PROG" -c "$CONF" -D login
generate_command() {
CMD="\
\"$PROG\" -c \"$CONF\" -D deauth; \
\"$PROG\" -c \"$CONF\" -D auth; \
\"$PROG\" -c \"$CONF\" -D login; \
\"$PROG\" -c \"$CONF\" -D online; \
"
}

start_service() {
start_pre
generate_command
procd_open_instance
procd_set_param command "$PROG"
procd_append_param command -c "$CONF" -D online
procd_set_param command sh
procd_append_param command -c "$CMD"
procd_set_param stderr 1
procd_set_param respawn
procd_close_instance
Expand Down
17 changes: 12 additions & 5 deletions docs/init.d/goauthing@
Original file line number Diff line number Diff line change
Expand Up @@ -7,19 +7,26 @@ START=98
PROG="/usr/bin/goauthing"
SERV=goauthing # UCI config at /etc/config/goauthing

generate_command() {
CMD="\
\"$PROG\" $1 deauth; \
\"$PROG\" $1 auth; \
\"$PROG\" $1 login; \
\"$PROG\" $1 online; \
"
}

start_instance() {
local username password
config_get username config username
config_get password config password
local args="-u $username -p $password"

"$PROG" $args deauth
"$PROG" $args auth
"$PROG" $args login
generate_command "$args"

procd_open_instance
procd_set_param command "$PROG"
procd_append_param command $args online
procd_set_param command sh
procd_append_param command -c "$CMD"
procd_set_param stderr 1
procd_set_param respawn
procd_close_instance
Expand Down
Loading