Ddns scripts have the same url path problem

Hey, guys! I have writed two custom scripts (refer to: https://github.com/openwrt/packages/blob/openwrt-22.03/net/ddns-scripts/samples/update_sample.sh), one for ipv4, another for ipv6.
they look like this:

local __URL="https://dnsapi.cn/Record.Ddns"
# ipv4
local __POSTDATA="login_token=1234567890&sub_domain=ipv4"
# ipv6
local __POSTDATA="login_token=1234567890&sub_domain=ipv6"


/usr/libexec/wget-ssl -nv -t 1 -O $DATFILE -o $ERRFILE -U "IPUpdater/1.0.1 (122232139@qq.com)" --no-check-certificate --post-data="$__POSTDATA" "$__URL" || return 1

write_log 7 "DDNS Provider answered:\n$(cat $DATFILE)"

grep -i -E '\\u64cd\\u4f5c\\u5df2\\u7ecf\\u6210\\u529f\\u5b8c\\u6210' $DATFILE >/dev/null 2>&1
return $?	# "0" if "good" or "nochg" found

And in the ddns luci page, I have configed two services:
QQ截图20240105192726

Here comes the problem: the services run Simultaneously, and they generate the same $DATFILE, "Record.Ddns" in the same path "/usr/lib/ddns/".
It means one service may read a wrong output file which is from an other service!

Please tell me how to fix it, thanks!

Topic closed!
At last I found out the "Record.Ddns" file is an temporary test file I created months ago!
Sorry, my fault! :rofl:

$DATFILE is defined here in the following way: DATFILE="$ddns_rundir/$SECTION_ID.dat"

Make sure you have unique section id's by running uci show ddns
Do not name your sections like "aaa.bbb" (Record.Ddns or alike), e.g. make it simpler like dnspod4, dnspod6.

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.